Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1367840 Posts in 64171 Topics- by 56092 Members - Latest Member: nc

October 17, 2019, 06:15:13 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsIsolation, a seamless exploration game
Pages: 1 [2]
Print
Author Topic: Isolation, a seamless exploration game  (Read 6797 times)
DangerMomentum
Level 3
***



View Profile WWW
« Reply #20 on: December 26, 2010, 03:47:51 PM »

I couldn't really find too much info on them, but I'll take some time to describe my approach to everything. My classes are WorldStreamer, Cell, and WorldElement. A Cell consists of a collection of WorldElements, a world coordinate, and misc info like the background, music, and lighting to use. The world coordinate is a pair of integers that represent what slot the cell should be in on the world grid. Cells cannot overlap, instead it's like a giant tilemap. WorldElement is a parent class for everything that can be placed as part of the environment, like polygons and doodads. Their coordinates are stored relative to the Cell that owns them, so a WorldElement at 0, 0 would appear at the upper left corner of its respective Cell. WorldElements that generate collisions are marked with a special flag in the editor so that they can be easily differentiated. That pretty much covers the way the world data is stored.

The last bit, getting it loaded during gameplay, is what the WorldStreamer is for. The WorldStreamer is a singleton that maintains a 2D array of the loaded Cells. WorldStreamer has a queue of needed resources and a method called Run that runs in its own thread. This method loads each thing in the queue one by one until all needed resources are in memory. The engine uses a GetCell(x, y) method to interact with the WorldStreamer. The WorldStreamer will give the cell at the wanted position if it is loaded in memory, and if it isn't it adds it to the load queue. As far as what it returns if the Cell isn't in memory, I recently switched a bit of how I handled this, so I'll mention both approaches here. My first approach was to return a temporary Cell that was a giant solid square. That way the player couldn't actually get into a Cell before it's been loaded. I thought about this and didn't want this to impact the ability of players to try speed runs on my game, so I decided that I would load all collision data when the game is initialized and only stream in the visual geometry. By keeping the environment collision masks low-poly and using the drawn polygons to do all of the detail I can fit that in memory without any issues.

The last bits of the puzzle are unloading resources and tracking Entities. I make the Cell the Player is in the "focus cell" and the 8 surrounding Cells are also updated / loaded. When a Cell is no longer one of these 9 Cells, it's unloaded from memory. Entities work in the same way. Any Entity in one of the 9 active Cells has its Update and Draw called regularly. The only exception is as follows: If an Entity is marked as "essential," and it's in a Cell that should be unloaded, that Cell is not unloaded. "essential" entities are updated regardless of if they are in the active Cells or not.

That pretty much sums up everything. The focus follows the player as he moves from Cell to Cell, and the amount of time it takes for him to traverse one Cell is usually more than enough to load the resources for the next. If it isn't, the player sees some pop in, but gameplay is still identical because collisions have been loaded beforehand. If you have any more questions / want to see actual code, feel free to ask! Hope that helps Wink
Logged

wogan
Level 0
**



View Profile
« Reply #21 on: December 27, 2010, 07:45:57 AM »

this looks GREAT. when will we get to play it? it looks like a biiiig project, so I'd imagine it won't be for a while?
Logged

Yeaaahhhh WOGAN!
TheSpaceMan
Level 1
*



View Profile WWW
« Reply #22 on: December 27, 2010, 08:25:15 AM »

[... Good description of the system...]

Thank you.

That makes sense, also that you keep important objects active and they keep the cells active. Maybe you could optimize it one step further and just keep the collision data and interactable object for the area, sounds like you are keeping the graphics as well?

It would be interesting trying to implement a Zelda game using this logic as well. But maybe need a bit more logic to try to keep enemies in their native areas...

That made me think of something else.
How will you handle monsters. Will a monster be owned by the cell they are currently in, or where they where created. Both of these can be come a problem. 1: A zone deviod of life due to all enemies migrating to another cell. 2: Enemies being despawned because the owner cell is out of range...
Logged

Follow The Flying Thing, my current project.
http://forums.tigsource.com/index.php?topic=24421.0
DangerMomentum
Level 3
***



View Profile WWW
« Reply #23 on: December 27, 2010, 08:37:48 AM »

[... Good description of the system...]

Thank you.

That makes sense, also that you keep important objects active and they keep the cells active. Maybe you could optimize it one step further and just keep the collision data and interactable object for the area, sounds like you are keeping the graphics as well?

It would be interesting trying to implement a Zelda game using this logic as well. But maybe need a bit more logic to try to keep enemies in their native areas...

