Major sci-fi racing game project

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Hello guys, this will be the first in a series of blog style posts detailing in game features and progress.

Current Features:

Display List acclerated uniform tree:

We all know that irrlicht is slow with scenes with large geometry. Since high polygon counts are needed for tracks in this game a more effcient method of tranfering data from the cpu to the gpu was required, static data such as a track does not need to be sent every frame and since the test tracks can reach upto 50 000 polygons; sending this much data every frame can quickly bottle neck the game. The solution to this problem is either Display lists or VBO's where data is cached from the cpu onto certain high speed memories of the gpu at certain busy times so the transfer time is "masked".

Display lists were used in the game because of their low requirements and free optimisation, data is optimised on compile so things like cache alignement are no longer a problem. Our tests in a transform limited case gave us > than double frame rate increase using display lists, the benfit also increased at a smaller size after rendering sevral meshes since render display lists uses less calls. Another advantage of display lists is that the data is 100% stored on the gpu, so after compilation we simply delete the mesh data resulting in a saving of around 2 - 3 megs of ram per track.

Enter the second problem realted to tracks, octrees. Octree generation was very slow, so slow that it took around 2-3 minutes per track on a Athlon 2600xp. Also the octree resulted in alot of uneeded view culling tests, since the nature of the track geometry is very dense but has high visiblity (dense but not compact, oxymoron hehe). Thew new octree generator takes around 800ms on the same cpu including mesh loading and display list compile time (out of my hands in regards to optimisation).

Image

Camera system:
The Camaera system is a camera that follows the ship (3rd person view), the camaera is flexible and responds realistically to the ship movements.
The camera system is based on a mass class made for this project, it works by using a spring system to fix the camera to a certain relative position to the ship, diffrent combinations of springs cause the camera to behave diffrently, now we have two camera modes:

-gameplay mode ( a camera which follows the ship in a dyanamic manner)
-Cutscene mode, where the camera does a small cinematic, directed automatically by setting the camera position and a spring setup.

here is an example of a spring setup (dashed lines = springs)
Image

Physics and entity system:

For High speed collision detection we used bullet for speed and stability reasons. The track is loaded as a tree'd trimesh while the ships are convex hulls. Convex hulls generated directly from ship models cast too many colldetect rays and also proved to be unstable gameplay wise, so we modelled collision meshes for each ship and used that as a shape for the hull generator. We also have a compound mesh exporting and loading pipeline for blender but these compound meshes seem buggy and dont work on all cpu's.

WIP:

Water simulation:
I am currently coding a simple plane water simulation for a secret gameplay mechanic (not eyecandy :wink: ), its not finished yet but here ar a few tips i can give.

Most softbody simulations use springs as a way to simulate the physics of these bodies
(>www.gamasutra.com/features/gdcarchive/2 ... Mathew.ppt<); using lots of rigid particles interconnected with springs. Even though spring physics is very simple applying it to many vertices each vertex being connected by 8 springs (for a grid) the expensive distance calculations accumulate making it slow. Also using a spring system for water is wrong due to two things:

- Water waves are tranverse waves, this means particles transmitting the waves only ocscilate 90 deg to the wave direction of travel. This means water particles in a flat plane should only vary their y axis position. A spring system will move the particles in all directions if any particle is moved on any axis meaning any rounding/displacement errors will eventually cause slight wobbling in a non water like fashion. Computing the values for all three x,y and z coords is a waste since physicaly correct water will only need the y coord values.

- is slow due to many square root operations.

So how do we get away from using 3d springs and expensive square roots? Well after playing with some numbers in excel i made the following graphs, if the spacing between each particle is small, the distance between the two particles is almost = to the real distance computed by the square root and full 3 coord calculation; this means we must simulate lots of particles at a high density for the simulation to work, but since the y displacement is now = real spring distance we have allot less calculations to do which makes using more particles feasible.

Image
black circles are water particlesm dx and dy are distances.

Image
red line = fast method, blue line is true values

lots and lots of shaders

:D


I hope you enjoyed reading this, and it has sparked intrest into the project (that means join the project if you want =p)

and here is some pretty art to allieviate the symptoms of reading horrible text.

Image
Image
Image
Image
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

Superb mate. You are pr0.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Whoa, when did you get the texturing on the map done.

Hey maybe we should set up a seperate dev blog somewhere?
GameDude
Posts: 498
Joined: Thu May 24, 2007 12:24 am

Post by GameDude »

That's some nice work. Is there a site or anything for this project?
wildrj
Posts: 301
Joined: Thu Mar 23, 2006 12:49 am
Location: Texas/ Cyberspace
Contact:

Post by wildrj »

currently its only a private forum for members....but im thinking about buying a domain and setting up a site for it .so look for it soon.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Ok I have integrated my own method of shadows into this project. For this I had to convert the shaders to GLSL, but this gave me the added benefit of using a large RTT.

And offcourse the screenshot,

Image

Here I am using a 1024x1024 shadow map (yay opengl fbo...) with 4 sample filtering.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Any code snippets which will be available for inclusion into the Irrlicht core? Some parts sound really interesting for a larger audience.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

I dont mind integrating shadow map functionality into irrlicht. Maybe I will grab the SVN and submit a quick patch when I have time...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, that's one example. Many people are waiting for your wrapper :D
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

The problem is there is always new features to add and now I want to convert the whole thing to GLSL and this will take a while also. I don't know when to stop improving it and release something :?
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

If its going to be in irrlicht then you need to recode all the fixed function materials in shader code, unless you use an extra geometry pass, i reccomend just making it an easy to use class, people who use it can adjust it to their needs.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

2nd post:

Track rendering:

As we have discussed before the tracks are very highpoly, the display lists yielded good framerates, however the vertex trasnform rate was our bottleneck, to make things worse we had to render the track twice for shadow maps so our framerate dropped quickly. The problem was definitely how much our cards could transform since there was no cpu -to gpu transfers.

To reduce the number of transform vertices we used two aspects of current gpus:

-Triangle strip rendering
-Post tnl Cache

Triangle strips allow triangles to be defined by using one new vertex only. But to understand how that causes the speed increase we must look to the squence of events inside the gpu:

-cpu sends vertices

-vertices are transformed into clip space (screen coordinates)
either through normal fixed function pipeline or through vertex shaders

-Primitives are assembled
this is where the gpu "joins the dots" to to define where to draw fragments(colours of a certain part of a primitive).

-Fragment drawing
this is when the gpu colours in the areas inside the primitives, this is governed by pixel shaders or fixed function pipeline.

-framebuffer oprations, here overlapping fragments are compared and have operations performed on them before the scene is displayed

So how is this sequence useful to know? It tells us that the vertex transform process transforms all vertices then they are filled all together. The gpu doesnt transform the vertices of a single traingle then colours it in, it does all the transform for the scene then all the colouring in. So if the gpu can rember the vertices it transformed it can skip redoing the transform again hence reducing the transform cost for the same amount of triangles by upto a third.

The vertices are rembered in a post tnl cache, optimising the geometery to the size of the cache can yield additional speed increases so we used a free runtime tristripper before display list compilation.

Before stripping common or "double vertices must be removed and indices remade, this is done during loading using hashes. Both vertex positions and texcoords are hashed to make double vertex removal fast.

Physics:

Sliding box/concave shap physics proved to be unstable so we utilised the ray car model with som modifications. We used a extra downward ray to read the track. The track reader adjusts the gravity vector and angular velocities depending on the track nnormal to keep the car stable in crazy situations; we are not aiming for realism.

Water simulation:
The water simulation is now running and fast. It is fast because each vertex's lookup indices are precomputed, so the vertex already knows where it should sample neighbouring displacements. The water system is using euler integration not verlet, this means it has to be viscous otherwise it explodes.

General testing:
To make testing and tweaking faster we used a console with debug commands and a key configuration system that is loaded from textfile, this allowed us to test many things using one compile and load time.

We really need a programmer or two, ONES that meet the programmer criteria. Im not asking for commitment just a contribution.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Postprocessor:

The postprocessor system in the game is going to include:

-Bloom
-Depth of field
-Simple Atmospheric scattering
-Radial blur during boosts
-Dynamic exposure

Here are some screens, i havent finished the dynamic exposure or the scattering yet when i do i will share the theory behind these postprocessors.

Image

Image

too much bloom :twisted: , ill get rid of that using dynamic exposure.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

That looks great, I see some DOF, and a heck load of bloom lol...

Hey I uploaded the projective shadows to the svn. Make sure to get the new shaders from the media directory! And also the new cpp files (GamePlayState and shadowWrapper). I am seeing an fps increase from 50 to 90 with lots of room for improvement (Alot of the depth stuff is still there so I gotta strip it).

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Looks the artists have dissapeared like their website, anyway its was fun working with Blindside for a bit.

lets end this in a fun way.

Image

Pretty similar to the screenshots ehhh?
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
Post Reply