Category Archives: Xenos

How we screwed up

There’d been no new posts here for almost half a year already. This is mostly caused by the fact that writing about your failure is kinda hard. Still, I think I have to write this – I owe that to everyone who were interested in Xenos; and maybe this tale would prevent someone from making the same mistakes.

We stopped working on Xenos sometime in December. It was not a single decision we’ve made: rather, it just happened organically. Working less and less, diverting into side projects, saying things like “next week I’m gonna work on Xenos at last” – gradually, we just stopped making any progress whatsoever. It was disheartening to realise that; but at the same time, somewhat liberating.

In January, I did some full-time contract work. When that ended, I’ve “officially” pulled the plug on Xenos. We were spending a lot of effort, but not making any progress – so it made no sense to continue.

I’ve been thinking (obviously!) about what went wrong, and here’s what I’ve got. The turning point was my decision back in June to switch to a new, better and more detailed art style. I was overexcited then, seeing other people get interested in my game and offer help; and in this excitement did not think clearly. The problem was not the art itself (although even that did not live up to expectations). The problem was that more detailed art resulted in increased complexity across the board.

When I was first envisioning Xenos, I settled on a game that was just complex enough so that I could pull it off. A little more, and it would become impossible… new art added more than a little. Most of this added complexity happened because of tiles. Old version of Xenos was tile-based – all objects were placed on a strict grid. New art required objects with different sizes and rotations, so the grid had to go. With it, a lot of simplifying assumptions were gone: no more “only one object per tile”, no more easy pathfinding, etc. New art was also more detailed, requiring much more complicated physics. Suddenly, floors and walkways that were flush with the ground weren’t cutting it – I had to add elevation. This complicated the pathfinding even more, and animations… well, animations were a pain in the ass even without that. And so on, complication after complication arised.

All this stuff required a lot of coding. And a lot of arguments with artists – as they wanted the game to be prettier, while I was fighting to keep complexity low. The development was getting too slow – which is bad for motivation. And on the other hand – the new art was not good enough to inspire. I mean, it was technically better than my voxel creations. Way better, even. But, even compared to ugly voxels, it was plain and generic-looking. I had some talented artists working on different pieces, but no one to coordinate that work and ensure that all of these pieces form a stylish whole. This did not help motivation either.

To top it off, while struggling with all these problems, I’d lost my vision for the game. The mechanics that made sense in the old version had to be re-worked, and they, too, did not form any coherent whole. I finally decided to stop working on Xenos when I noticed this. You can possibly overcome all difficulties when you know what you’re doing; but without any vision, continuing just made no sense.

So, where does this leave us? I’m not yet ready to throw the towel on this “indie development” thing, even if my first project failed. We’ve spent some non-insignificant money on Xenos, but still have enough to continue (thanks to some contract work I’ve done lately). Notice that I’m using plural here: Chaos Cult Games now consists of two people working together, helped by some friends and contract workers from time to time. Xenos is not completely dead either. We’re not working on it right now, but we did a lot of work, and might well use it later. Xenos would have to change, if we ever return to it, but it is still possible.

In the meantime, we took part in a game jam, making a quick little game that some people loved. We’re not going to develop it further, but you can play it here: http://chaoscultgames.com/play-darwins-paradox/ This taught us some lessons about rapid development and prototyping, which we’re going to apply to our next project. We already have a prototype for a dungeon-crawl game, some ideas for a space sim, and more. We’re gonna settle on one of those (or maybe some completely new and wild idea!) soon. And once we do, you can expect to see a playable demo as fast as possible – that’s actually one of the lessons from games jam. So, see you then!

Animation woes

For the last two weeks, I started every day working on Xenos with the resolution: “Today, I’m going to finish working on robot animations and write a post about it!” As you can see, this didn’t work out exactly as planned.

robot_scout_close

Alien scout close-up

We got the first robot – we call it a “scout” – modeled and textured some time in september. However, animating it proved a really tough undertaking. At first, the animations just didn’t look right. It turns out that making robotic motions is hard, especially when the robot is not a giant multi-ton vaguely-humanoid mecha, as everyone is used to. Alien scouts in Xenos are relatively small and have thin legs; when animated they mostly looked like an insect of a little bird, not a mechanism. It took us a week of heated discussions and constant reworking to arrive at something nice (and even now I’m not entirely satisfied… maybe there’s something we’ve overlooked?) Add to this another problem that appeared as soon as I added first robot to the game: speed.

The player in Xenos should be able to move at a quite brisk pace: otherwise it’s just too frustrating to spend several second on crossing the road. Animation-wise, this translates to running, which is (probably) fine for humans, but robots are usually associated with slow, deliberate movements. (Yes, I’ve heard about Cheetah. But the thing is, its movements are not very robotic.) While we have a running animation for the scout, it’s not super-convincing.

When you have walk and run animations, next thing you want is blend them together, so that  the robot can move at any speed (between walk and run). Which brings me to the next problem: Mecanim. It’s a hyped addition to Unity game engine, that is supposed to greatly simplify setting up animations. Well, to put it short, it does not. I’ve had some problems with Mecanim before, but this time I’ve decided to really give it a chance… and after spending 3 days wrangling with the system, I am certain that it is horrible, broken and nearly unusable. Or, well, to be completely honest, it’s probably nice – provided you agree to do everything the Mecanim way. It is made with a very specific development process and architecture in mind, and does not really work otherwise… and, of course, Xenos does not adhere to Mecanim ideas.

After stripping the whole Mecanim nonsense and reimplementing blending with code, I finally had a working robot in-game… but that does not mean that work is finished! To be actually interesting, the robot has to do something besides walking around. I’m working on it right now: adding some AI to the robots and making them interact with the player.

This is how it should work, when it’s finished. First, I have an Alien Spawn System, that handles spawning and removing robots. The idea behind this is, I don’t want to simulate all the individual robots in the game world – there would be hundreds of them, and this has no immediate benefit. The player would probably never notice this, especially since all robots (of the same type) are exactly alike. But I still want to simulate alien activities on some level. So, the Spawn System is tasked with keeping track of general “danger level” of all places. Whenever a player is in a dangerous place (that is, almost all the time), the System spawns a number of robots depending on danger level, somewhere relatively close, but far enough to be off-screen.

The robots have an AI that causes them to approach the player. But not directly – I want the player to feel that robots don’t care about him at all, not that they’re all out to hunt him. So, the AI actually selects a target nearby the player – for example, the scout would select some environment object, approach it and play “scanning” animation. This would show that aliens really do some stuff here, and ensure that the player is actually around to see it.

After spending some time near player, the robot AI then selects some destination  far away, and goes there. The Spawn System checks all robots, and removes the ones that went far enough away from the game: the player is not there to see them, so they’re not needed.

Or that’s how it goes if the player does not interfere. If the robot sees the player, it becomes alerted: it stops and looks directly at the player. A couple of seconds later, if the player does not run away, the robot attacks. The idea behind this is to make robot’s intentions crystal clear: at first, it pays no heed to the player. Then, it becomes interested. Then, aggressive. The “alerted” state also gives a chance to run: robot’s shot are quite deadly and hard to dodge (or they will be, once I actually implement them properly.)

This system, however, requires adding more animations – scanning objects, turning around looking for the player, etc. Which is why I’m not showing videos just yet – there’s still a lot to do until it’s finished, even though every day it seems that we’re almost there.

To make up for this post’s lack of pictures, though, I can show a couple of screens of the environment. We’re slowly but surely adding more and more stuff to the city, and it’s starting to look nice. It’s way easier when stuff is not animated (-8

A robot takes a stroll in the park

A drugstore

Street corner with a billboard

Fuel station.

Fuel station.

Building a city

Let’s talk a bit about map generation in Xenos. I’ve started development of the game with making a procedural map generation system, and I’ve talked about it in the very first post. However, then we decided to change everything, and the old system had been summarily ripped out; replaced with a new, kinda-similar-but-not-quite one. So, how does Xenos create maps now?

I still have not solved it in general – current algorithm is heavily geared toward creating town maps. On the other hand, it’s simple and it works. As you may remember, maps in new Xenos are made of chunks, that are approximately 10×10 old tiles in size. A single chunk can contain a building or a length of road – i.e. open street. And a single “location” is 20×20 chunks – for now, this is the whole of Xenos, but in the future I’ll add more locations that connect seamlessly.

buildtown

Creating road grid

The generation of a location starts with a road grid. I used a very simple algorithm: imagine an empty 20×20 grid. Then, mark some rows of it as “road” – making horizontal and vertical lines 1-3 squares apart. You end up with a grid of streets and city blocks, but it looks much too regular. To break up regularity a bit, let’s simply remove some roads. First, going horizontally along every row, we randomly remove some roads between neighbouring blocks, in effect merging them. Then repeat the same, only going vertically along every column. As a result, you get a nice irregular pattern of streets.

There are a couple of gotchas to watch out for: first, we shouldn’t merge too many blocks in a row – we want to have enough roads for driving. This is easily accomplished by tweaking the probability of merge (larger block means smaller probability) Second, and more important, is to check for disjoint roads. Sometimes, when we remove a piece of road, the whole grid would be split into two unconnected parts, and we really don’t want that. Fortunately, that is pretty straightforward to check.

Once we have the road pattern, next step is to place actual streets. Again, a pretty straightforward algorithm goes over every chunk and select a matching piece of street – a straight road, a corner or an intersection.

Next we have a “special chunks” step. The idea behind it is, what if we want our map to have, e.g. one or two fuel stations, no more, no less? We might have a list of these “special” objects with respective counts. After streets are placed, the next step is going through this list and finding random places to fit objects. Some of these may take up more than one chunk – for example, our fuel station is 2×2, with 2 of those overlapping the street. Every special object has some code attached, that basically answers one question: “given the map generated so far, can this object be placed in point X?” In the above example – fuel station, that piece of code checks for a length of straight road to “attach” the station to.

Finally, when we have placed all special objects, the rest is filled with the most dumb algorithm imaginable – every chunk that is still empty is simply assigned a random object (well, not totally random, but random from the “applicable for town map” list).

And this is basically it – we have a town location that is random, more-or-less irregular (the grid of chunks is still apparent, of course, but it’s not bad in practice), and contains the stuff we want it to – but in unpredictable places. I think it’s pretty good for a game map.

Development video

Recently, while working on Xenos, we had an idea. What if we made a video of the development process? A lot of our work is not really exciting to watch: me typing code in Visual Studio is probably boring as hell. But some processes might be actually interesting.

So, today we present the Xenos dev video – first of many, I hope. This time it’s the process of making a single “chunk” of game map, containing a simple house. The house is not completely finished – it has no floor for example, and it could use more details – but the basic process is there.

The video also showcases some procedural capabilities: see how the house is built with a set of props, and then re-generated automatically with props changing and wallpapers having different color. In the end, the location generation process is shown, where the new house is automatically integrated into our town map. (The map is generated very slowly – that’s a property of Unity editor. In-game it works faster, although far from lightning-fast)

Watch and enjoy

Resurfacing

Hello everybody! Did you miss us?

This blog went without updates for an unusually  long time. You might’ve been thinking that Chaos Cult Games went belly-up and development stopped; however, nothing would be further from the truth. I’ve been busy with rewriting lots of foundational code basically from scratch, while my friends and partners were drawing, modeling texturing etc, preparing new content. All that to make Xenos look way nicer than before.

When I started working on Xenos, (that was almost a year ago. My god, it IS taking longer than planned!) the game world was made up of small tiles. And these tiles had little objects, modeled with all the art skill of an experienced programmer. It looked ugly, but it was workable. Today, when art is created by actual artists, this approach is both ugly and counterproductive; so I had to change everything.

example of a chunk

A single chunk in Unity editor

The new Xenos game world is made of chunks, that are around 100 times bigger that a tile was (i.e. a chunk is approximately 10×10 tiles area). Each chunk can have any number of objects inside, that can be arranged however we like – no grid of tiles is required. And, of course, the objects are not made with voxels anymore, but modeled traditionally with polygons and lots of detail (at least, more detail. We still have to deal with performance limitations). This new approach allows for much more interesting and varied environment, but it also brought lots of technical difficulties. The procedural map generation that worked on tile map, naturally, stopped working. I had to make some new algorithms and I’m still nowhere near the complexity and flexibility I had with tiles. Pathfinding on a tile map is really easy compared to tile-less environment. Again, I reworked it, but it’s no longer as robust as before. Algorithm  for loading part of map on-the-fly – to create seamless environment – works with new system, but is unacceptably slow (went from 200ms to several seconds.) I’ve yet to fix this, and for now Xenos is limited to a single location.

In addition to that, content development is much slower now. Where before I could just decide: “I need a new table for this house”, model said table in 10 minutes with voxels and add it to the game, now I have to ask an artist to create that table. Which takes maybe an hour of actual work, and the work does not start immediately. Of all people working on Xenos, I’m the only one without a full-time job, after all.

On the plus side, with more generic art requirements, we’ve been able to make use of ready-made assets in Asset Store. These help considerably.

Current status of Xenos development is this:

  • We have working chunk-based system, that supports most of game mechanics from current demo.
  • We have a number of assets to create a town location, kind of like the one in demo (but not enough)
  • We’re building different buildings and parts of environment for this location, but we don’t have nearly enough yet.
  • We have concept art for player character and alien robots, and it’s being turned into actual models right now.

So, I think we can wrap these things up and create a new demo version somewhere around october. While you’re waiting, be sure to check new screenshots and concept art on IndieDB!