Hello again minions!
Apologies for my extended leave of absense. I’m going to blame the vitamin D deficiency, although it’s quite possible I’m just lazy.
I’ve been all over the place lately. Here’s a few of the things I’ve been working on, changing, designing, redesigning, staring blankly at or considering scrapping entirely in favor of something objectively more awesome…
The current content system is a lot better than nothing, but it’s still a pain when I’m trying to import assets in bulk. It stores assets like this:
That’s a seperate folder, asset file (in this case, png images) and a data.txt file for every single asset in the game. The game interprets that structure to automatically import the assets and get their stats from the text file, but it’s still a pain to set up the folders and files.
My current task is to rework it into much simpler system, which simply stores all the assets in the same folder and uses a single large ‘Stat Dictionary.txt’ file to provide values for every asset. This reduces adding assets from a 4 step process (create folder, create file, create data.txt, edit data.txt) to a 2 step one (create file, edit Stat Dictionary.txt)
I’m very nearly done with this, and will be returning to the nursary once I’m done here.
Common Species Names
I did some experiments with the idea of generating common names for species (as opposed to the existing faux-latin scientific names). I’m thinking the most immediately recognisable way to do it would be to have an adjective that describes some aspect of them, followed by a name: “rainbow lorikeet”, “eastern rosella”, “bottle-nose dolphin”, “spotted quoll”.
So I threw together a quick, half-hour library of adjectives and sounds (I literally just pulled apart the common names of a bunch of animals), dumped it into the same algorithm that generates the latin names, and this is the result:
Short furred Ralf
One or two bugs where I accidentally cut the syllables at the wrong point (“Snnn” and “Flgon”), but otherwise the rules I’m using for syllables work quite well. If I could just find a way to assign the adjectives logically, this could be quite a viable addition to the game.
In case you’re wondering about the rules:
– Syllable 1 must end with a vowel,
– Syllable 2 must begin and end with a consonant
– and Syllable 3 is often empty.
So the first one, “Dracadpo”, is “Dra-cad-po” (Dragon-cicada-kakapo). See how many other animal names you can spot!
And yes, I’m aware I’m using the word “syllable” wrong.
Progress is being made, but it’s slow. Some images:
Some of the mechanics are in place (you can add creatures to the nursary with the move tool, and the game registers them and their offspring as “player owned”), others are still in progress.
As I already mentioned on the forum, I’ve finally given in and started using downloaded, royalty-free assets rather than modelling my own.
This isn’t quite as lazy as it sounds: it takes quite a bit of effort to turn a wolf modeled by someone else into an evolvable head type. I need to download the model, cut off the head, remove the eyes and eye sockets, seal the gaps in the model, UV it to use the fur textures, UV it a few more times if it’s got geometry for mouth or horn textures, optimise or smooth it if the poly-count is way off the average, scatter fur polygons over it, and export it.
Oh, and then I need to repeat the process for a few intermediate types so wolfy faces don’t just appear out of nowhere…
You get the idea: it’s actually more work to bastardize a downloaded asset than simply to adjust the shape of an existing one and export it. But since I suck and can’t actually model (ability to screw with existing models notwithstanding), the downloaded assets more than make up for the extra effort in quality.
Improvements to discrete/mutation-mapped Head Types
Currently, the game stores Discrete genes (head types, limbs, body covering) as integers. They mutate rarely and when they do they provide big stat changes, in comparison to the floating point genes which mutate commonly in small ways and provide a continuous spectrum between points.
For a discrete mutation to evolve, it’s proponents have to actively outcompete and displace the existing population in order to take over: the entire population can’t simply evolve statistically through hundreds of tiny converging mutations the way floating point genes can.
Those familiar with evolution may actually recognise this: it’s a textbook example of the Hopeful Monster hypothesis vs Darwinian Gradualism.
And here in Species we have something genuinely remarkable: evidence that the hopeful monster method of evolution is highly inefficient.
The discrete genes do evolve and even seem to respond to natural selection a little, but they don’t do so nearly as fast or as efficiently as the continuous ones. Creatures are far more likely to optimise their limb sizes than they are to optimise their limb type despite the significant speed/stamina benefits a more developed limb type would provide.
But enough theory, how can I use this information to improve the game?
If I convert these discrete genes into continuous ones, they would be far more responsive to natural selection. The trick is finding a way to do that. Consider this mutation map:
As a discrete map it makes perfect sense: each node is represented by an integer. Each node might be a head type, or a body covering… any of the existing discrete genes.
As a continuous map, it doesn’t work.
It *nearly* works: it works for 0-1 (0.2 rounds to 0, 0.8 rounds to 1), and can be interpreted to work for 1-2, 1-3 and 1-4 (1.2, 2.2, and 3.2 all round to 1). But the moment you have more links than nodes in the map, it fails.
The solution, therefore, would be to not represent the nodes genetically at all. Decouple the actual node’s from the genes entirely. Instead, represent the *links*.
Mutations will be a bit more complicated under this system: usually they will just add or subtract a small random value, but when they pass a node the mutation map will have to decide which branch they’re moving to and adjust the value accordingly. For example, adding 0.2 to 0.9 could result in 1.1, or it could result in 2.1 or 3.1. In all these cases it will still reference the same node and look the same, but which branch it is on will affect it’s offspring and it’s future evolution.
So that’s the technical implementation, and it would work for natural selection, since the stats of each head type could be easily lerped for in-between states. But what about the visual side of things?
It would be easy enough to just round it to and display the closest head type/body covering. But there’s other possibilities here too, although I’m not completely sure how viable they are. Fading between body coverings is the obvious one (although I’m honestly not sure how much more complexity Shader Model 3.0 can handle on top of the skinned animations and fur shader), but an even more interesting one would be morph targets on the heads: moving the vertices of the head model to an in-between state resembling the model on the other end of the link. It wouldn’t be possible to make it perfect: there would still be noticeable pops when the model changed it’s UV’s and how many vertices it had, and implementing it would be asking for some weird visual glitches, but it would provide a much smoother and more interesting transition between head types.
All long term stuff, of course, but I’m feeling optimistic some of these at least stand a good chance of being implemented.
I doubled the world size.
Specifically, I doubled the default size of the tree’s and terrain in every dimension. That’s 4 times as much area and 8 times as much volume.
The creature’s, rovers and grass are all still the same size as before, but a size 1 world in 0.9.0 will cover four times the area of a size 1 world in 0.8.0, the 6 meter tall tree’s are now 12 meters tall, and the cliffs are twice as high.
This was a good move. The world is still pretty tiny by real-world standards, but it doesn’t look tiny anymore. It is now a lot easier to believe that baby Primum specium actually are their canonical 30 centimeters.
Of course, some things have had to be changed to support this…
Ground textures had to be re-sized to keep them from noticeably pixelating at double size. The tree’s are also noticeably low res, but I haven’t addressed them yet.
Gameplay-wise, I’ve doubled the creature speed modifier, meaning the reduced density of tree’s and creature’s shouldn’t overly impact survival. I’ve also increased the sight and hearing range modifiers, for similar reasons.
But anyone who has played the game with World Size 2 knows it had a few problems. Some of these were easy fixes: increasing the size of the tree’s as well meant I avoided any of the scaling issues the vegetation simulation had. Grass density was trickier, since grass is tied to the LOD grid, but still ultimately a simple matter of multiplying the amount of grass by 4.
But the most noticeable problem was those Out Of Memory exceptions you could generate by creating over-sized worlds.
I had already reduced their frequency for 0.8.0 by addressing the memory problems in the tree simulation, but they are still there. This is at least partly because, in the released versions, I’m offloading grass vertices for the entire map to VRAM at the start of the game.
That’s a lot of grass vertices: enough to cover the entire map in the highest density grass. Simply making them fade out when you’re not looking at them doesn’t remove them from memory. And this is VRAM, not RAM. Your graphics card generally has a lot less memory than your computer.
Of course, I didn’t implement it like this for no reason. Sending a large number of grass vertices from the CPU to the graphics card is a slow operation: continually doing it on the fly so we needed to only store the vertices around the camera would be prohibitively expensive and cost a few frames per second.
But, that wasn’t going to work for 4 times as much grass, so I had to come up with an entirely new way to render grass: one that didn’t require sending grass vertices to the GPU every frame, and didn’t take up more memory than we needed.
The new system looks almost identical, but it acts significantly differently. To start, we only generate enough grass for a small area in the north-western corner of the terrain. Then we send those vertices to the graphics card when the world is created.
Then, when the game is actually playing, the camera continually tells the grass shader where it is on the map and the shader translates the vertices horizontally to follow the camera around. So as you walk the map, you’re not seeing a unique set of grass billboards: you’re seeing the same square set tiled across the map, like a texture.
But translating horizontally would only work on a flat world: the grass still needs to actually appear at the height of the terrain. This is accomplished by handing the shader the terrain’s height-map itself, along with instructions to translate vertices vertically to meet the terrain.
Interestingly, this means the grass doesn’t *exactly* follow the terrain geometry anymore. The texture is interpreted by the shader by interpolating smoothly between pixels, while the geometry is subdivided into sharp triangles. If the terrain wasn’t smoothed, this could potentially be quite noticeable, but unsmoothed terrain would be ugly anyway so I consider that a small price to pay.
So, rather than costing CPU time, the cost of the new grass is more vertex shader work. It still has the potential to impact performance when you’re GPU-bound, but not by too much: I’ve lost 2 or 3 fps when playing the game with no creatures to get in the way. Since I expect most players are more interested in having a decent number of creatures wandering about, which puts the burden of work back on the CPU, I’m willing to accept this cost for now (there’s still plenty to optimise in the future, of course).
For those wondering how this affects the Facility Design: I’m implementing an above-ground nursary for 0.9.0. Indeed, that’s a big part of why I’ve increased the world size. Turns out an octagon of fences (a new style of fence, too) is far easier to implement than a method for rendering an underground base.
This will most likely serve as another placeholder, though: there’s still not enough room for any other facilities, and I want to provide room for the rovers, gene lab, museum and AI core. But for now, we only need a single facility: the nursary. A larger world provides enough room for that without subtracting too much space from the wilds.
The trojan has been removed, and a firewall has been put in place to prevent malware from making it’s way onto the site again.
A word of advice to fellow website owners: if your “website protection” software doesn’t explicitly say it includes a firewall, then it’s entirely a reactive scan and you’re not actually being protected from anything at all.
There’s a trojan malware on the site. Turns out the expensive software I bought thinking it protected it from that sort of thing… didn’t.
If you skip straight to the forums you’re most likely safe, but the homepage is infected. If you’ve visited it in the last few days, run a malware scan. (I recommend malwarebytes)
Rather than shutting it down and trying to deal with it myself (something I am not qualified for), I’ve paid for experts to do the cleanup and signed up for the extra software that *is* supposed to protect from this sort of thing.
All of the apologies!
The site should be safe again within the next day or two.
I’ve finished stage 1: the UI stat dictionary is no more. All data is now coming from a single, ridiculously complicated source.
I’m not kidding about the “ridiculously complicated” bit, either. Check out how many different stat classes there are, just to hold the various values associated with creatures alongside their descriptions, mutation rates, minimum/maximum, and mutation maps:
It works, though. Pretty much all the important stat data is now coming from the StatData definition class. This is a good thing.
Hmm… eh, why not. It’s possible some of my readers are almost as boring and nerdly as me, so…
Here’s a copy of the source code for the StatData class’s constructor.
In it’s current state, it includes the complete definition for all the stats, including the delegates that actually calculate quite a few higher-level stats. Things like speed, stamina and attack damage: the complete formula for them are all here.
It’s still functionally identical to what’s running in 0.8.0: some syntax and text changes, but nothing that actually changes how the simulation behaves. So you can compare it to the actual game, if you so desire.
The second stage is supposed to be softcoding the entire UI, but… well, that’s looking more complicated than initially expected.
See, rather than just hardcoding data for the UI, I’ve made quite a bit of use of C# abilities. So while some control definitions look nice and simple, like this…
startingWorldGroupBox.Position = new Vector2(0.05f, 0.36f);
… other control definitions are… less simple.
mainMenuGroupBox.Position = new Vector2(screenWidth / 2 - aspectRatio * 475 / 2, screenHeight / 2 - aspectRatio * 316 / 2);
I’m weighing my options.
I could import definitions as strings rather than numbers, with tokens like [SCREENWIDTH] being replaced by variables in the interpreter. I could try to replicate all this functionality with a data-driven system (using anchors, for example), rather than an algorithmic one. I could try to store these values as a node/variable in XML (I think that’s a thing you can do. Really not as familiar as I should be with XML).
… or I could just… not.
The investment is turning out to be larger than I’d originally planned, and although I’d still love to softcode the entire UI for modding purposes, is it really worth it if it takes a few months extra to do so?
The alternative is just doing a more general clean up on the whole thing, while keeping it contained in C# files. I’m really not sure if this is a better option or not.
Luckily, I’ve got another feature I’ve decided to play with while I decide what I’m going to do here, so I can at least postpone that decision while I consider it.
I know how much you all love dense technical jargon about boring-but-necessary coding tasks that don’t really advance the progress of the game, so here’s some. Of that.
Seriously, you might as well just skip this post, it’s gonna be dull. You were warned!
I’m currently finishing up a task that I started back in 0.6.1: unifying the UI Stat Dictionary with the Simulation Stat Dictionary. Until now, we’ve had two separate dictionaries: the UI one was handling things like describing and displaying stats (translating “47 attack damage” to “mostly harmless” or “-0.68 diet” to “herbivore”), as well as populating those horrifying stat dropdowns in the Rover settings. Meanwhile, the Simulation’s stat dictionary handles things like creating and determining stat values based on genes and environmental variables.
This isn’t a major deal, but it was enough to make keeping them synchronized annoying whenever I add a new stat, because I invariably forget to add it to one or the other and then have to deal with exceptions further down the track. I still don’t actually have a “Diet” or “Attack Damage” stat in the Simulation’s Stat Dictionary. The game’s been computing them on the fly.
So I’m killing the UI Stat Dictionary and transferring all of it’s functions to the Simulation one.
After that, I’m looking at ways to clean up the UIManager class. It has around 9000 lines of code, and is exactly as much of a mess as “9000 lines of code in one file” would imply.
Around a thousand of those lines belongs to the aforementioned UI stat dictionary.
Another 5000 or so of that is dedicated to simply defining the UI: the positions, types, starting values, ranges and so on of every 2D Control on every screen in the game. This is usually the sort of thing you’d build a tool to generate, but I typed each of those lines out by hand because I’m an idiot who thought once I had the simulation working, the UI would be easy. Afterall, it’s only 2D sprites! How hard can it be?
One of the major tasks for this update is to take all of that, drag it out into external files (probably either *.cfg, or *.xml, I haven’t decided which yet), and restructure the remaining code to read as elegantly as possible from those files.
I have some interesting idea’s for this as well, including separate dictionaries for each type of control (simply so I don’t have to cast the base class “Control” to “Label” or “ValueSpinner” or “ComboBox” or whatever the control actually is every. damn. time), as well as using either Unit Tests or a pre-compilation pass to detect typo’s in the string keys to make debugging easier.
And after those, I want to transfer the Simulation Stat Dictionary to external files. At first, this will just be data storage: text files for names, descriptions, and things like each individual stat’s mutation rate, maximum/minimum bounds, etc.
Further down the track, I’d also like to transfer the actual calculations for each stat into these files, in Lua format. This might require some reformatting, and probably some optimisation as well (it’s doubtful Lua could match the performance of native .Net code, so I may have to experiment with a hybrid system which only uses Lua for modded stats) but it would give modders a chance to read and play with with the fundamental calculations that define the simulation.
This would also require the long-overdue upgrade to something later than VS2008, so I could use .Net 4.0.
Not sure if this will happen for 0.9.0, but it’s on the table. I’ll keep you informed.
And after all (or at least some) of that is done, then we’ll get to move on to the fun stuff. :)
While I work on smaller items and gear up for the UI overhaul, let’s have a discussion about the design of the facility around the nursery.
The original and still-present concept is that the nursery is part of a larger facility, with several other buildings including a Gene Lab, a Natural History Museum and a Rover Garage. Unfortunately, this concept runs afoul of the first design issue:
The default (world size 1) species terrain map is 153.6 meters on a side (one terrain polygon is 30cm and there are 512 of them). On non-water maps the outer 10% on both sides are restricted, so that’s a maximum map size of around 120x120m. This is even further reduced on water maps (for now).
A good sized house-and-yard (in my local area) might be around 600m^2, or a square 24x24m.
Even if designed to be fairly compact, a realistically-scaled facility with room for expansion in the future is likely to dominate the landscape and make the wilds appear smaller in comparison, which isn’t what I was aiming for. Despite the microclimate elements, it was never my intention to aim for a pocket-world visual style. I would like Species to provide at least a moderate sense of scale.
One way to avoid this would be to provide an off-site facility. Then I could make it as large as I want, and provide as much room for expansion as I want, without affecting the wilds. This, however, falls afoul of the next design goal:
One thing I don’t want to do is stop the simulation when the player visits the facility. The wilds and the facility should exist in the same world, so that while the player is waiting for natural evolution in the wilds they can play with the tools in the facility, and vice versa with the artificial selection in the facility.
If the two environments are completely seperate however communicating this to the player is difficult. The way most games work, when you visit one gamestate, nothing happens in any other until you return to them.
Additionally, it reduces the sense that the wilds are, in fact, Wild. With the facility in the center of the map, it makes sense that the area around that is where the player would focus their effort and time. With an offsite facility, it raises the question of why the rovers are driving to this specific location to mess with the wildlife.
One way to solve both of these problems, plus those of scale, would be to locate the facility underground. But, of course, there is always another issue. This time, it’s…
A softer issue than the others, but still very important to me personally, is what tone the design of the facility sets. For Species, I’ve always planned to aim for something between “Jurassic Park” and “NASA”. It’s a game about science, about all the things that make science fun and awe-inspiring. An important element of the game’s theme is that it relentlessly portrays science in a positive light, even (perhaps especially) in cases where it would be contentious or morally ambiguous in reality.
Cloning? Yes. Gene Splicing? Hell yes. The science in the game might be naive or blind, it might cheerfully play god, create genetic abominations and even cause suffering and death on a massive scale, but it’s important the *game* doesn’t treat it as malicious or bad.
A remote underground base doesn’t quite fit that tone. Even the most benign and purely scientific of underground facilities, like CERN, doesn’t exactly evoke the same “science is awesome” tone that a building like the Kennedy Space Center does. There’s a reason (albeit an unfair one) CERN tends to used and abused more often in conspiracy theory fiction.
tl;dr: In fiction, science done in underground bases usually leans towards the Bad end of the Sliding Scale Of Good Science To Bad Science. That’s a trope I’d rather avoid bumping into in Species.
On the other hand, nothing is absolute. With the right lighting and architectural design, including skylights and vegetation, an underground base can be a lot less ominous and imposing. Which leads us to the…
Out of those three issues and options, there are design choices that can offset the impact of each. A compact aboveground facility combined with an increase in the default world size in future versions, could potentially work to reduce the scale issue.
Alternatively, enough animations and the presence of actual creatures in the nursery could reduce the feeling of ‘seperation’ between the wilds and an offsite facility.
The easiest approach to take, however, would probably be artistic. Deliberately design the underground facility with large spaces and good lighting to counter the tone it sets by being an underground facility. It may be a bit whimsical to think that the designers of the facility would build it that way rather than just building something on the surface, but the Species universe has always had a bit of whimsy in it, and I’ll try to provide hints as to why it was built like that.