Archive for category Uncategorized

XNA 4.0 to Monogame

This was supposed to be easy!

Monogame is XNA, XNA is Monogame. They’re the same framework, implemented atop a different backend: XNA uses DirectX 9, Monogame uses OpenGL. That’s what they’d have you believe, anyway.

Oh yes. I know the truth now. I’ve seen through the looking glass. It’s a conspiracy, I tell you. They faked the moon landing, they tampered with the climate change data, and they really really want you to think upgrading games from XNA to Monogame is easy, for some presumably nefarious reason.

Silliness aside, my first attempt to get the game to compile to Monogame didn’t go so well. I downloaded the framework, created a project and started copying code and content files. Before long I ran up against my first issue: all the 3d models in Species use the FBX file format. The earliest version of the FBX format XNA supports is 2010. The earliest version of the FBX format Monogame supports is 2011.

Guess which version Species was using for all it’s 3D models. Go on. Guess.

So, I had to open all the 3D models and re-export them to a slightly later version of FBX. This was somewhat complicated by the fact that I’m a disorganized humppile who had never bothered keeping track of what settings I used to export each individual models. Some had animation, some used a different up-axis, and a lot of them referenced textures I could no longer find…

So let’s fast forward past that little adventure and just say that, after a week or so, I managed to get all the content re-exported.

Once I’d cleaned up that mess, I found a new one lurking behind it: shaders throwing null reference errors. It turns out the rules for shaders are a lot more strict in Monogame than they were in XNA: if I’m not using a shader parameter in the shader body, OpenGL optimizes it out of existence, and Monogame throws a fit when I try to set that parameter. So, I needed to perform a shader cleanup pass.

Finally, though, I got past those messes. The game compiled and ran. And that’s where this screenshot comes from…

But you know what? I don’t care that it looks like I’ve accidentally awoken Azathoth: it’s still a victory to get the game into a running state. Everything else is cleanup.

The first thing to address was the black terrain. Turns out, this stems from another difference in how OpenGL handles shaders. It won’t let me give shader parameters a default value in the shader code itself. So it’s not black because the graphics card is throwing a fit, as is usually the case: rather, it’s black simply because the light colour and direction haven’t been specified and are still null. Identifying this issue helped me fix not just the terrain, but a fair number of other graphical issues with the water and fog, and make the Monogame version somewhat recognizable as Species again.

Slightly more frustrating were the problems with instanced models. Those hideous black streaks across the screen are actually the Fence Posts on the concrete nursery fence (see how they intersect where the posts should be?). I still don’t know exactly what causes this, but I did (eventually) work out I can fix it by rebuilding my InstancedModel class from scratch and turning off the procedural fence geometry between the posts. That leaves me with no fence geometry, but I’m working on that.

Then, the creature problems. Their bodies are an even more chaotic mashup of parts than they were before, the legs don’t animate and stick out at odd angles (well, odd-er angles), and so on. I don’t mind if the creatures are eldritch horrors, but there should be at least some logic to their appearance.

I didn’t manage to get any screenshots of this, fortunately or unfortunately depending on how much you value your sanity.

Thankfully, these problems were mostly a mix of the ones before them, which is a good sign: if I’m only encountering problems I’ve already seen and know how to deal with, I’m on the home stretch. The lack of animation was an failure to export the animation when I was recreating the fbx files, the weird orientation was a result of Y/Z axis mixups, and there were a few shader and texture setting mixups to be dealt with.

And then, of course, there’s the grass. Turns out, rather than fixing the problem I encountered in XNA4.0, Monogame straight up doesn’t support what I’m trying to do.  No vertex texture lookups in GL’s Shader Model 3.0. So I’m going to have to completely rewrite the code responsible for drawing grass, or forgo it entirely for 0.11.0. I may end up taking an entirely new approach. Kind of hard to say at this point.

While there are still plentiful minor graphical errors (no grass, no fences, the lack of shadows and selection circles, those weird lines on the creature’s back, whatever’s going on with the water and skybox), the game is at least functional in Monogame now. In theory this version of the game is cross platform, though of course I have no means of testing it since I don’t own a Mac or Linux PC.


Unfortunately, this blog has now caught up with my progress: that last screenshot was taken from the development build on the same day I’m posting this. That being the case, I’ll probably have less development work to discuss next week. Fortunately, there’s lots of design work to discuss, so we can do that!

We have fun here,



XNA 3.1 to XNA 4.0

Well. This was an ordeal.

Going into detail about why I kept postponing upgrading from XNA 3.1 to XNA 4.0, and from XNA 4.0 to Monogame, would take a while. I had my reasons, ranging from annoyance with specific software versions (“Open Folder in File Explorer” should not be premium functionality, VS2010 Express!) to a strategic decision not to increase the scale and complexity of pushing out updates by supporting multiple platforms during the alpha stages, so simple awareness that it was probably going to take a while.

Regardless, going into this process I was optimistic. I was aware of breaking changes between XNA 3.1 and XNA 4.0, but I had a cheat sheet I’d found on the internet, and I wasn’t expecting any significant changes between the versions: just syntax and compilation errors.

So I got it into XNA 4.0 and just kept fixing all the errors that popped up until the game was compilable. There were a lot of these, but the good thing about compilation errors is that the text editor tells you where and are and why they’re a problem. So, eventually I managed to pass compilation.

And then had to keep fixing the exceptions that popped before the game loaded. This wasn’t unexpected, but slightly more annoying to deal with. Eventually, though, I actually managed to get into the main menu.

At which point I found this.

Yeah, that’s… less than promising. But maybe the in-game behaviour is still mostly worki- ha ha NOPE.


Turns out the XNA Team had made some pretty significant behavioural changes between 3.1 and 4.0, especially relating to how the framework renders… well, everything. And if I’d encountered this problem immediately, I might have switched gears and forgotten about cross-platform support for 0.11.0. But I’d already sunk two weeks into this, so I started seperating the issues and dealing with them one by one.

Some of these were easy to fix, like turning off Premultiplied Alpha on every texture and model, which fixed a lot of the blueness. Others were more complicated: I *still* haven’t fixed grass rendering, because XNA 4.0 only supports very specific texture formats in Vertex shaders technical blabbering and I’m vertex sampling 4 seperate textures using different formats that touch just about every other part of the game more technical blabbering including the FertTempTexture, which is tightly coupled to dozens of other systems and needs it’s format to have a minimum amount of fidelity in order to support subtle per-frame changes like those emitted by trees and climate devices so much doggamn technical blabbering.

Anyways, after significantly longer than expected, and a few brief forays into “what the hell, no seriously what I just I don’t even” territory…

New marketing strategy: everything looks like Minecraft. Kids like Minecraft, right?

…. I got it… let’s say “95% working” in XNA 4.0. Still no grass because shut up, that’s why, but just about everything else in the game working as it did previously. No signs of performance improvement from the new framework, unfortunately, but what the hey: we’re only halfway done, right? We’ve still got to move to Monogame to allow the game to run on platforms other than Windows.

At this point I decided to move on to the next step. I might still have to cut my losses yet, and who knows? Maybe the changes between XNA 4.0 and Monogame will fix some of the issues I’m having with the XNA 4.0 version-

Hello darkness, my old friend…



Not to worrry, though. I will see this though, come hell or high water. The sunk cost fallacy demands it!



Where to next – 0.11.0

Greetings minions, and congratulations on surviving the incomprehensible eldritch horrors and repeated global memory wipes of the last couple months. You’ll be happy to know I have big plans for the future, and even happier to know a small number of those plans are not convoluted schemes to take over the world.

Among those…


The next update will be something of a milestone, where Species moves away from our little rockpool on the shoreline of the internet and we attempt to put the game onto Steam. Steam is new territory for me, but Mike has experience with releasing games onto the platform, so I’m optimistic about our chances.

In the interests of full transparency: in the months leading up to the game’s launch, I’ll be taking Species 0.10.0 off the site so that everything can go through Steam. The steam release will mark the boundary between the Free Alpha and Paid Beta versions of Species ALRE, and the end of the free alpha versions. Everyone who pre-ordered the game will have steam keys sent to the email address they provided via paypal.


Don’t worry though, I’m not planning to move into the paid beta without making it worth your while! These are the major features planned for Species ALRE 0.11.0:




Underwater Ecosystems

Who wants to evolve creatures under the sea, perhaps in a residence resembling some type of tropical fruit?

  1. New underwater food sources. Kelp and Coral will provide essential food for species that choose to venture into the oceans. I’m also planning to introduce a new simulation mechanic: “shoals”. These clusters of small, indistinct creatures will be a valuable source of meat for carnivores, exploitable only by those creatures fast and maneuverable enough in the water to catch them.
  2. Swim physics. A creature in the water will move differently from how they move on land, based on their body parts and shape. Their buoyancy will also have an influence on whether they swim close to the surface or walk along the ocean floor.
  3. Oxygen. A gill/lung dichotomy will determine how well a creature takes in oxygen from their environment, which will in turn affect their stamina and speed. Simplistic creatures, like P. specium, will rely on an anaerobic metabolism that allows them to survive in both environments, but at a significant efficiency cost.
  4. Body parts to support these new mechanics! We’ll need a variety of fins, tails, legs, feet, and head types to properly support aquatic and amphibious animals.



Social Behaviours

It’s time for the species in Species to forgo their ardent individualism and start acting towards the greater good. The greater good.

  1. Co-operation. Creatures will call when beginning an action, notifying other creatures in their vicinity of their intentions. This will cause other creatures with high co-operation and similar unmet needs in their vicinity to join in, whether this be to hunt as a pack, graze as a herd, or huddle together for warmth as a… flock, I guess? Yeah, flock. Because penguins.
  2. Altruism. Creatures will also call when in need of help. Altruistic and/or closely related creatures whose other needs are met will be able to respond by feeding starving creatures or moving in to defend creatures that are under attack. And I guess huddling for the benefit of freezing creatures? Because penguins again.
  3. Aggression. Social behaviors go both ways. In real life, creatures fight over food, mating rights and territory. I don’t believe I have the infrastructure in place for the latter two behaviors yet, but I do think food fights could be implemented.



Cross Platform Support – Mac and Linux

How hard can it be?

  1. Moving up to Mac and Linux means upgrading the game’s framework to XNA 4.0, and from there to Monogame. This is an engine change that I sincerely hope will allow me to provide cross-platform support.
    • I’d best note here that I can’t actually promise Mac or Linux support for 0.11.0. While it’s a goal, and upgrading to Monogame is a major step in the right direction, I don’t know for certain that it’ll be functional by then.




Species 0.10.0 Released!

It’s here! Species 0.10.0, aka. the “Predator and Prey” update (because, among the other changes, I finally fixed the problems that made hunting an impossible survival strategy).





Initialise Predator and Prey: This option starts you off with a simple but mostly-functional two-species ecosystem to start your evolution from. Find it under the “Starting Creatures” dropdown on the New World page.

Temperature: click on any creature to see it’s internal and external temperature, relative to it’s ideal temperature. This will gradually change relative to their insulation, mass and warm-bloodedness.

Stamina: This shows up as a yellow bar underneath health (the green/red bar) and food (the blue bar). Doing stuff like sprinting and attacking will gradually exhaust creatures over time. This is tied intimately to the temperature simulation: an internal temperature that is too cold or hot reduces their maximum stamina and causes them to tire more quickly.

Litter Sizes and Pregnancy Length: About time we got to see some r/k-selection pressures. Species can now decide if they want to invest in individual children, or just spit out as many as they possibly can.

Multiselect: for all your bulk move, feed and murder requirements. Drag a box around the creatures you want to select and then click the tool buttons to use them on the selection.

Context Sensitive UI: Remember the Creature/Species/Ecosystem modes? Remember how awful they were? For the uninitiated, they were really awful. Just… so awful, you have no idea. But don’t worry, they’re dead now. They can’t hurt you anymore. Long live context sensitivity!

Better Water/Underwater Effects: They’re pretty! And possibly a hint about an upcoming feature. But mainly pretty!

Better Grazing: grazing creatures leave little ant trails behind them! This is super cool and also awesome.

Denser Forests: by default, that is. The changes to the vegetation system mean that creatures will find it a lot harder to kill off entire forests. Of course, you can still mess with the settings on the New World page if you want to encourage grazers.

Fruit: even the tall tree’s are edible to low-to-the-ground creatures now, once the fruit drops. Eating fruit doesn’t hurt the tree, which is part of the reason the forests are so much hardier now.

Bug fixes and minor improvements: Just a whole bunch of stuff. Fixed that bug that corrupted your save after a few hours when you made use of the Nursery. Added a really subtle particle system for seeds, changed the fire effects, added a camera icon on the sat map, consistant-ized the Temperature units, and made dozens of minor tweaks to the game’s balance and the creature’s AI. You get the idea. Lots of little things.


It’s a whole new world out there! I hope you like it.





Welcome to the Team: Mike

Good news everyone!


brainwashed convinced a minion colleague to help me show them, show them ALL!!! out.


Mike Stankiewicz, (Stankiem on the forums) is joining the team, and will be working with me to expand Species audience and help bring the game to Steam.


Wish him luck!

1 Comment

Species 0.10.0 Experimental

Check it out here:


Beware the bugs.




Leave a comment

Praedator and Litatio – Part 1

(Note: This post was written a significant amount of time ago, but I never got around to posting it. With 0.10.0’s release closing fast, I’m publishing some of the backlog…)


I’ve taken a break from the vegetation system and have been implementing the Initialise Predator and Prey option.


Meet Primum praedator and Primum litatio. (lit. First hunter and First victim)




Cue the arguments over whether Primum litatio is blue or green.


I’ve tried to keep them both as basic and as close to P. specium as possible, aside from the obvious colouring differences. This has led to a few problems, and some necessary changes.


Most notable of these has been finding a way to make them dedicated herbivores and carnivores in spite of the fact that they have the same head type. I couldn’t give them one of the more advanced head types because there are multiple herbivorous and carnivorous branches emitting from the P specium head, and I didn’t want to artificially force them down any particular branch.


So, creatures have a new (and probably long overdue) invisible gene in their torso called “Digestive System”. Both head type and digestive system will factor into the “diet” stat, allowing them to move towards carnivory or herbivory regardess of their head type. There are limits: a fully herbivorous head type can never reach dedicated carnivory, and vice versa. But the naturally omnivorous starter head can reach both.




I’m not sold on it yet: I actually want to divide both stats by 2 so the most you can get with only one of them is 0.5, but with the current implementation this would mean that Primum Praedator wouldn’t be a dedicated carnivore. But it’s getting there.


Another problem I wasn’t expecting, but which makes sense in hindsight, was interbreeding.




This isn’t really surprising. They’re just colour variants of P. specium with the digestive system change and a couple mental changes: Praedator is more aggressive (for obvious reasons), motivated (hunting being a high-risk high-reward behaviour, they tend to go for the biggest reward), and empathic (this prevents them from hunting members of their own species, or at least reduces the amount it happens).


To solve it, I introduced a number of small changes in other genes. Minor or invisible changes, wherever I could: tail curvature doesn’t mean much to creatures without tails, but it increases their genetic distance.


This wasn’t quite enough, so I also gave them eyes.



I would have preferred to let eyes evolve naturally, but I needed to keep them from interbreeding and the placeholder facial feature system is still quite volatile and doesn’t react consistently to natural selection. When I eventually overhaul it, I may revisit P. praedator and P. litatio.


The final change is to combat. To make hunting viable, attack damage has gone up and health pools have gone down. Praedator can currently kill Litatio in 1 punch.


Theoretically Litatio could do the same to Praedator, but they’re non-aggressive and an attacking Praedator doesn’t give them the chance to fight back. Short version: a P. specium’s attack damage currently exceeds its health.


I’ll probably reduce this to two hits before release.


So far, it’s been a partial success. Praedator is engaging in recognisable hunting behaviour, and even surviving to reproduce… for a little while. Their population is not stable, though, and they slowly die out over the course of a few generations.


Litatio, meanwhile, aren’t engaging in any prey behaviours (ie. fleeing) yet and I’m not sure why: they have eyes and a cowardly demeanor, so they should be. It may be a bug: I’ll have to look into it. Regardless, it’s not slowing them down any: they’re like P. specium on steroids, vacuuming up food and reproducing at a terrifying rate. Herbivory maaaaay be a slightly overpowered strategy right now.


Some improvements could be made: reducing the number of times they scan the envionment and ‘make decisions’ would speed them up a little (for instance, eating your prey after killing it shouldn’t require them to make a new decision), and maybe reducing the energy cost of running. Creatures run faster while hunting, but it costs more per meter than walking, and is somewhat redundant when you’re chasing down a recoloured P. specium that hasn’t even noticed you’re there.




1 Comment