Notgames Forum
July 18, 2024, 04:20:38 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
   Home   Help Search Calendar Login Register  
Pages: [1]
Author Topic: Endless Forest/The Path Map Question  (Read 17801 times)

Posts: 584

View Profile WWW
« 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.

Irony is for cowards.

Posts: 129

View Profile
« 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.
Michaël Samyn

Posts: 2042

View Profile WWW
« 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

Posts: 11

View Profile WWW
« 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 :

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.

Michaël Samyn

Posts: 2042

View Profile WWW
« Reply #4 on: September 03, 2010, 05:11:17 PM »

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

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!