Jump to content
  • Advertisement
Sign in to follow this  
jsvcycling

Open Worlds

This topic is 2440 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm creating a video game that I'd like to be an open world game similar to how Assassin's Creed: Brotherhood does it. I don't want it to be procedurally generated, like in Minecraft. I want it to be a predefined map that gets loaded as the player moves around. This is going to be my first major game and I need some insight on how I should approach this. Below are some things that I know I'm gonna use in my game (some might not be related to this, but you never know...):

  • C++
  • OpenGL
  • SDL
  • Glut
  • GWEN
  • Bullet Physics Engine
  • Custom Engine
  • Boost (for python scripting support, etc.)I'm trying to make the game cross-platformable with minimal code changes (making it easier to update).

    Thanks in advance for any help.

Share this post


Link to post
Share on other sites
Advertisement
It begins with the word 'streaming' and ends with the word 'chunks'.
Seriously though, that's a very big question - which will have a whole load of variables depending on what game you're making and what kind of system you're looking for. Read up some on streaming geometry and that should get you started - later on feel free to ask some more directed questions.

Share this post


Link to post
Share on other sites
Yeah, the reason I asked is because there really isn't a simple answer. It's more like a soup of solutions. LOD terrain/models is one aspect. Then you have to break the work up into various chunks and continuously load the chunks around the player.

Share this post


Link to post
Share on other sites
Yeah, chunks are pretty much the "solution"; think of you player as moving across a grid in the world, at any given time you'll need a selection of chunks loaded around them.

The details depend on the game and gets complicated as you increase the distance the player can see in the world, which also brings it's own fun of depth buffer precision too

Share this post


Link to post
Share on other sites
Alright, so chunk streaming seems the way to go... So can anyone give me some insights as to how to setup a chunk streaming system? I did a web search on both streaming chunks and chunk streaming and all the results are related to web development (mostly ASP.NET).

Share this post


Link to post
Share on other sites
Also, do I have to use a chunk streaming compatible file format for anything that I'd like to stream? Or do I just make the map, then break it up into pieces (separate files) then put them all in something like a *.pk3 file?

EDIT: Do you think (or know) the boost library (boost.org) would have something for chunk streaming...?

Share this post


Link to post
Share on other sites
Here's a good write on the system which alot of games use.

http://www.gamasutra...data_baking.php

They build the asset for the desired platform then dump it as a binary blob, which is then read in at runtime and they fix up the pointers where needed. It's tricky to get right but once you have the system in place it's very robust.

Good Luck!

-ddn

Share this post


Link to post
Share on other sites
Whatever the "chunk" is depends on your game. It could be groups of local entities, blocks of 2D or 3D maps, node graphs of AI, or whatever.

There is no out-of-the-box system for "chunk streaming", because "chunks" are a concepts that are game or application-dependent, and "streaming" just means moving the data from one place to another (whether it's from one computer to another computer over a network, or from disk file to RAM, or from one part of your program to another part), there is no library that can ever possibly cover all the solutions.
There are libraries for streams, there are libraries for networking, there are libraries for file loading, there are libraries for 3D modelling or whatever.

"Chunk streaming" isn't an answer to a problem, it's the name of the problem, and how you go about solving that problem is up to you. But rest easy, it's not a complicated problem! wink.gif

If in your case a "chunk" is a segment of terrain data, then all you have to do is have your world broken up into equal size chunks (They don't even have to be equal size chunks, but for simplicity's sake, let's assume they are), and figure out what chunk the player is currently on, and what chunks are around the area the player is currently on, and load them all.

[size="1"]chunkstreaming.png

The size of a chunk completely depends on whatever works for your game. It could be a mile wide, or only a dozen feet.
How the chunk is loaded depends on what custom or non-custom file type you make your chunk.
How near a chunk has to be to be loaded into memory again depends on the needs of your game (and even the current gamestate... looking through binoculars might require even more distant chunks to be temporarily loaded and then discarded).

Also, just because a chunk is loaded does not mean you need to display it (only display the ones in the direction the player is looking), and just because it's visible/not-visible does not mean you have to (or don't have to) do collision detection on it (only do collision checks with the objects immediately around the player, which is a much smaller radius then the player's sight. Also, just because an object is not visible, doesn't mean you skip doing collisions, or the player could walk through walls by walking backwards).

Honestly, streaming chunks is absurdly simple. Currently, you load a texture or sound file when it's needed, and unload it when it's unneeded. Well, you can just as easily load a chunk of an area when it's needed, and unload that when it's no longer needed.
The hard part is loading the chunks fast enough to be "seamless" (no lag spike [size=2]or game pause [size=2]when crossing chunk boundaries).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!