Sign in to follow this  

Level Design (trees, etc)

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

I am currently working on an outdoor fps. I have recently finished my GUI and want to continue to create the level format, but I'm unshure how to arrange the objects in my level. Since the FPS will be mostly outdoor, I need a big terrain, that is based on a heightmap. I have played with heightmapping and have created a clod terrain class, that renders the heightmap in patches. I think this is be best option for big terrains, however I am worried about performance. Since this is my first game, I don't know how big the heightmap can be, since the game not only needs to render it, but to perform collision tests with other objects. Apart from that, how should I arrange all other objects in my level? Should I create a tree like structure, that holds every object? Do you know some ways to render outdoor scenarios? Any hint or link would be helpful :)

Share this post


Link to post
Share on other sites
I use 256x256 heightmaps. They are a pretty good size but after working with what I believe you are calling clod heightmapping I think that 128x128 would be better because it is nice to have 4 heightmaps at once and stream the world data. That way it will be rendering the same amount of triangles as a 256x256.

Another performance booster would be to add a frustum checker so that you can only render stuff that will be seen. This can greatly impact performance of your engine.

As for objects in the world I use two meshes for each object. One of the meshes is the object that the program renders. The other mesh is the collision model. It is a low poly version of the real object. You can also make it so that only certain spots on your mesh have collision data. This is especially useful for trees with high canopies that will never be collided with your player. For collision you just use ray casting on each of the triangles in the collision mesh. Another thing that you can do to speed up your engine is putting bounding boxes around your collision meshesso that the collision detection only checks models that you are near by.

hth,
Stewart

Share this post


Link to post
Share on other sites
The recent Cry stuff uses mesh for all that non heightmappy type stuff, first impression is that they use voxels, but after carefull playback of one GDC video they talk about the mesh business.

Share this post


Link to post
Share on other sites
I've never read from voxel graphics, but after reading one article, it sounds... strange. I dont think this will help me very much, since I would need to completely rewrite my terrain. Beside from that, I still would need some mesh, that I could process to the physics engine, so that it could process all the collision thingy.
However, I do have some questions on abstraction for the level. I have some questions about the class hierarchy. How should I arrange my classes?
I would need one class, that loads the scenario from a file. The childs of this class care for the environment (daytime, sky), terrain, etc. I also need some classes, that will represent my meshes, a mesh manager, etc. I'm concerned about a big mess, when I add AI or something else to the game, that doesn't have much to do with the level itself. That way, I need to store pointers inside the AI classes, so they can change the position of their object and so on. Do you have a class hierarchy in mind, that doesn't mess up the code, that helps to keep the view on everything (I'm translating from german, I hope this expression also exists in english)?

Share this post


Link to post
Share on other sites
Hi shadowman, I find myself in your same position at the moment, trying to design the best way for how I will represent my game world.

I too want to have a heightmap for the terrain, I hope to be able to 'seamlessly' load cells like morrowind does. I can't really offer you much advice at the moment, but I will be watching this thread, as this is a topic I would very much like to discuss.

Share this post


Link to post
Share on other sites
After reading through some threads about a scenegraph, its most likely I will stick to them as well. Though I'm unshure how I should create a connection between the SG and the Rendering tree (octree/quadtree). Lets say, my SG contains such nodes: Root-->Terrain-->Vegetation and Root-->Player-->Gun, how should I then fill the quadtree with the nodes? Let's say, the SG calls something like Render() for each node. The node then determines it's position and fills itself into the correct position at the octree. Would this be a good approach? At the beginning, my SG will also render the objects, since I want to get the SG running, before I concentrate on the octree itself, but it would be good to know how you would handle this.

Just another thought: If a player would climp into a car, the SG then moves the player branch from the current node (maybe root) to the car node? Or should the SG be static, not moving any branches/nodes at all?

*edit*
Apart from that. Should I derrive controlling classes like Player or Car from the SGNodes? Or should the SGNodes contain void pointers to these classes? Since the classes Player or Car just represent the logical object, but not the mesh, its nessecary that every object is defined by one such class. That's why I would vote for the first approach. But since I've never dealt with scene graphs before (I recently finished my GUI tree, but it's not as sophisticated as a SG has to be, due tu 2D space and other simplifications), I may not know some critical points that would support the 2nd approach. Again, what is your oppinion on that?

Quote:
Original post by The_Frag_Man
Hi shadowman, I find myself in your same position at the moment, trying to design the best way for how I will represent my game world.

I too want to have a heightmap for the terrain, I hope to be able to 'seamlessly' load cells like morrowind does. I can't really offer you much advice at the moment, but I will be watching this thread, as this is a topic I would very much like to discuss.

Did you already come up with an idea, how to create a seemlessly loading world? I've never really thought about that problem, since this is my first game and I already have very high expectations for my game. Maybe you can PM me about your ideas? Maybe I'll integrate this as well, if I'm able to.

[Edited by - SiS-Shadowman on May 21, 2007 2:41:21 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by SiS-Shadowman I've never really thought about that problem, since this is my first game and I already have very high expectations for my game.


Everybody does. Start small, trust me.

You'll over-scope for every new game you try to start for a while, untill you learn your lesson. I think everyone goes through that. After the nth unfinished bug-ridden project.

Share this post


Link to post
Share on other sites
I think I'll just post my results so far.
I've created a base class called CSGNode (Scenegraph node) that has several base functions like: insert(CSGNode*), remove(CSGNode*). Upon desctruction, it will also delete all its children. All other classes like CNPC, CPlayer or all the Items are derived from this class. The Inventory or an equipment slot is also derived from CSGNode. When a player switches an item from the inventory to an equipped slot, the Item will also change it's parent etc...
I think this works pretty good, since the scenegraph now really "displays" the logical link between all objects in my game world. Plus, the scenegraph is perfect for saving the gamestate, since I only need to iterate through all children, saving the internal state of each member in a file. Saving&loading becomes much more easier.
But I have another issue (maybe it's not): If my Level is going to hold several thousand objects like trees, bushes, tables, npc's etc. How am I gonna render this stuff? I don't want to do a lot of Draw() calls, since this really knocks out performance. I've read about clipping hidden objects (is it called that way?) or occluded objects, but I have no experience with these things. Where should this be supposed to happen? Currently, for the sake of simplicity, the scenegraph also renders the scene, but I want to change that, when I know, how I can implement all this culling and the octree.

Share this post


Link to post
Share on other sites

This topic is 3850 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this