Game Development Community

dev|Pro Game Development Curriculum

Procedural Terrain networked

by Bill Vee · 10/28/2012 (12:03 pm) · 11 comments

I really wish I had more time to work on this.
After a couple of hours of work on this today I got most of the network code for the terrain done.

I also have the terrain data saving to a compressed zip file on the fly on both the client and server.
This allows the client to receive terrain updates and save them for later retrieval even if it is not displaying the current chunk that was updated. To save bandwidth only small updates like in the video are sent to all connected clients. When the client loads new chunks it sends the clients current position on the terrain and the server determines if the data for each chunk is a procedural based chunk or a chunk that has been altered since it was first loaded. If it finds a chunk that has been altered it sends a CRC for that chunk to the client. The client then checks it with the CRC it has for that chunk and if it it matches it means that it has been updated already, if it doesn't match it sends a request to the server for that chunk and updates it when the server gets around to sending it.

Right now I am using the lurker gun and grenade launcher to test the "editing" of the terrain.
When I get around to it I will add a proper tool object to use.

I still have some issues to fix. For some reason the server is processing chunks that have already been processed.

Also I used Fraps to record the video and every time I start a recording I loose about 10 frames.
When I am not recording I get a solid 30+ frames with no frame dips.



#1
10/28/2012 (12:26 pm)
Awesome work Bill!
#2
10/28/2012 (1:22 pm)
Bill,

I love this but, I am concerned with the FPS. I know FRAPS hogs a few but, I am seeing some major dips and I don't think they are just FRAPS related. It would be nice to know your hardware set up. At any rate, I am seeing them bounce back after the 'editing' is done. This leads me to think you have created a top notch tool.

I am assuming you have not gone through with any optimizations yet? Still that is some impressive stuff. With a real editor, it would be amazing! Keep up the good work.

Ron
#3
10/28/2012 (1:35 pm)
Yes Bill I agree nice looking stuff. Will most definitely be follow this!
#4
10/28/2012 (2:05 pm)
@Ron - The frame dips are related to the issue I mentioned.
I have a function that keeps track of the chunks that need to be processed for creation and it is not behaving as intended. In theory when there is only one player on the map the number of chunks that are in the list to be processed should be the same for the client and server.
For some reason on the server it is adding a large number chunks that have been previously marked as empty and reprocessing them.
When the voxelstoprocess count gets above 3000 or so the frames take a hit because one of the things the function is doing is sorting them based on distance from camera. It's not all Fraps fault for the frame drop but when recording it causes , for some reason, the voxelstoprocess count to be 4 to 5 times higher on the server. The function in question is suppose to throttle how many chunks it adds to avoid this situation. I will review it to figure at whats going on when I get more free time.

As for my specs here they are straight from the console.log
Attempting to create GFX device: NVIDIA GeForce 310M (D3D9)
Device created, setting adapter and enumerating modes
Cur. D3DDevice ref count=1
Pix version detected: 3.000000
Vert version detected: 3.000000
Maximum number of simultaneous samplers: 16
Number of simultaneous render targets: 4
Hardware occlusion query detected: Yes
Using Direct3D9Ex: No
WMIVideoInfo: DxDiag initialized
Initializing GFXCardProfiler (D3D9)
o Chipset : 'GeForce 310M'
o Card : 'GeForce 310M '
o Version : '8.17.0012.9610'
- Scanning card capabilities...
GFXCardProfiler (D3D9) - Setting capability 'autoMipMapLevel' to 1.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureWidth' to 8192.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureHeight' to 8192.
GFXCardProfiler (D3D9) - Setting capability 'maxTextureSize' to 8192.
GFXCardProfiler (D3D9) - Setting capability 'lerpDetailBlend' to 1.
GFXCardProfiler (D3D9) - Setting capability 'fourStageDetailBlend' to 1.


It is my laptop which is a i7 core with 4 gigs of ram running Win7.
#5
10/28/2012 (2:12 pm)
This is very cool, i like it! Just to bad, that the terrain can't have holes like a cave. Otherwise this could be used for for games where you can make caves like miners.
#6
10/28/2012 (4:05 pm)
Bill,

Thanks for the specs, and my comment was not a criticism as much as a concern. I really want to see this work for the T3D community because I think it is an important step to bringing T3D up to date. Thanks for the info and I totally get it, FRAPS is handy but not always the right answer.

Thanks for the info and I hope you keep rolling with this, it's a great feature and I would love for it to become standard once you get it where you are happy with it. Maybe add it to the MIT Master? Your call of course.

Ron
#7
10/28/2012 (8:48 pm)
Nice work man.

I would love to get the current code of this to check it out.
#8
10/29/2012 (5:07 am)
That is some impressive toolage there, Bill. I'd love to play around with this. Also, damn all you procedural guys... you'll put me out of a job!
#9
10/29/2012 (9:40 am)
"damn all you procedural guys... you'll put me out of a job! "

no and never.
static and procedural both have their own area.
it largely depends on what type of game.
future mmo will probably go for procedural environment generation.
but story based game will always use manual terrain generation(i think)
#10
10/29/2012 (11:10 am)
I could see the sandbox (modify the environment) MMORPG crowd going nuts over networked dynamic terrain.
#11
11/03/2012 (2:10 pm)
Interesting just a few questions. How is the over all preformance compared to C4 game engine. I know a few reviews have it a being painfully slow to load and render.

I'm also interested in your terrain paging and plant paging code.

1 would you be willing to sell this as an add on ?

2 would you be able to page all manors of objects from static to dynamic ?