Pages: [1]

Endless Forest/The Path Map Question

Endless Forest/The Path Map Question
« on: August 18, 2010, 12:20:03 am »

Michaël, I'm curious how you managed the "looping" map. You know how if you go far enough, you come back around on the opposite side of the map, thus giving the impression the forest is "endless?" I can't recall the technical term for it right this moment but it's a great way to avoid having the player bump into an invisible wall. I've been curious about this for a while as it's a trick I'd like to incorporate in my own game.
Logged

Irony is for cowards.
Re: Endless Forest/The Path Map Question
« Reply #1 on: August 18, 2010, 03:53:28 am »

Assuming your level is at least 4 times as big as your viewing distance, you can use the following technique.

- Split your level in at least 4 pieces*
- Loop the position of your player / camera at the level' dimensions.
- When a level piece is more then half the level size away, move it a "level size" closer ( per axis ).

So for example .. the red player starts moving towards a edge of the level.


Now that he's gotten closer to the edge of the level then the center, the level pieces jump to the other side.


After passing through the level boundary ( green rectangle ) the player ends up on the other side, which makes the level pieces move back into place.


*It is recommended to make each piece slightly bigger then your viewing distance, this will allow you to do some very cheap & efficient clipping.
Logged
Re: Endless Forest/The Path Map Question
« Reply #2 on: August 18, 2010, 10:13:50 am »

We simply zap the player character to the opposite edge of the game world.
And the game world is made up of tiles. To show the first tile when you're on the last one, we use a second camera that is positioned at the other end of the world, relative to the player's position.

For performance, make your tile size as small as possible (meaning, I guess, as small as your viewing distance -with some margin, depending on the scenery). And make sure you never draw more tiles than are visible. This is a bit tricky to figure out, but in a first pass, simply check if the tile is within a certain distance of the player. Later you can refine so that tiles that are behind the camera are not drawn.

In The Endless Forest, we used to have very big tiles. Four tiles for the entire world as it is now. But after research done for The Path, we realized that smaller tiles were much faster. So we cut each tile in four. The forest in The Path is made up of 32 tiles, I think, of which only a maximum of 9 is visible at any moment.

Hope this helps.
« Last Edit: August 18, 2010, 10:18:50 am by Michaël Samyn »
Logged
Re: Endless Forest/The Path Map Question
« Reply #3 on: September 03, 2010, 01:32:38 pm »

Michaël, I just discovered The Endless Forest (where have I been these paset 5 years?) and this (not)game is astonishing! I wrote a review in french on it, maybe you are interested : http://oujevipo.fr/30-minutes-et/the-endless-forest

I'm sorry if this isn't really the subject of the topic, but i didn't want to create one for it, and this was the only one talking about endless forest.

Thanks.
Logged
Re: Endless Forest/The Path Map Question
« Reply #4 on: September 03, 2010, 05:11:17 pm »

Thank you!  Smiley
Logged
Pages: [1]
Jump to: