Tuesday, 17 July 2012

Awesomenauts is coming to Steam!

Yesterday we have announced that Awesomenauts is coming to Steam! Woohoo! We have been working on it for quite a while already, so it will release really soon. There will even be a closed beta, which will start within a week. Exciting times! I am kind of surprised that I managed to write those optimisation blogposts in the past weeks at all, because we have been crunching like crazy to iron out all the bugs. In particular we spent a lot of time on getting the controls just right for PC, and personally I feel it plays great, so I hope the players in the beta will agree! Here's a trailer showing Coco and Derpl on PC:

Saturday, 14 July 2012

Optimisation lessons learned (part 2)

Last week I talked about some rather general things that I learned about CPU optimisation, when spending a lot of time improving the framerates of Awesomenauts, Swords & Soldiers, and even Proun. Today I would like to discuss some more practical examples of what kind of optimisations are to be expected.

Somehow I like talking about optimisation so much that I couldn't fit it all in today's blogpost, so topics around threading and timing will follow next week. Anyway, forward with today's "lessons learned"!

Giant improvements are possible (at first)

The key point of my previous blogpost was that you should not worry too much about optimisation early in the project. A fun side-effect of not caring about performance during 'normal' development, is that you are bound to waste a lot of framerate in really obvious ways. So once you fire up the profiler for the first time on a big project, there will always be a couple of huge issues that give giant framerate improvement with very little work.

For example, adding a memory manager to Swords & Soldiers instantly brought the framerate from 10fps to 60fps. That is an extreme example of course, and it only worked this strongly on the Wii (apparently the Wii's default memory manager is really slow compared to other platforms). Still, during the first optimisation rounds, there is bound to always be some low-hanging fruit, ready to be plucked.

The real challenge starts when all the easy optimisations have been done and you still need to find serious framerate improvements. The more you have already done, the more difficult it becomes to do more.

Big improvements are in structure, not in details

Before I actually optimised anything, I thought optimisation would be about the details. Faster math using SIMD instructions, preventing L2 cache misses, reducing instruction counts by doing things slightly smarter, those kinds of things. In practice, it turns out that there is much more to win by simply restructuring code.

A nice example of this, is looking for all the turrets in a list of 1,000 level objects. Originally it might make most sense to just iterate over the entire list and check which objects are turrets. However, when this turns out to be done so often that it reduces framerate, it is easy enough to make an extra list with only the turrets. Sometimes I need to check all level objects, so turrets are now in both lists, and when just the turrets are needed, the longer list doesn't need to be traversed any more. Optimisations like this are really simple to do and can have a massive impact on performance.

This is also a nice example of last week's rule that "Premature optimisation is the root of all evil": having the same object in two lists is more easy to break, for example by forgetting to remove the turret from the other list when it is destroyed. In fact, the rare bug with purple screens that sometimes happens in Awesomenauts on console recently turned out to be caused by exactly this! (Note that the situation was extremely timing specific: this only happened when host migration had happened just before a match was won.)

In my experience, it is quite rare to find optimisations that don't make code at least a little bit more complex and more difficult to maintain.

Platforms have wildly different performance characteristics

This is quite a funny one. I thought running the same game on different platforms would have roughly the same performance characteristics. However, this turned out to not be the case. I already mentioned that the default memory manager is way slower on the Wii than on any of the other platforms I worked with, making implementing my own memory manager more useful there than elsewhere. Similarly, the copying phase of my multi-threading structure (which I previously discussed here) takes a significant amount of time on the Playstation 3, but is hardly measurable when I run the exact same code on a PC.

So far I have seen that all the optimisations I have done have improved the framerate on different platforms with wildly differing amounts. They did always improve the performance on all platforms at least a bit, just not with the same amounts. So I think it is really important to try to always profile on the platform that actually has the worst performance problems, so that you can focus on the most important issues.

Truly low-level optimisations are horribly difficult

The final lesson that I would like to share today is actually a negative one, and cause for a little bit of shame on my side. I have tried at several occasions, but I have hardly ever been able to achieve measurable framerate improvements with low-level optimisations.

I have read a lot of articles and tutorials about this for various platforms. I tried all kinds of things. To avoid cache misses, I have tried using intrinsics to tell the CPU which memory I would need a little bit later. I have tried avoiding virtual function calls. I have tried several other similar low-level optimisations that are supposedly really useful, but somehow I have never been able to improve the framerate this way. The only measurable result I ever got this way was a 1% improvement by making a set of functions available for inlining (the Playstation 3 compiler does not have Whole Program Optimisation to do this automatically in more complex cases).

Of course, this definitely does not mean that low-level optimisations are impossible, it just means that I consider them a lot more complex to get results with. This also means that it is possible to make a larger project like Awesomenauts run well enough without any low-level optimisations.

We've got a big announcement coming up next week, and next weekend I will be back with the last part of my mini-series on optimisation. Stay tuned!

(Muhaha, are you curious what we are going to announce? Feel free to speculate in the comments!)

Friday, 6 July 2012

Optimisation lessons learned (part 1)

Optimisation is a very special art form, with lots of tricks and realisations that give it a place of its own in the programmers toolbox. Until I had to do it for the first time on Swords & Soldiers for the Wii, I had never done any optimisation. At university I had already learned a lot about time complexity (big O notation, like O(n)), but optimising an actual game with a big codebase is a different beast entirely. I was like a virgin that had never been seduced by a handsome profiler yet.

I just started fooling around with optimisations, reading tutorials and articles on Nintendo's dev website and the internet in general, and learning as I went along. Since no pro ever taught me how to optimise, I guess I might still be unaware of some really important tricks. Yet somehow I managed to get Swords & Soldiers from an initial 10fps to 100fps on the Wii (if VSync is turned off), and Awesomenauts from 10fps to 70fps on the Playstation 3.

In past five years I spent some six months in total on several kinds of optimisation. Quite a lot of that was on bandwidth optimisations, but also a lot on framerate and loading-times optimisations, so I have quite a bit of experience with it by now. There is a lot of interesting stuff to say about it, so in the coming weeks I would like to share the most important lessons that I learned. Today's concepts are rather general, next week I will share some more detailed pieces of (hopefully) 'wisdom'. ^_^

Don't make any assumptions
This is by far the most important one. When I want to optimise something, I always have a some ideas in my head about which parts of the game must be causing the low framerates. In practice, however, it turns out that I am hardly ever right. When I fire up a profiler and analyse where time is really spent, the big optimisations almost always turn out to be somewhere else than expected. This is still the case, even though in the past five years I have spent so much time full-time on optimisation (especially Awesomenauts was a really complex beast to tame), optimising code for Wii, PS3, Xbox360 and PC. So much experience, yet my expectations are still usually wrong.

So the rule I derive from this, is to never take any action based on assumptions. Always let go of your assumptions. Take real measurements and work from there. And once something has been changed, measure again to see whether it really works. As Dutch physics teachers often say: "Meten is weten" ("Measuring is knowing").

Profilers are awesome
Which brings me to the best part: profilers (measuring tools) are awesome! They give insane amounts of detail on all kinds of things. The core for me is the hierarchical view. This starts in your main() function and tells you it is using 100% of the time (oh really...). From there you can keep opening function calls in a tree-like form, to see in ever more detail where the time is spent. Beyond this, profilers have all kinds of nifty tools. If you ever want to do any optimisation, be sure to start by getting a proper profiler!



I have to say, though, that I have not been able to find a really good, affordable profiler for PC. Wii, PS3 and Xbox360 all have excellent profilers that only work on that platform, but on PC, most profilers I have seen are either incredibly expensive (like the one in Visual Studio Team Edition), or lack the concept of a "frame" and thus don't allow me to find framerate hickups. The best one for PC I have seen so far is Very Sleepy, even though it completely destroys the framerate while running and doesn't know what a frame is either. But Very Sleepy is easy to use and the hierarchical tree-view is really clear. So if anyone has any recommendations for a better profiler for optimising games that are written in C++, then please let me know!

Premature optimisation is the root of all evil
I already mentioned that you should not make any assumptions, and this also leads to another important point. "Premature optimisation is the root of all evil" is a quote from the famous computer scientist Donald Knuth, and it is all too true. Most optimisations make code more complex, more difficult to maintain and evolve, and more sensitive to bugs. Also, in practice, 99% of the code is completely irrelevant to performance. A couple of hotspots take up most of the CPU's time, and the rest just doesn't occur often enough to be relevant to optimise. So my conclusion is to not really care about performance and just write the cleanest, most readable code I can. Until the profiler says otherwise.



To give a simple example from C++: sometimes using a const char* is a lot faster than an std::string. However, the latter is so much safer to use, that I never use const char* until the profiler tells me I have a problem, and then I change it in that specific spot.

Modern consoles are ridiculously fast
When you look online for optimisation tips, or when you talk to hardened industry veterans, you will learn a lot of things that I dare claim are just not relevant any more. Consoles and PCs these days are so fast, that you can just waste performance on all kinds of things and still get a good framerate. Of course, I am not talking about the big games here: if you are working on the next Uncharted and need to squeeze every last bit of power out of the Playstation 3, then it probably becomes really important to look after every little performance detail, but in general: modern consoles are so fast that you can waste most of your processor time on inefficient code and still easily get a good framerate.

To give an example: a rule that some studios have is that dynamic allocations are forbidden. So calling new or malloc during gameplay is not allowed. Everything that is going to be used, must be allocated during loading, and then kept in pools for quick usage. This helps against memory fragmentation, but is also supposedly necessary to achieve a good framerate. I personally think this limits the code design way too much. It makes code more difficult to manage and extend during development, so I never do this. It turns out that even the Wii, supposedly the slowest of the current generation, can easily run 60fps with 100 characters walking around in Swords & Soldiers.

(Note that I did end up making my own memory manager to speed up allocations on the Wii, which I will discuss in a future blog post. But calling new tons of times each frame was not a problem in the end.)

My point here is not that everything is always possible, but I do think it is important to realise that unless you are making a triple-A console game, you should not worry about performance too much, definitely not early in development.



I personally find optimisation a lot of fun to do, so there is a lot more I would like to say about it. Next week I will be a bit more specific and follow this post up with some lessons that I learned about timing, threading, hiccups, and where the biggest performance improvements can be made.

Friday, 29 June 2012

A bad kind of competition

A short blogpost this time, with a small but valuable lesson that we learned at Ronimo a couple of years ago.

At some point we figured it would be wise to make two artists make designs for an important character, and then from all the designs they make choose the best. At first glance this looks like a really good idea: two people will come up with a much wider range of designs and the chances of reaching something really good are a lot higher than with one artist.

However, there is a gigantic downside as well: in a sense making this design becomes a competition, and one of the two artists will lose. This can be incredibly demotivating, especially if an artists 'loses' a couple of times in a row.

So we decided to not do this again, and just give a single character to a single artist to design. That artist makes a lot of different designs, everyone can give feedback and in the end we choose from his concepts. We can still have variation and something to choose, but whatever is chosen, it is always a design by the artist working on it, so he never 'loses'.

For this same reason, we also rarely move a task to someone else when a specific artist appears stuck on it. It is often better to struggle a bit, or to let it rest for a week or so, or to get help, then to give the entire topic to someone else and see him find something cool within a day. This feels too much like someone else did a better job, and we don't want that kind of competition in our office. Of course, if someone asks for the task to be moved, then that is totally okay.

I guess some people might excel under competition and stress, but in general, I feel it is a good idea to try to keep any form of 'winning' and 'losing' outside our development process.

(Except when playing games, in which case everything else must give way for the glorious purpose of pwning n00bs.)

Sunday, 24 June 2012

How to really involve a larger team in the creative process

At Ronimo we strongly believe in involving the entire team as much as possible in the creative process of game development. No matter whether someone is a lead, a developer or an intern, everyone's opinion is valuable. This is, however, an incredibly difficult thing to do. In the past months we had 16 people working in our office. That means sixteen different opinions, and even just understanding each of them is already incredibly difficult, especially when it comes to difficult-to-explain graphical concepts. Let alone if you want those 16 people to agree, or to least all feel like their voice has been heard and seriously weighed in.

There are two big problems involved in this, and this blogpost outlines a method that tries to work around both:
-A decision might be made without really taking everyone's opinion into account.
-The process might take endlessly, as everyone has a different opinion and we keep trying to find a middle ground.

So today I would like to talk about the way we do that at Ronimo for our art styles. Since we started on De Blob 6.5 years ago (when we were still in school) we have been in a series of larger game projects and in each project we have learned more about how this works best for us. To keep this blogpost focussed, I am only going to talk about art style development today.

Before I start out, let me first note that this is a very flexible process for us. We don't follow a step-by-step plan and we constantly adapt to what works in the current situation. This blogpost is just my analysis of how this practically pans out for us, and since I think it works quite well, I figured other creative teams might have a use for this information.

Step 0: Communicate visually
This is not really a step in itself, but more a general concept. Describing art styles in words is incredibly difficult and in practice always ends in everyone having a different vision in their minds. So we try to communicate visually as much as possible. We don't do art style meetings or brainstorms without a computer with internet at hand, so that references can always be shown and pointed at. Clear communication is key and visual concepts should be communicated visually.

Step 1: Collect inspiration
We usually already have a rough gameplay concept before we start on the art style, and that means that most people also already have some ideas about how the game should look. So we start by making a topic on our internal forum where everyone just posts inspirational images. Images can come from any source (movies, comics, art, concept art, other games), and may contain just a couple of interesting elements, or be relevant in their entirety. Since posting other people's images does not require any drawing skills, even programmers can easily propose styles here.

Step 2: Create concept art
Our forum topic will quickly contain several dozen images and ideas. From those our artists create a series of completely different designs, trying to take in all the ideas. This should result in wildly different images. The art team tries to also express the ideas that they personally don't like. Everyone's views ought to be represented here somewhere.


(Check this previous blogpost for bigger versions of these images.)

Step 2b: Forum feedback
While the art team is making concept art, they regularly post their results on our internal forum, and everyone can add suggestions for variations and changes.

Step 3: The big feedback meeting
Now that we have around 10 vastly different designs, we do a big meeting with the entire team, around a big screen that shows the images. Since this is a meeting with the entire team, it can easily take several hours. First the art team shows each image and gives some background info on what their ideas were with it. Then we do a round where everyone in turn gets to express their opinions and elect a couple of favourites. Our producer writes down the votes and at the end we discuss the results.

Letting everyone speak in turn here is very important for this meeting: an open discussion with 16 people always has some people constantly talking, and some others who never say anything. Giving everyone a turn gives more equal weight to different personalities.

Step 4: Iterate on the favourites
Usually the meeting has not resulted in a single image that everyone is happy with. So the art team takes the two or three favourites and makes variations on these, taking into account any feedback given during the meeting or on the forum (e.g. "How about style B, but with more colour and with that tough guy from style D"). Again, results are posted and discussed on our internal forum.

Step 5: Make a final choice
Now we do another meeting like in Step 3, only this time with the goal of in the end choosing the final style. First we discuss a bit, then we do a vote where everyone can elect his 2 favourites. The style with the most votes ends up in the game.


(Check this blogpost for more on why this style was cancelled in the end.)

Step 6: Make game!
The process is done and we have a style and theme! Woohoo! The art team can now start working on designing all the different characters, elements and levels in the game, and on trying to get the style working in our engine.

A key thing to understand here, is that this process involves a limited number of meetings with the entire team, and each meeting has a clear goal. Since we usually cannot reach a unanimous decision, voting is used to make sure we never end up without a conclusion. These limitations guard us from iterating endlessly based on all the different (and shifting!) opinions.

With sixteen people in the team, the end result will rarely be a unanimous decision. However, by involving everyone in the team, and by making the art team make designs that incorporate everyone's opinions (even the ones the art team does not actually like themselves) we have a process that really gives everyone a voice and gives even the weirdest ideas a change to flourish.

Sunday, 17 June 2012

The Epic Shoes Of Awesome Winning

I often talk to people about that good indie marketing requires doing all kinds of crazy stuff to get press to talk about your games. The good thing is that such "crazy stuff" usually is the same as just "awesome stuff". So even if a 'stunt' would fail and isn't written about that much, we still end up with awesome swag. I intend to some day write a couple of blogposts about marketing, but in the meanwhile I just can't wait to show the awesomeness I have for you today. I would like to present: The Shoes.

Yes, we have Awesomenauts shoes. Only one pair, but they are just insanely awesome, and custom-made by Kyozokicks. And here's the best part: we are giving them away to someone who likes Awesomenauts on Facebook or who follows RonimoGames on Twitter. So if you are not doing one of these things yet, then please do so now and get a chance at winning The Shoes Of Cool!

These shoes are even cooler than the custom Swords & Soldiers Move controllers we made two years ago. I realize I am saying a lot of "cool" and "awesome" and such here, but I just really love this kind of marketing! ^_^









Yellow shoelaces! YELLOW SHOELACES!

Sunday, 3 June 2012

What Awesomenauts almost looked like

Last week I showed the various styles that our art team concepted for Awesomenauts. But I kept the most important one for this week: the one we actually chose to make! The Purple Style. We chose this one and worked on it for several months! This is what it looked like:


click for high resolution

I still consider this image to be one of the pretties things to come out of Ronimo so far. So just imagine how bad I felt about letting this one go. It was the right choice, though: this purple style is extremely difficult to read. It looks great, but in which teams are those characters? How could we visualise what skills a characters is using, when the colour palette is so limited and the backgrounds so dense?

This style finally got cancelled when, while playing around with the gameplay, it turned out that Awesomenauts was going to be very chaotic. This chaos was part of the fun, but a chaotic game requires a lot of clarity in the art, which is just not possible in the Purple Style. So we switched to something that was inspired by the likes of Earthworm Jim and Ratchet & Clank.

Since we worked on the Purple Style for several months, lots of cool concept art was made for it. Our ideas for the setting were not very clear, but some keywords were "Shangri La" and "eastern".











When we started working on Awesomenauts, we were quite unhappy with Flash and wanted something else. Flash was too difficult to handle for anything but flat shading, and we wanted more details and gradients in our artwork this time. So the idea at first was to create 3D models and render those to textures. This turned out to be too much work, though, so when our former intern Marlies Barends showed us After Effects and how excellent it is for animating detailed 2D art, we switched to that for all our character animation.

However, in the meanwhile I had already been playing around a bit with how to get those 3D models to look good for a 2D game. A couple of years before that I had made a 3D model of Captain August (a webcomic by Roderick Leeuwenhart), so I added some basic animation to that and created a couple of cartoon materials in 3D Studio MAX to see whether that would work. It doesn't look as 2D as I wanted, but it does look quite interesting, I think:



I also tried dropping that guy in the 2D environment art that we had:



Of course, we didn't just work on the characters, but also on the environments. Since this would play in a forest, our art team wanted to add variation by using the entire height of the forest. So the top of the level would play on top of the trees, showing mountains in the distance, while the bottom of the level would play on the ground, between roots and small streams.







Finally, while looking through our concept art archive, I came across this one, which I had never even seen before! I really like the flowing lines here, so I'll end this post with this great piece of linework:



Next week, I'll explain what process we use at Ronimo to involve all 16 developers in choosing a visual style for our games. It is difficult to involve so many without grinding to a halt in endless discussions and brainstorms with way too many people, but I think by now we have found a pretty good process for this!