Jump to content
  • Advertisement
Sign in to follow this  
Dev_NightDreamer

Handling an open world

This topic is 988 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

Hi all,

In the last 2 years I learned a lot about 3D, OpenGL, GLSL, Rendering techniques like instanced rendering, framebuffers and post processing, but also things like ECS vs OOP, state managing, different Frameworks (GLFW, SDL, SFML, ...),
Physics (BulletPhysics) and stuff like that.
Previously I made little 2D games in Java and C++.

Now I'm feeling ready to dig deeper.
My current project is a 3D open world game. Graphics isn't relevant, that's why it will simply consist of low poly objects with low res textures and a pixelating post processing shader with a sci fi setting.
The first idea is a city, which feels a little bit like a living world.

Therefore my goals are cutted to
these points:
- animated neon lights and general lighting (banners, "advertises", street lamps, ambient lighting, etc.)
- walking pedestrians
- flying cars on multiple height levels
- moving around in first person

I think, I can definitely achieve this in a few years with my current knowledge. But there is one simple point I can't wrap my head around it:

<strong>TL:DR</strong>
- How are multiple (hundreds of) objects (buildings) handled? I know how I can render anything,but I didn't think, that I need to render anything at the same time. But how I can easily achieve it, to determine if something should be rendered and something not? How can I calculate if it is visible at the current position and view direction of the player?
And that, without hitting the performance a lot?

My ideas:
I know about texture streaming but is sonething like that possible for whole game objects? Like "game object streaming"?

I read stuff about so called SceneGraphs. But I don't really get it how it can help me? When each objects position is stored relatively to its parent position, in which way it would be simplier/faster to determine, if its in the viewport or not?

I hope it is understandable what I mean. :)

PS:
Please don't answer, if you just want to tell me something like "GTA V has over 1000 members in over 3 years full time". I appreciate it.

Share this post


Link to post
Share on other sites
Advertisement


How are multiple (hundreds of) objects (buildings) handled? I know how I can render anything,but I didn't think, that I need to render anything at the same time. But how I can easily achieve it, to determine if something should be rendered and something not? How can I calculate if it is visible at the current position and view direction of the player?
And that, without hitting the performance a lot?

 

You will typically use frustum culling for this purpose: http://www.lighthouse3d.com/tutorials/view-frustum-culling/

Also, you can use simplified buildings for distant ones (level of detail, LOD)..

Share this post


Link to post
Share on other sites
You can put your world into smaller grid sized bits to implement with the suggestion above to cut down on what you have to check if it is in or out as you will only have to test things in your grid + grid(s) that are infront of you

Share this post


Link to post
Share on other sites

there are actually two issues to be dealt with:

1. drawing it all.   frustum cull is the first step.   depending on scene type, additional methods of VSD and reducing rasterizing such as oct-trees, occlusion culling, LOD, terrain chunks, optimized render queue, etc  may help. well - optimized render queue always helps <g>.  and don't forget to make your assets speed friendly in size.

2. fitting it all into memory. streaming, asset reuse, small (low ram) assets, real-time procedural generation - all these can be employed.

 

start with a prototype with a frustum cull and a whole bunch of cubes, enough to get the number of triangles onscreen as you want in the game. see how fast that runs. if its not good enough, consider your scene type and determine what additional method(s) are called for. implement and test. repeat until fast enough.

 

once you can draw it fast enough, then all you need to do is figure out how to get the bits of data you need into ram when you need them - some how. streaming is a popular solution. i use small assets, heavy asset reuse, and real-time procedural terrain chunk generation (both on-demand and in the background).

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

Thanks at all! That made it a bit clearer, especially the frustum culling. smile.png

 

I would appreciate it, if I could do this. But for me, there's one detail missing...

If I have a bunch of meshs, all bound to a cube and a player with a "camera", I only have a bunch of points (the cubes) and a 4x4 matrix (the camera). How am I now able to compute the frustum culling on the CPU side?

The link you gave me is awesome! Thanks! smile.png

 

But what about the logical update aspect instead of just the rendering?

If I render only the objects within the previously calculated frustum, maybe I could update each objects logic?

Or is something like "update only objects within a specific radius outside of the frustum" a good approach?

Edited by N1ghtDr34m3r

Share this post


Link to post
Share on other sites

As Tessellator mentions you really should look into spatial subdivision in combination with frustum culling.  Things like BSP, quad, oct, kd - trees and bounding volume hierarchies (though not spatial subdivision also PVS) could be used to accelerate frustum culling.  ( https://en.wikipedia.org/wiki/Space_partitioning )  He also mentions occlusion culling this is important as well, look into software occlusion culling and predicate rendering (IIRC).  

 


But what about the logical update aspect instead of just the rendering?
If I render only the objects within the previously calculated frustum, maybe I could update each objects logic?
Or is something like "update only objects within a specific radius outside of the frustum" a good approach?

Yes LOD in regards to AI and current game relevance is also a good idea, radius is good and a second dimension is relevance to an active "plot".

Share this post


Link to post
Share on other sites


But what about the logical update aspect instead of just the rendering?

i only update everything at games speeds up to 128x accelerated time. above that speed, i simply model the effects of running the AI, but don't actually run it. and anything far enough from the player gets removed from the simulation entirely, so it never gets updated.

Share this post


Link to post
Share on other sites

I would recommend using a premade engine for something like an open world game.

 

Something like unreal engine 4 would do the job well as it already has industry proven LOD, frustrum culling, level streaming and open world systems built in (see their kite demo).

 

You could spend years writing all this yourself, and if you just want to get on writing the game and know the functionality needed works fine, going the premade route is a good idea.

 

If you do want to do it all yourself, good luck because creating it and making sure it scales well could take you a long time...

 

Good luck! 

Share this post


Link to post
Share on other sites


Something like unreal engine 4 would do the job well as it already has industry proven LOD

I have no real experience with unreal engine 4 so I was wondering exactly what you mean by this?  Does UE4 use some sort of dynamic LOD or is it still static but the method used to select LOD level is "robust"?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!