I want to use vector based collsions, as an uneven terrain would require minuscule tiles
This is a good approach. Don't mix display and logic: keep a detailed map (pixel-based) for display, and a vector version for logic.
Most games, even 3d ones, have these two versions: a collision mesh, and a display mesh.
What I'd like to know, is how I can get the vectors from the map above, and how I should use them. For the first part, I could manually measure out each of the coordinates, as shown below, but especially for lager and more detailed maps, that would be a tremendous amount of work.
You're correct. AAA games can pay their artists to make the collision mesh of all their assets, or pay to develop a tool to do this for them (mesh decimation). But those solutions are expensive/a waste of time for the hobbyist game developper.
I was wondering if there is a way to do this easier.
There are image-analysis algorithms (skeletton extraction, etc). Those are fidgety, hard to control and hard to code. There would be few available, and fewer in Java. They are usually scientific-minded, I don't think it is very suitable for a game development.
I suggest you work the other way around: generate the vector level by hand and let the game display that with augmented precision by selecting tiles that agree with the vector logic. This has the following advantages:
- Less hand work. In design phase, you'll decide high-level object placement, not fiddle with low-level graphics. Easier to define a generic rectangle-shaped room than take the brush and draw it out.
- Easier automation. It's easier to complexify a geometry (introduce displacement, noise, tile variations) than to simplify it (in which case you'd have to be careful of not obstructing small passages, etc.)
- Easier maintenance. If you chose to change your aesthetics, no need to redefine the whole graphics-->Vector process. You just swap the tileset, and regenerate.
if I have the coordinates of the vectors, what should I do with them? I previously used rectangles, but now I would need to use either lines or polygons that connect each coordinate.
Also, how do I check for collisions between the player's polygon or rectangle, and the polygons or lines that form the terrain? When using rectangles, I could use playerR.Intersects(terrainR), but how can I do this with a terrain?
In general, a lot of resources exist, even on SO, like this one.
If your characters follow gravity, a few raycasts downwards would do the job very nicely. You'll simply have to have a line-line intersection routine, and get the closest.
A link to an easy-to-understand tutorial would be a nice answer
See this Gamasutra article for a full-fledged collision detection algo. There are no easy solutions to player-mesh collision in the general case.