Skip to main content
gamedev.net
🔒 Locked

Dynamic Loading

Started by jblue May 24, 2009 at 6:32 PM 5 replies 1.3k views
Original Post
jblue
jblue
I am currently developing a sandbox racing game and I have come to a road block. I am quite familiar with programming games, but I have never attempted a sandbox style game. I would like to do a load once and then have the game play seamlessly, kind of like Burnout Paradise, but I have no idea where to start other than loading resources in the background. So what I am looking for are some good resources, tutorials, books, or research papers that go over the theory of this concept. Any help is greatly appreciated.
ddn3
ddn3
It's a little known technique, but it involves baking your resources into memory compatible blobs which are blasted into memory in one go and then ptrs are fixed up to external systems.

See this article for example.

http://www.gamasutra.com/view/feature/3998/secrets_of_multiplatform_data_.php
http://www.gamasutra.com/view/feature/3984/delicious_data_baking.php
http://www.codefarms.com/ideas.htm

search for the term

resource baking
data baking
memory blasting

Enjoy!

-ddn
jblue
jblue
Thanks these look like really good resources.
Matt_D
Matt_D
ah streaming open worlds :)

aside from the above links, some other things to consider. break your world into smallish tiles. use the links above to bake your data into game-ready formats so you can easily stream them in and stream them out. the next thing of interest is that in racing games, the car tends to move forward, quickly. so you will need to skew your tileset to include more tiles in the current direction of the car. optimal shape tends to like a teardrop shape, with the pointy end in the direction of travel.

secondly, as its a racing game, and you dont need to "enter" any areas, each tile should have a maximum memory budget. this will allow you to work out how many tiles you can fit in memory at any one time (and how many you can stream from disk).

Its worth noting that your streaming performance will dictate the maximum speed of the cars in your game too.

one other thing to consider is networking, as you want to ensure that the gameplay is deterministic (ie: if someone crashes into something which may alter the ability to play the game you want to reflect that to all players). its important to make sure that things like barrles, and crates and other props which you can drive through dont actually modify the "game" itself (and just look cool).

traffic is also an interesting problem :) deterministic algorithms are your friends.

good luck, post a link when your done :)
your never as good as they say you were, never as bad as they say you was.
all_names_taken
all_names_taken
What about physics and AI in distant parts of the map, especially in networking? While textures can be loaded on demand when the player gets closer, the shape and path finding data seem like they would be necessary to keep in memory for the entire map at all times. Any thoughts/ideas on how this could be handled? (or are AI characters simply frozen when the player is far away in non-networked apps, and distributed and transferred between different servers when we're talking MMOs etc)?
ddn3
ddn3
In the case of streaming games, esp on the consoles, if there is no centralized server to arbitrate then the peers becomes the owners of their local space. Only time there is conflict is when more than one peers space overlap, in that case you'll have to implement an arbitration algorithm ( simple first create, first own will work ) rules.

Actually AIs are despawned if they go too far outside of the players space if there isn't a server ( like in a MMO ), for most streaming games, as for pathing you can dynamically load up as much of the path space as you need, for open world games it's too prohibitive to keep the 100's of megabytes of pathing data in memory either way.

In MMO they usually have a dedicated server devoted to handling all the AIs and they manage and own them independent of the world server space, but sometimes they also implement the AIs as part of the world server, it depends upon their implementation and requirements.

-ddn
Matt_D
Matt_D
Quote:
Original post by all_names_taken
What about physics and AI in distant parts of the map, especially in networking? While textures can be loaded on demand when the player gets closer, the shape and path finding data seem like they would be necessary to keep in memory for the entire map at all times. Any thoughts/ideas on how this could be handled? (or are AI characters simply frozen when the player is far away in non-networked apps, and distributed and transferred between different servers when we're talking MMOs etc)?



ill expand a bit on dd3's post.

path finding is an interesting one, but quite straightforward. What you need is different levels of granularity. short range pathing (eg obstacle avoidance) usually needs high detail pathing information, you can stream this in (aside from dynamic objects) with your streamed data. mid to long range pathing usually deals with more goal orientated decision making.

a neat trick is to have major funnel points in your streamed data which direct the pathing to a point within a world wide high level pathing network which only contains major roads/connections. this allows you to jump to from the high detail map, to the high level map, and path to your destination from there. so if your target is 20 miles north, you know the short term path to the nearest northern funnel, and know you can head north from there to get to where you need to go.

play any game that uses a road network, and pay attention to where the GPS (or similar) funnels you when you travel long distances. youll find that you are always traversing through particular routes over and over again (usually main roads etc). or, have a look at fallout 3's map sometime ;) these choke points, or major roads, or whatever you want to call them make high level, long distance, pathfinding that much easier.

location based NPC's and what-not would also be streamed in with the level data.

As for AI's, well that depends. youll usually de-spawn AI at certain points, so you can re-use the memory to spawn other AI in. it depends heavily on your game.

Networking is where things get interesting. You need to ensure that, even in a streaming open world, that the gameplay is deterministic. which usually means that the static world collision geometery never changes. thinks that are intractable (like boxes in a driving game) will have no gameplay impact (eg: you never lose speed hitting boxes, or barrles). anything which can impact determinism (eg: boxes you can jump on in 3rd person shooters) will need to be persistent in memory across all clients. as they will impact the determinism of the simulation.

what usually happens is that you only really care about simulating the physics for other network players when they are within visible range, this will keep your cpu load down, once within visible range, youll need to start actually simulating the physics for the player (how you do that will depend on your network model), and as your simulation will need to be deterministic, you need to take into account props which influence the simulation ;)

as for MMO's, well ive never written one, but i imagine that a similar approach is taken, except that you dont really care simulating what anyone else is doing (you get told via the server). the server is then responsible for updating the game state, and simulating whats going on.

networking makes everything that much more complex :) you really need to design it in from the start, especially when it comes to open world games :)
your never as good as they say you were, never as bad as they say you was.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.