Hey guys,
I'll describe some of the things I'm coding to achieve proper traffic patterns, required by the procedural cities in my game 'Just Death' [ JustDeath.com ]. This won't talk about the gameplay, physics, rendering, or any other systems of the project.
The only input to my procedural city generation system is a set of splines. The input splines are imported into my engine via ( scalable vector graphics format ) .svg file.
I've spent about 3 months building this game, on my own custom engine, you can read about it in this thread where I've posted about 50 updates showing all the progress [ Radioactivesoftware.com ]. I'll be sure to post more updates here as well! The game is still in a PRE-ALPHA state :-)
Ok lets get started...
First off here are a few images of the procedural cities I've created without and kind of debug output...
The first thing I wanted to do, in order to determine what lanes can connect with eachother - was to differentiate the North/South and East/West roads from eachother. The determination of a lane's general direction can be done with a fabs(X), fabs(Z) compare, to determine the major axis (of the normalized forward vector on the road's spline at that point), after that making E/W & N/W depends how you've setup your game engine. You want to do all these calculations in absolute world space, not any kind of local or tangent space down the road's spline path.
Here is a debug output image just showing the N/S and E/W traffic patterns as different colors.
Here is an image of the final result... I'll describe it in more depth below.
For a breakdown of the image above, consider the following ruleset, which is coded into the "intersection traffic controllers" ( that's just what I call the state machine and associated data structures created to represent a group of traffic lights) in my game engine:
Color Key
---------------
North = WHITE
East = GREEN
South = RED
West = BLUE
Traffic Controller Rules
---------------
To Go Straight:
RED-> RED
BLUE->BLUE
GREEN->GREEN
WHITE->WHITE
To Turn Right:
RED->BLUE
BLUE->WHITE
WHITE->GREEN
GREEN->RED
To Turn Left:
WHITE->BLUE
GREEN->WHITE
RED->GREEN
BLUE->RED
The final steps are to animate the in-game entities. There are other AI systems I use for more active objects - but for meandering civilians and vehicles I feel this "rail" system will suffice, until they are disturbed by the players.
For more information please visit JustDeath.com
Thanks!
- Dan
RadioactiveSoftware.com
dgreen@radioactive-software.com
P.S. Here are some other cool screenshots...
How the traffic looks from above in the city...
Lead Sled tearing it up, directly controlled by the player/user ;-)
Vigilante1 running in the city.
The elevated train in the city.
View from the back lot of a car wash.
Wow, very ambitious of you to develop an open-world game like this without a billion dollars :)
It already looks quite impressive! I'm guessing you'll just be adding more building types over time?
If you could make this export back to, lets say, 3D Studio Max, you might have a nice spin-off product. There are quite a few city generators out there, and most of them are unbelievably overpriced, and also do not generate traffic lanes.
Hey,
Yes there are quite a few complex piece of city generation software on the market place, I did not see their price-tags but I can imagine they'd be expensive. I suppose I could export the city mesh to a .obj or some other easy-to-use format. If I exported only the high res meshes the city would be millions of triangles. I could export the lanes as well, .txt meta-data ?
Oh - also yeaaaa, I'll be adding more buildings as well, I can make them all on my own in a few hours each. There are about 13 building types in the screenshot above. I think 40-50 should create some very unique cities, where the user can hardly tell it repeats the buildings.
Thanks for the comment!
- Dan
nicely done
Thanks buddy. I appreciate your frequent comments and support!
- Dan
Hey there
Never heard about that project, and I must say it look really awsome! I browse your forum to see some other picture and wow can't wait to test that out man, I'm a total fan of procedural graphic.
I'm really curious about what engine you use? The graphic seem really decent!
Anyway can't wait to see what kind of game it will be in the end...I think you have something really cool in your hand...Keep up the good work and keep us informed
Thanks man, this is the first post I've made about 'Just Death' :-) I've mostly developed the tech shown here [ except the city stuff obviously ] while creating my current 'big' project, 'Killing Horizon' [ KillingHorizon.com ] - I've been coding that for about 2 years now.
The engine is hand made by me, I really enjoy that kind of thing. JD and KH both run on the same code/engine, the only real differences are the content loaded, it's great to finally have my tech abstracted to that degree.
Yea the graphics are decent like you said, I made this all happen w a DirectX9/Shader Model 3.0 renderer. The big benefit of this is having a high framerate for Virtual Reality HMDs [ Oculus Rift, Morpheus, etc. ], since stereoscopic rendering requires the scene to be drawn twice, the extra frame rates are good to have . I'm hitting 120FPS on a decent machine @ 1920x1080. The game runs great on the Oculus Rift DK1.
Thanks again for the comments and support, I will keep you updated!!
- Dan
Impressive, I'm tracking this ! :)
Thank you!