I got a basic vehicle going tonight. It still needs some serious tweaking (as does everything with ODE), but it’s usable.

It’s quite difficult to drive at the moment, with a tendency to fall over at high speeds when cornering. While I understand this is correct with regard to the physics simulation, it’s a bit annoying. With that said, I do have some fairly sharp inclinations that I was trying to drive up. Perhaps that would happen in real life as well.

I’ll probably have to resort to some nasty hacks like applying a downward force to the wheels when they’re touching the ground, or something. Oh well, I’m not going for realism :P

I got physics working on my terrain mesh tonight!

I only have barrels at the moment, no vehicles. However, this is due to deficiencies in other parts of my server, not the physics module. Once I improve that (which shouldn’t take very long, it’s just annoying to do at 2am), I’ll finally have the jeep in this old pic working.

A few other notes

  • The barrels in those screenshots are actually being simulated as spheres, despite the red box outline. Yeah, I know. Spheres roll better, though :)
  • The very first barrel I created when the system was working well enough to let it go anywhere got some fairly serious speed (and air!), taking a good ~10min to come to rest. As the crow flies, it traveled 15.3km.
  • I should perhaps make the gravity stronger. I suspect this is not how barrels are supposed to act.
  • That old screenshot I linked above looks really primitive looking compared to the current system. And it’s only 10 days old!

I spent a long time fighting with ODE tonight. I think I’ve finally got a handle on it, but it’s too late at night to bother doing any more with it. So, in lieu of fancy physics stuff, enjoy some pictures of trees, placed with a slightly better algorithm than ‘the center of the terrain patch’. Those closeups of the tree really show how awful the model is, though :(

Hopefully I won’t run into too many more problems with ODE, and I’ll have vehicles soon :)

In the last few days I’ve been writing the beginnings of the Universe server. I’ve run into a few issues along the way, mostly to do with the physics engine I’m using. Typically when I’m setting up physics for a terrain, I simply make one big triangle mesh that covers the entire terrain – nice and simple, and it works fairly well. However, the internet informed me that ‘very large terrains’ took ~20 seconds to pre-calculate physics information, and used 100mb of RAM.

Their definition of ‘very large’ was 1024×1024. Assuming I use my standard resolution of 1unit == 1meter, I would have a terrain of about 500000×500000. While I didn’t try it, I predict it would end badly.

My idea currently is to create a small trimesh under every physics-enabled object, and move it around as needed, syncing to the heights of the various bits of ground. I haven’t got that far yet, but I am making a triangle mesh that I can drop things on and have them kinda work (hey, it’s harder than it sounds!).

I also tweaked the noise parameters a bit more. The terrain is a bit more interesting looking now.

Finally I added ‘cool-cam’. This is from an article I read a while back on TheDailyWTF, and I think it’s quite a neat idea. Basically it’s just an automated camera that hunts down interesting things and looks at them for a while. With any luck I can get it to run on the big display wall :)

I did some more work on the new texturing system today. It’s looking a bit better now – I modulate the height value of the terrain with some perlin noise, so you don’t get the nasty lines of textures along a certain altitude that you used to. People who actually go outdoors on a regular basis tell me that this is much more realistic looking.

I also have trees now. Yes, they look awful. No, they are not permanent – a nice L-systems-based procedural generation system is in the pipeline, and will be replacing them ASAP. The things that are in there now are models from Quake1, or something, and are about 10 triangles each. Fast to render though…

The current placeholder models are very good at one thing – giving the eye something to judge the sense of scale with. Hopefully this will quell the persistant ‘what a small world you have!’ comments :)

In the last couple days I’ve broken down and reassembled the texturing and height generation systems. It’s got some quite nice results, even in these early stages. I got rid of the old cartoony look, turned up the texture resolution, and added a bit of lighting.

Still needs a bit of work – the hard transitions between the textures needs to be modulated with some more noise, and the choice of textures themselves need careful attention. I’m quite pleased with the direction, though.

In addition to the new texturing, the new noise system has some nice features. Higher terrain is bumpier, and lower terrain is flatter. So, you get nice flat bits (comparitivly speaking) next to the water. And another level of high-frequency noise is added when you get close enough, meaning that the flat curves of the old system when you get to the 1m level are gone.

I enabled spherical planets this afternoon. For the record, the planet in the picture below is 1.5million square kilometers (500km x 500km x 6).

There’s a bunch of problems with them, though. Turns out I had a few things that relied on (0,1,0) being the ‘up’ vector for the terrain – which is fine if your terrain is flat, but not so good if it’s curved.

Another problem is making it look ‘good’ at every level from orbit to 1m. At the moment it looks fairly mediocre at every level. It’s also crying out for some decent atmospheric scattering – what’s shown in the picture is just a sphere with a cloud texture on it. I’m planning some much nicer stuff, but that’ll have to wait for another post.

It is damn cool being able to fly from ground level to space in one transition, though. I reckon in a couple weeks I’ll have something that does that and looks good doing so :)

I moved over some 3D-model-rendering code from an old engine of mine to the new system today. It seem to be working properly, although I currently only have some placeholder (ie: ugly, old, low-poly) models to use. I also put in a very quick blob-shadow effect.

Note that these models are pretty much to scale (ie: the person model is about 2 units high, and 1 unit wide). They’re tiny compared to the scale of the world :)

I started reading a rather length text on using L-systems to procedurally generate vegetation, but it looked too complicated for what was turning into quite a late night. So, as my third (!) set of screenshots for today, I threw together a quick fog effect in the terrain shader. It’s pretty basic, but I think it looks quite nice (if not very realistic).

I also hacked in some ’stars’ and made the background colour change from sky-blue to black depending on your altitude. Again, pretty basic, but it’s quite effective in motion.

Tomorrow I may look at L-systems and vegetation, hopefully making the terrain a little less barren.

As promised:

As a result of this, I went from 80fps to 150fps on the same scene (the island where the camera starts). Flying around with a bit of altitude gets >250fps easily, up from the ~150 I got previously. Not too shabby for a couple hours work :)