All posts tagged with "you have to use the gom jabbar on the programmer and stick them in the nerve induction box – “it only kills artists”"

Acceleration Structures

Clockwork Empires relies internally on a series of tags, as I think we’ve discussed on this blog far too many times. When you go to look for something like food, we check the game for every object with the “raw_food” tag, and then you go to eat it. Here is where the bad news happens: once you have a sufficiently long game, you can stockpile large quantities of food. Let us say that a player has 500 pieces of raw food. Let us also say you have 150 characters – so, to put it into perspective, the player has accumulated 3 days worth of food. (This isn’t even that large a number.) Every day, the 150 characters must go and eat 150 pieces of food out of the 500. The problem is – they want to eat the *closest* food. So now we have to check 500 pieces of food vs 150 players to see which piece is the closest, for a total of 150 * 500 = 75,000 distance queries. Well, that can be a bit slow, especially when our AI budget is very tight and we have a lot to do. However, we’re now seeing games where characters have huge amounts of food – 5,000 pieces of food, say – and the game slows to a crawl. Clearly, smarter programming is required.

A lovely sea-side desert colony sent in by a player as part of a bug report.

A lovely sea-side desert colony sent in by a player as part of a bug report.

Clockwork Empires stores all information about object positions in a spatial dictionary. The handling of tags is done by a “tag index” class, which is essentially a giant array of information consisting of the following attributes: “position, object, previous item with this tag, next item with this tag”. When a tag is set, we grab a tag index from a giant statically allocated pool of tag indices, so that we don’t have a memory allocation, and attach it to the linked list of tags. The problem is… there’s no way to easily find the “closest” tag to your point. What is needed is a spatial acceleration structure of some kind – a way of dividing the world into regions so that we can start in our region, check it for the closest whatever, and then move on.

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , ,
17 Comments

How Many Particles Can Dance On The Tooth Of A Sawblade

— Not nearly as many as can be emitted by a small oven, it turns out, due to what is probably a quirk of rendering that needs sorting out. More on that in a bit.

Nicholas has talked about particle system before in terms of technical development and something about the spelling of “aurochs” which, yes, we should all be on the same boat about now. This point established, the particle system has had some tools built and was turned over to the art team who, it seems, have a great deal of enthusiasm for making everything in the game sparkle, smoke, and on fire.

People are sleeping all over the floor of this carpentry shop because there aren't, in fact, any other houses in the settlement because this was set up for a screenshot. Thanks a lot, simulated people.

Sparking sawblades! (People are sleeping all over the floor of this carpentry shop because there aren’t, in fact, any other houses in the settlement because this is a Potemkin Workshop set up entirely for making a pretty screenshot. You can thank our character simulation for ruining the set-piece by making people sleep in the only existing shelter they could find.)

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , , , , ,
16 Comments