Page 1 of 5

It's all in your head, Part 12

Posted: Tue Dec 23, 2008 7:10 pm
by Chris
Subversion has had a tough ride during the latter half of 2008. During that time we shipped Multiwinia and we also did the Chronometer project, so time has been short. Work has still occurred on Subversion, but a lot of it is internal – difficult to demonstrate, and more concerned with the inner workings of the project than externally flashy stuff. So I don’t have a huge amount of cool new stuff to show, but this blog was never about showing the polished finished article – it’s about the development process of an Introversion game.

So, enough excuses, on with the update!

(xvid codec required)

The first half of the video shows the latest version of the Subversion city generator. It now operates in a very different (and much better) way. Once the road network has been finished, a new system takes over – which I’ve called the Geometry Generator. This system is responsible for running all the different procedural generation algorithms in turn as they are required, generating all of the data of the city and pushing it onto the graphics card in realtime before your eyes, starting with a road network and ending at the buildings and skyscrapers.


Some technical details for those interested: This system operates on a hierarchical data structure that represents all the 3d geometry in the world. It searches that data structure, looking for “stub” nodes that haven’t yet been generated. Lets say it finds a node of type “Park” with an outline, and nothing else. It then searches a database of generation rules, looking for anything that can help it generate a park node. Once it finds one it will run that generator and add more detail into the park – such as trees, a lake, a few paths, etc. Those objects then become new child nodes in the hierarchical data structure, and can be generated in more detail later if the rules exist and if you want that much detail. So you could write all the generation rules for Park/Lake/Path/IcecreamVendor/Swings/Slide/Bins etc, going into stupid levels of detail, and the GeometryGenerator would just take care of it for you. You can generate higher levels of detail for objects near the camera, and throw away unnecessary high detail a long way away. This system can be extended easily – if I decide that streets are suddenly vital to Subversion, I can write generators for Street, Road, Pavement etc and add more detail to those previously empty nodes – streetlamps, bins, chairs etc.


One thing I’ve found : you can generate data at an astonishing rate. This system can generate data at a max of around 10,000 polygons per second (its half that in the vid because fraps is very cpu hungry), but it’s not particularly optimised at the moment. In a couple of minutes this system can build a city with over a million polygons. The previous city generator from a year ago couldn’t do anything like this. Firstly I was using openGL display lists, which wouldn’t even be able to render 1M polygons at a decent frame rate, never mind have generation occurring at the same time. I’m now using Vertex Arrays, or Vertex Buffer Objects if your gfx hardware supports it, which are an order of magnitude faster at rendering. Secondly there was no way to update display lists dynamically, but I’ve now figured out a reliable way to update Vertex Arrays with new graphics data every frame, which is why you can now see the city growing in realtime before your eyes – that’s the Geometry Generator, pushing newly generated geometry onto the graphics card in realtime. And thirdly, I’ve made the whole generation system multi-core, freeing it up from the render loop and making good use of my dual-core cpu. All three of those breakthroughs have occurred in the last six months, making this system possible.


The second half of the video shows the work-in-progress generating the insides of buildings. Right now only three bits of detail exist : support columns, elevator shafts (empty), and stairwells. But crucially, and this is where the real magic has happened : the insides of the building now use the same Geometry Generator system as the city and the same data structures, meaning the whole thing has been unified. So instead of generating Parks and Streets and Buildings, we are now generating Floors and Windows and Stairwells, but the underlying system is the same. The transitions still need a lot of work – you would be forgiven for not believing me, but you can click on any building in the city view, and the Geometry Generator will spawn that building’s shell and generate all the data inside the building dynamically. The result is that the buildings all look like they are half-finished construction sites, with just the frameworks and shells of the buildings, and none of the office details. Obviously lots more to do here.


So that’s where things are at the end of 2008. You may be wondering, what happened to the elevators and the buttons and the lua scripts and stuff? Most of that material was moved out of the project while I integrated the Geometry Generator from it’s prototype into the main codebase, and things are still a little bit untidy, but they will be coming back next. I’ve got a clear first playable in my head now, although we are a long way off still, and simulation of the insides of the building is next on the list once I’ve got some basic geometry working. I’d also like to see the transitions from City to Site handled better – ideally I’d like the Site to appear in the city view, inside the buildings you just clicked on, but we’ll see – it may be too much of a render burden, but it would look pretty cool.


Posted: Tue Dec 23, 2008 7:21 pm
by Rkiver
It's rather impressive to say the least, especially how you have it all feed into itself for the generation of, well everything.

One question still remains. What the hell is it?

Re: It's all in your head, Part 12

Posted: Tue Dec 23, 2008 7:29 pm
by xyzyxx
Chris wrote:we also did the Chronometer project,
What? Was it finished? Scrapped? Are you releasing it soon? What?

Posted: Tue Dec 23, 2008 7:41 pm
by Ebola
Rkiver wrote:
One question still remains. What the hell is it?

What ever it is, it's damn pretty.

Posted: Tue Dec 23, 2008 7:46 pm
by Wandel
Rkiver wrote:One question still remains. What the hell is it?
I don't care, I want it. Now.

Posted: Tue Dec 23, 2008 7:58 pm
by Varsity
Confirmed: Subversion is not about streets!

Posted: Tue Dec 23, 2008 8:20 pm
by prophile
I really like the glow effect from all the lines there.

Posted: Tue Dec 23, 2008 8:21 pm
by Phelanpt

Posted: Tue Dec 23, 2008 8:24 pm
by Ace Rimmer
Did he say "playable"? :D

Posted: Tue Dec 23, 2008 8:46 pm
by martin
Most impressive. I'm wondering how moddable that geometry generator system will be? can we add our own scripts to generate sub geometry?

Posted: Tue Dec 23, 2008 8:50 pm
by WaywardG
Looks terrific. I only wish the people who made games that are all about building cities would put as much effort into being able to produce cities that are this organic, as opposed to the boring square blocks that always end up being most practical.

Posted: Tue Dec 23, 2008 8:52 pm
by faemir
Whatever it is it looks awesome :D

Also, what was the chronometer project?

Posted: Tue Dec 23, 2008 9:25 pm
by jelco

That looks sweet - oh, and the post itself is interesting as well. :)


Posted: Tue Dec 23, 2008 9:29 pm
by NukeLord
Oh wow, that looks bloody awesome, whatever it turns out to be. Good luck with future progress! :D

Posted: Tue Dec 23, 2008 9:58 pm
by Xocrates
faemir wrote:Also, what was the chronometer project?

It's another Introversion project about which we know even less than Subversion :P

Rkiver wrote:One question still remains. What the hell is it?

Since this thread needs more wild speculation, I'm going to say that it is in fact a Metagame. Therefore, and unbeknownst to us, the game was already released and these blog posts are a part of it.

Hence the title "It's all in your head"!