That made me think of something else.
How will you handle monsters. Will a monster be owned by the cell they are currently in, or where they where created. Both of these can be come a problem. 1: A zone deviod of life due to all enemies migrating to another cell. 2: Enemies being despawned because the owner cell is out of range...

All textures and graphics are streamed / unloaded, the only thing that is always kept in memory is the shape of each polygon for the collision data. If you do make it to an area before it gets loaded, you won't fall through the world, but you won't see anything there. It's not the best solution, but I don't want to punish players for being fast.

As for monsters, larger / more notable things like bosses will be marked essential and won't respawn once they've been killed. All monsters start in the Cell they were spawned in, but can move to other active Cells at will. If the Cell they're in is deactivated, they're despawned, but when you re-activate the Cell they originated in they'll respawn. You could technically abuse this to duplicate enemies, but since it will only work on small ones it shouldn't be an issue. It'd just be like running into another one in the wild. Since their AI will primarily respond to the player, making them not leave their original Cell without being lured or forced to by the player shouldn't be an issue.

To be honest, some of this is still theory and has yet to be implemented, but I'm fairly certain it won't be a big issue. If I make any changes to this I'll give a followup post explaining what actually worked. I hope this helps!

this looks GREAT. when will we get to play it? it looks like a biiiig project, so I'd imagine it won't be for a while?

Thanks! I'm actually hoping to get a player movement test out relatively soon so that people can try their best to break it / get out of the environment / etc. It won't be huge, but should give a good idea of how the game will control and play. Keep your eyes out for it, I'll be making a post about it here when it's ready Wink
Logged

DangerMomentum
Level 3
***



View Profile WWW
« Reply #24 on: December 27, 2010, 11:05:51 PM »

Not quite "music," but I put together some creepy ambiance to use in the game. I think this should help set the mood nicely. Thoughts?

Logged

thedaemon
Level 2
**



View Profile WWW
« Reply #25 on: December 28, 2010, 03:52:07 AM »

I'd have to hear it first.
Logged
Sean A.
Level 8
***



View Profile
« Reply #26 on: December 28, 2010, 09:48:09 AM »

Started working on music a little bit. Excuse the production, I'm away from home and mixing on earbuds, but here's a little concept that's inspired by Metroid Prime's soundtrack


I <3 the Metroid Prime soundtrack, and this one sounds pretty good. Will the game have an upgrade/unlock system similar the Metroid?
Logged
DangerMomentum
Level 3
***



View Profile WWW
« Reply #27 on: December 28, 2010, 10:29:21 AM »

I <3 the Metroid Prime soundtrack, and this one sounds pretty good. Will the game have an upgrade/unlock system similar the Metroid?

Yeah, the game is going to have a progression similar to Super Metroid. The upgrades and areas will be completely different, but it's definitely going to be the same kind of flow. Super Metroid is my favorite game of all time and I've beaten it hundreds of times Grin
Logged

Sean A.
Level 8
***



View Profile
« Reply #28 on: December 28, 2010, 11:38:44 PM »

Mine is Metroid Prime, I never grew up with an SNES so I've only played it on Virtual Console and emulators. I think it's soundtracks one of my favorites too and if you can get the feel like those games then you're all set.
Logged
DangerMomentum
Level 3
***



View Profile WWW
« Reply #29 on: January 01, 2011, 07:25:18 PM »





A little video showing that enemies work and I can shoot at them. Next up, making them hurt the player. Thanks for watching!
Logged

DangerMomentum
Level 3
***



View Profile WWW
« Reply #30 on: January 06, 2011, 09:00:47 PM »

I decided I wanted to branch out and do some more creative / fun stuff for a little while, so I got the basics of post-process effects done. Right now I just hacked together a simple bloom, but I'm going to do a lot more than that later. I intend to draw the foreground and background to separate layers and adjust their brightness based on the relative light level of the other. Cells with "bright" backgrounds and "dark" foregrounds will have dimly lit silhouettes in the foreground (Think the monochrome levels in Super Meat Boy, but as a dynamic effect instead of a per-level setting). That should add a lot to the atmosphere. Secondly, I got a tablet recently and doodled together a potential concept for the protagonist. This may have no bearing on the final design, but it's my first shot at it and I like how it's coming. I wish I were actually this good at figure drawing, but I kind of cheated by drawing everything over a reference picture. Still, this is for design, not actual assets, so I don't really mind.



Right click > View to see the full version, as usual. Thoughts and feedback are appreciated, as always!
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic