September 3, 2019

Book review: Babylon's Ark

0 comments
I clearly remember the 2003 Iraq War. The reason is that I did my military service at the same time as when US invaded Iraq and there was chatter that the Swedish army would extend the length of our military service because of a higher security risk. Now Sweden is far away from Iraq, so perhaps someone thought that Russia would use the opportunity when many US forces were in Iraq to cause trouble in Europe. Luckily, that didn't happen and the invasion of Iraq ended after a few weeks. But people would for many years still be dying in Iraq because not everyone thought the war had ended.

Fast forward a few years to when I was listening to a radio show where Malik Bendjelloul, a Swedish documentary maker, talked about his life. You can read a translation of it in English here. In it, he talked about how he wanted to make a documentary about Lawrence Anthony, a South African who was working with elephants.
"Lawrence had for the past few years tried to help a group of ferocious elephants, elephants that had destroyed surrounding villages and would now be put to death if no one embraced them. So for the past few years, he had for months hanged out with these elephants. And it led to that his entire way of looking at life on our planet had changed. The more time he spent with the elephants, the more he experienced his own inferiority. The human brain may be developed, but all of our other senses are embarrassingly undeveloped: our hearing, our sight, our touch. Researchers have still not understood how, but everything indicates that elephant senses function in a way that sounds like science fiction. For example, one has begun to understand that elephants can communicate with each other over incomprehensible large distances. Maybe over entire continents. Lawrence argued that he occasionally felt this communication. It had felt like the elephants had tried to communicate with him. He didn't want to talk much about it - in part because it was difficult to put it into words, in part because he understood it sounded a bit too much new age fuzzy. I returned to Sweden and thought it existed material for a good story."
But Malik Bendjelloul was also talking about one of Lawrence Anthony's other adventure: when he, just a few days after the 2003 invasion of Iraq had ended, traveled to the capital of Iraq, Baghdad, to help the animals at the zoo. I was really happy when I realized that he had written a book about it before he passed away in 2012. It's called Babylon's Ark: The Incredible Wartime Rescue of the Baghdad Zoo, and it's the best book I've read so far this year. There are some clips available on YouTube, but you should also read the book.


Not only did he rescue many of the animals at the Baghdad Zoo, but also other animals across Baghdad. Lawrence Anthony realized that another zoo existed in Baghdad, and it was called Luna Park. It was in terrible shape, so he decided to move the animals to the main Baghdad Zoo:


Saddam Hussein, the former leader of Iraq, collected horses, and they also needed to be rescued. During the war, the horses disappeared because they were very valuable, but Lawrence Anthony and his team managed to find them and bring some of them to the zoo:


So if you want to read a feel-good book that I rated 5/5 stars on Goodreads you should read Babylon's Ark.

August 15, 2019

Disco Elf Corel - or how to make a stylized character

0 comments
I finished my second ever character for games: a disco elf called Corel. Like my last character, butterfly woman Madeliefje, I made it to participate in a draw-this-in-your-style challenge organized by Poopikat, and I also wanted to learn Blender 2.8. This is the original concept by Poopikat:


According to Poopikat's description, Corel "has darker skin, Glow tattoos and white-ish blue hair with two big bows. I'd like to think of her as a water/snow elf if that makes any sense." I thought it would be cool to make them glowing tattoos, so I decided to make a 3d version of her in Blender. I also wanted to improve what I thought wasn't good about my last character.

Improvement 1: Face. So I started with the old character. Most 3d artists use a basic character and change it to make it look more like the character they want to make because most human-looking characters have similar body shapes. Step one was to improve the face. I first changed her jaw bone to make a sharper jaw and I also changed her eyes. What I learned was that very small changes can change the look of a face. If you look in a mirror and then open your eyes slightly and stare at yourself, you only have to raise your eye-brows a few millimeters to go from just a "looking" face to a "staring" face. To improve this character I made the distance between the eye-lids and the eye-brows smaller to make a more concerned face like in the original concept. I also remade the size of the lips and I gave her an open mouth where you can see her teeth. The teeth are just a flat white surface because they are almost not visible anyway.


Improvement 2: Body. Madeliefje's body looked like a human body, but I wanted Corel's body to be more stylized. One artist I get inspiration from is Carlos Ortega Elizalde, who's making characters with a slim body and large head. I think they look really cool. So I changed Corel's body to be smaller while increasing her head size.


Improvement 3: Rig. To make a 3d character move around you need to "rig" it by adding bones like a human has. Some people have this as a job, so it's not something you learn in an afternoon. I'm using Blender and a free add-on to Blender is Rigify which will generate a rig for you. I used a simple rig to animate Madeliefje and I realized I couldn't pose her the way I wanted because I couldn't rotate her hands. It takes some time to learn Rigify and you have to tweak the generated rig to make it fit your character, but because all human-looking characters move in the same way, Rigify will help you a lot once you learned it.

What I want to improve when making the next character.
  • Hair. Making hair for game characters is not easy - there's a reason most game characters have short hair or a ponytail. The reason is that big hair will demand many triangles, making the game slower and it's also difficult to animate a big hair. Corel's hair consists of many hair pieces you have to add one-by-one and the result is that you end up with a "stripy" hair and many triangles belonging to the hair pieces are hidden, so it's a waste of triangles. I've seen some characters where the hair is just one big mesh, so I might try to make that type of hair next time. 
  • Cloth creases. Corel is wearing a body-suit and to make it look more like cloth you have to sculpt creases. I think they were too small and you can't barely see them in the final model, so I will make them bigger next time.
  • Normal map. To make smaller details on a less detailed mesh, you need a normal map. The normal map belonging to Madeliefje was so bad I had to remove it, but Corel has a normal map. This normal map generated some weird edges and I think the reason is that Corel is too low-poly, so next time I will add a few more triangles, especially around the legs.      

These are the final poses, with some inspiration from a disco movie with John Travolta. I added the smoke as a post-processing effect in Krita:


If you want to vote for her you can find her on Artstation.

July 23, 2019

How to make a stylized game character in Blender

0 comments
I finished my first ever stylized character for games. Her name is Madeliefje and I decided to make her so I could participate in a so-called draw-this-in-your-style-challenge. This is a popular challenge on Instagram where an artist uploads an artwork and then the community will remake that artwork but with their own personal style. I didn't have a style because this was my first character, but I've always wanted to learn how to make a stylized character, so I decided to give it a go. Stylized art is the same art-style you can find in games like Fortnite. This is the original artwork by Madeleine Bellwoar:


Now this was my first character, so to learn how to make a character in Blender I found this tutorial: CGC Classic: Female Character Modeling. And if you finish it you end up with something that should be a good start you can continue from to make it your own character. I wanted to make a stylized character and they tend to have bigger eyes and smaller eye-lids, and this character also has elf-ears, so I added that and ended up with this:


Next up was hair. The original character has long hair, which is not a good idea in games because it's difficult to animate, so I decided to give her a pony-tail. Now there are several ways to make hair in 3d, but I needed to make stylized hair, and this is an excellent tutorial on the subject: How to Model Cartoon-Style Hair in Blender - Bezier Curves Tutorial. I separated the hair into two major parts because it was easier to control with the bezier curves, so the pony-tail consists of three pieces which are not connected to the head pieces, but the missing connection is not visible because of the scrunchie.


To make good-looking eyes I found this tutorial: How to Model, Light, Texture, Bake & Rig eyes in Blender. The eyes were actually the hardest part - or rather the appearance of the eyes in relation to the head. Stylized eyes are larger than normal eyes, but when you add larger eyes the character may sometimes look like the eyes are popping out of the head, so I had to spend a lot of time adjusting the size of the eyes, the size of the pupils, the position of the eye-lids, and so on. It was also fun to rig the eyes to make it easier to control them:


In the original image you can see that she's wearing a skirt, but skirts are kinda tricky to animate, so I replaced the skirt with pants. The idea behind the pants is that she has folded them up so I had to add many creases to the pants to give them the correct shape. Blender has a sculpting tool so I used a crease brush, and the pants were actually the only part I sculpted - the other parts were just moving one vertex after the other. Speaking of moving vertices, the top in the original image consists of leaves and the top was the most time-consuming part of the character. I first tried to sculpt the leaf-top with a leaf-brush but it didn't work. Then I tried to add the leaves with a particle system, but it didn't work. So I had to place all 300+ leaves one-by one:


We can't see the bottom of the character in the original image, so I gave her boots. And I also replaced her diadem with butterfly antennae, because the diadem I first made didn't look good. The main character is now finished. But I also wanted to make it game-ready, meaning reducing the amount of vertices by baking textures onto a character that looks the same but has fewer vertices, and then you end up with a texture sheet looking like this:


Most of the ambient occlusion shadows in the above texture sheet are generated automatically by Blender, but I had to clean them up by vertex-painting. At the same time I also painted her lips and gave her face a slightly red color, so the entire skin is not looking the same. Most humans have a slight tone of red in the face, but also some yellowish and bluish colors, so you have to experiment with what looks good. An excellent tutorial on how to use textures baked by Blender to make stylized textures is: Learn Sculpting by Creating Game Assets. I also had to make a specularity texture, which tells which part of the character should be reflective, such as the boots, and which should be not, such as the pants. Then I rigged the character with a simple rig to be able to move her legs and arms to easier change her pose. This is the final result:


But the idea behind the original character is that she's responsible for growing plants during spring time. So I thought it would be an excellent idea to practice making foliage. I've earlier tried to replicate the trees from the Witness game, so I had some experience, and I also found this video on how to make plants for games: How to make stylized plants and grass. The basic idea is that you first make a high-polygon plant and then you bake the high-polygon model to a flat-plane. It looks like this:


And if you do some painting the texture will look like this:


Then you cut the plane around the individual plants and move the vertices to make the flat mesh more three-dimensional. These flat meshes are called cards. The problem is that they look the same from both sides but it's generally not a problem. For example, you never see the bottom of the plant to the left so you never notice that the upper part is the same as the bottom part:


To make a forest scene, you add a flat mesh with many vertices, and then you use Blender's weight-paint tool to give each vertex a weight, which controls if you want a specific plant to appear around that vertex. Then you use a particle system to place the plants, so you don't have to place each piece of grass by yourself. You can also use weight-paint to control the length of each plant. This will require a lot of painting and re-painting until it looks good and no plant intersects with another plant. This was an early test (the plants are smaller along the border and this is controlled by weight-painting):



In the original image you can also see there's some kind of stone-bench. So I googled for some reference images and ended up with this:


I used a stone brush to paint the different colors of the bench and I think the result was better than expected. So I was a little sad when most of the bench in the final scene is hidden by the foliage, but I guess that's how it is. Anyway, this is the final render which took about 90 minutes for the computer to generate. 


The time it takes to generate a final image is one of the struggles with 3d. Yes, you can generate images with lower resolution and quality which is faster, but sometimes you find something that bothers you in the image with the highest resolution. Then you make that small change and have to wait another 90 minutes for the new image to render. For example, I made some tests from other angles, so there were many 90-minutes of waiting periods. And I have just one computer and rendering images takes up almost all power, so even surfing the web was a struggle during the waiting times:


But that's not it! In the original image you can see some greenish smoke. Blender can generate volumetric smoke, but when I tested it, it was difficult to control how the smoke looked and it would take like 5 hours to generate the final image with smoke, so it took far too long. Notice that this is not the same grayish mist you can see in the rendered image - it takes zero time to generate. Instead I decided to learn some post-processing in Krita. This is an excellent tutorial on the subject: Post-processing for Dummies in Under 12 Minutes - Blender and Krita Tutorial. And the final image looks like this:


In the end it took some weeks to learn all these things, but when I make the next character it will hopefully be a much faster process.

This project is also my first project on Artstation, so go there and like it if you like it.

June 2, 2019

Why RimWorld sold more than 1 million copies

0 comments
RimWorld is a very popular management game where you run a sci-fi colony. On Steam, the game is described as:
A sci-fi colony sim driven by an intelligent AI storyteller. Inspired by Dwarf Fortress and Firefly. Generates stories by simulating psychology, ecology, gunplay, melee combat, climate, biomes, diplomacy, interpersonal relationships, art, medicine, trade, and more.  
The game has been in development since 2013 after a successful Kickstarter campaign, and was finally released in 2018. It has sold more than a million copies. At first glimpse, the game doesn't look like much because it's a 2d game and has no fancy photo-realistic 3d graphics. Why then is it so popular?

RimWorld is an indie-game by Tynan Sylvester. If you play the game you can see he's doing everything he can to market himself: The sub-title at the start menu says "A story generator by Tynan Sylvester," and from the start menu he's linking his Twitter-account and a book he wrote about game development: Designing Games: A Guide to Engineering Experiences. It was published before RimWorld so you will not learn how he designed that particular game, but he used knowledge from the book when designing the game. He has also talked about the game at GDC 2017, which was published on YouTube not long ago: RimWorld: Contrarian, Ridiculous, and Impossible Game Design Methods. If you watch the GDC talk you'll see he had help from multiple people for audio, visuals, and programming, so he didn't make RimWorld on his own.

Lessons learned:
  • It combines manufacturing, survival, and social. According to the Paradox Podcast, RimWorld is a fun game because it combines the games Factorial (manufacturing), Don't Starve (survival), and The Sims (social). In RimWorld you need to manufacture (grow and cook) food to survive, research new technologies to eventually travel home, and you also need to form relationships with neighbors, who for some reason are on the same planet, as well as form social relationships within the group, and build yourself a cozy place to live. 
  • RimWorld is a story generator. Tynan Sylvester explained in the GDC talk how he was inspired by the game Dwarf Fortress - not the graphics, but how Dwarf Fortress can create stories. The player interacts with the game and stories emerge from that interaction. Some players will lose the game, which may be a story because some stories end in failures. This is also why there are no Steam achievements, which would break the story. The thing is that RimWorld hasn't come up with a story generating AI because it's using a concept called apophenia, which is a term that refers to the human tendency to detect patterns in randomness. What's happening is that the game "sends entirely random events the player’s way, and yet it’s easy to ascribe meaning to them," but people don't see it as random events. The characters have no facial expressions so you can't see what they feel, so you have to imagine it based on the situation. In the developer's book he wrote that "Medieval [another game] doesn't really track human courage or familial affection. But the human mind sees stories anyway, given the slightest of suggestions." But making a simple system can also result in trouble as real social relationships are complicated. For example, this article has found that "Men [in RimWorld] are about eight times as likely as women to try and start a romance," so players can become upset at the game if they have other values. So if you implement a simple social system, be careful!
  • All characters in RimWorld feel special to you. In RimWorld you have just a few characters: you start with between one and three, and end up with maybe eight to twelve. Compare this with other games where one character is killed and you don't really care about it. If a character in RimWorld dies, you have the option to build a grave and the other characters will be sad. If a person is wounded, you have to make the decision to treat the wounded or let the character die. If you treat the wounded, the character will use resources like food and medicine while the character is useless because the character can't work, so the other characters have to work harder.  
  • The graphics is not distracting the player. When I first looked at the game I thought it was made by the developers behind another management game: Prison Architect. But it's not. Both games were revealed at the same time so I'm not sure who was inspired by who? Basically the art style is a top-down 2d game and the characters are leg-less blobs (but you can still give them pants). The game is made with Unity (and Photoshop to make the art) and is using the built-in font style that comes with Unity. The UI boxes are just one color with a frame in another color. So it has no fancy realistic 3d-graphics, but the graphics is not ugly so the graphics serves the purpose: you can always see what's going on - even if you have zoomed out. Fancy visuals may sometimes distract the player from the story when many things is happening on the screen. Also making fancy graphics takes a lot of time - and time is also a limit so sometimes it's better to focus on gameplay - there are no animations in RimWorld. Moreover, many people don't have the latest computer so I suspect one reason the game is popular is because you don't need to have the latest computer to play it. Neither does it take a long time to download the game because it's just 500 MB. To make it as simple ass possible for the player to see what's going on, RimWorld is cheating: some objects that should be behind a tree are on the top of the tree:

  • Don't throw away any ideas. While developing RimWorld, Tynan Sylvester was saving all ideas he ever discovered in a document because ideas are easy to forget. If the idea doesn't fit into your current plan, write it down because the plan may change. He then moved these idea to another document which was the more short-term to-do list. 
  • It's easy to learn RimWorld but difficult to master. A saying in the game industry is that a game should be "easy to learn and difficult to master." For example, the game pubg is very easy to learn, but it's really difficult to get a "chicken dinner" (win the game). RimWorld has a short tutorial which covers the basics but nothing more. To learn the rest, the game has smaller hints that you can click through. Making a tutorial is a dangerous balancing act - you can't give the player too much information because then it becomes boring to play because it's fun to figure out some stuff on your own, so the game has a wiki as backup if you are stuck.
  • The game keeps you in the flow channel. The flow channel is an important topic in game development, and it says that to enjoy a game, the tasks have to match the difficulty. If the game is too easy, you will be bored, and if it's too difficult you will not enjoy playing the game - so the game has to keep you in a channel where you will always meet challenges that matches your experience. For example, if you play a shooter: start with good gun which will become boring after a while → add harder enemies which will become boring because it's too difficult → add better gun → add better enemies → and so on. In the beginning of RimWorld, you have to start food production and build a basic shelter. But as the game progresses, and as you learn more, it becomes more and more difficult because some characters will be wounded and can't contribute, so you have to prioritize more and more: should you harvest crops or work on researching new technologies? When you have learned the basics you will realize that you don't have enough resources on the map you start, so you have to form caravans and travel the world to find more resources. So RimWorld becomes more and more difficult to play as you become more and more skilled. Yes, there are dull moments where no disasters (raids, solar storms, battery explosions, etc) are trying to kill you, but you know that you need those pause moments to prepare so you can survive the next disaster. 
  • The weather system is affecting the game. In an earlier article I was complaining about the weather system in the game Parcitect, which didn't affect gameplay in a noticeable way. But the weather system in RimWorld is really out to get you. If there's a lightning storm, forest fires can start and burn down your buildings and you have to hurry out with your colony and extinguish the fire. If it's too hot outside, your food will go bad and you have to build a cooler to freeze the food. Sometimes a sun storm hits you, which temporarily malfunctions the cooler, and you will be really worried that your precious food will turn bad.  
  • Making a game moddable while developing it is difficult. One great way to add more content to your game without spending time nor money is to let other people add it for you by making your game work with mods. The problem is that the code will change rapidly while developing the game, so a better way is to let people add mods when the game has stabilized, or people have to update the mods all the time which is really time consuming. This is what happened with RimWorld: "many creators of bigger mods have given up trying to update their mods every time a new update comes out." 
  • You are directing the characters - you don't control them like drones. It would have been possible to increase the control of the characters. For example, if two characters don't like each other, then separate them. But that would also have been boring and made the interface even more complicated: "The goal of the game isn't for the player to be able to exactly restrict every colonist to do the exact optimal thing. It's to give a certain level of generalized control, and make the player accept some narratively interesting but sub-optimal interactions that might happen within that."
  • Addictive games have responsibilities. RimWorld is an addictive game and to help people not forget about the time in the game, you have the option to enable a clock. I originally thought it would tell the time in the game because RimWorld has a night-day cycle, but it's telling the time in your time so you don't forget an important meeting.
  • Procedural terrain increases replayability if gameplay changes. The basic idea behind the game is to build a spaceship and fly home. This could become repetitive. The goal would have felt repetitive if you had done it over and over again in the same terrain. But RimWorld has procedural terrain and different types of terrain: mountain, forest, jungle, desert, etc, so after finishing the game you ask yourself "Can I also do it in the jungle terrain?" But it's important that the terrain is different and not just procedural. I played the game Bad North which has procedural islands but the game feels the same after a while even though each island is different - but not different enough to change gameplay. In RimWorld, if you first play in a forest area and then play in the desert you need another tactic because you can't find trees easily in the desert. 
  • Gameplay is more important than realism. Why are there no toilets in the game? Would have been a great fertilizer? Why is there no water management? There are smaller lakes with water in the game, but for some reason you can cook food without ever picking up water? It first felt like a missed opportunity before I read a Reddit AMA. Water wasn't added because "colonists have a lot of work to do so the needs have to be a lot more lightweight," meaning that the colonists won't have time to eat food, wash themselves, and do some work because each day in the game is short. Some in the same thread argues they really wanted water management in the game. It's the same with ammunition - each bow has an infinite amount of arrows, so making ammunition would maybe take too much time? In the GDC talk, Tynan Sylvester explained that he simplified everything that wouldn't contribute to the story. It's not realistic to dig metal directly from metal-rocks and then use it directly to build a metal-chair, but adding parts between wouldn't have improved the game. 

What could have been improved:
  • Annoying UI. If you read through the RimWorld reviews on Steam, some complain the UI is not easy to understand. This is true: everything about the game is minimalistic and the UI is grouped in the bottom of the screen. 
    • A better way would maybe be to group the UI with icons on different parts of the screens, like Cities: Skylines or Parkitect. Text is sometimes better to use than icons, but after a while you learn what the icons mean, so it doesn't make a difference in a game. 
    • Some UI elements, such as the UI showing which zone types you have placed in the game is not visible enough - they blend too much with the background.  
    • Why are orders in the architect menu? 
    • Why are build roof in the zone menu and not structure menu?
    • Why can't you see, when selecting which tasks a character should prioritize to do, if the character can increase its skills more than other characters when working with that task. You can only see current skills - not the "passion," so you have to click back and forth between the character's bio UI and work priorities UI.
    • When building for example a chair, you can change the material of the chair from wood to steel or whatever, and it took some time to find this menu because it's just a small triangle in the top-right corner of the chair icon. It should have been included in the tutorial because it's not obvious you can click on the triangle to change material. 
    • When manufacturing, everything is basically text, so sometimes it can be hard to figure out what you are manufacturing. A better idea would have been to use text in combination with an image, so you don't have to tab out and google what it is. For example, what is an "ikwa"? The description is empty (this might be a bug because the ikwa has a description in another place in the game), so you have to tab out, google, and the first result is the RimWorld wiki, which has an image of a spear.  
  • Odd behaviors. Each character has some characteristics, such as being able to treat wounded, or grow plants. One of my characters could for some reason not carry items, such as transporting food from the growing area to the storage area. But on the other hand the character could cook food, so you could see him go to the storage area and pick up food and carry it to the cooking station. So why couldn't the same character carry food to the storage area? I could have accepted that some characters can't do high-tech research, but not being able to carry potatoes from the field to the fridge when it clearly can carry potatoes from the fridge to the cooking station?
  • Difficult to prioritize tasks. A management game is all about prioritizing tasks so it has to be as simple as possible. Currently, you can tell a character to prioritize a task, such as cooking before cleaning. If you want to prioritize a certain tree to be cut you have to select a character and then the tree. But what if you want the tree to be cut by just one of the characters without you knowing which - you just want the first available character. This was solved in the game Oxygen not included, which is similar to RimWorld but you are mining up/down below the ground and not aobe the ground. What Oxygen not included did was that you can click on an object and set a priority to that object. So if you want a tree to be cut by first available worker, you increase the priority of that tree. In the game Settlers, you can prioritize which items to be hauled before another item, which is impossible in RimWorld. It's really annoying when you see a colonist haul a single joint while leaving the precious food to go bad in the rain. I think there's some built-in prioritization because you can see them build defense structures before all other structures, but I haven't found a way to change this prioritization.    
  • Odd parameter values. This is the same problem as Parkitect has: it's difficult to determine what makes a room beauty. In RimWorld you can place floors, sculptures, furniture, flowers, etc to make a room "beauty." But even though you have placed many of these items the characters are still complaining, and if you google you see many other people are confused by the same topic. Perhaps a better idea would have been to use the same system as in Cities: Skylines where you see clearly on a color-map where you need to add more parks. Yes, RimWorld has a beauty display, but it's confusing. For example, why has one part of the drawer a beauty of 1 and the other part a beauty of 3?
  • The storage area need a search function. For each storage area you can set with a check-mark if something should be stored in it, such as food but no weapons. But sometimes it's difficult to find what you are looking for, so it would have been easier if you could search for it. It has a hierarchy, but sometimes you have no idea within which group something belongs. For example, where's the Luciferum checkbox? It's below Manufactured → Drugs. If you click on the Luciferum description it doesn't say anything about that it's "manufactured." So if the search function is too difficult to implement, then it should say in the description where the item is in the hierarchy.  


May 27, 2019

Why did you give the game a bad review after playing for so many hours?

0 comments
Sometimes when you browse Steam reviews you see a review like this:


If you don't know Swedish, "Recommenderas inte" means "Not recommended" and the customer is not recommending the game Cities: Skylines despite having spent more than 1000 hours playing it. You have to pay roughly 30 USD to get the base game, and how can you say getting 1000 hours of entertainment for 30 USD wasn't worth the money? Understanding this is also something other game designers struggle with. This is a tweet by a product manager at Paradox after their game Imperator: Rome got bad reviews:


When writing reviews, gamers are not measuring the money they spend on a game in relation to the number of hours they play the game: 30 USD for 1000 hours of entertainment wasn't worth it! In Sweden, 30 USD is roughly three movie tickets and a movie is usually two hours long, so if you go to the cinema you get 6 hours of entertainment for 30 USD. So games are very inexpensive entertainment. If you thought the game was boring, why did you spend 1000 hours in a boring game? Maybe you thought the game would be funnier the longer you played? Some games tend are deep and you have to play for some time before you can give the game a review. But you can also find similar reviews of games like Pubg, which is a less deep game and you understand what the game is about in a few hours:


What is going on? While reading the book Designing Games: A Guide to Engineering Experiences written by Tynan Sylvester, who also made the game RimWorld, I found "player's remorse." It's defined like this:
Player's remorse appears after a player spends time on a game that motivates him but does not fulfill him. 
The player has enjoyed playing the game for 1000 hours but then felt empty - what was it all worth? "Why did I waste 1000 hours playing this game?" A parallel is television series. Many were upset with Game of Thrones after what they thought was a bad ending of the last season. "Why did I waste my time watching eight seasons when all I got was that ending?" I bet many people regret watching eight seasons even though they enjoyed all eight seasons except a few of the last episodes of the last season. People spent so much time analyzing what would happen - and to what use? But what would have been a good ending to Game of Thrones when everyone had so high expectations?

Another great discussion on the topic is this Reddit threat: About games that have Steam reviews like this: "[100+] hours on record, Not Recommended", which also links to this article: Sympathy for the… person who left a negative review on Steam for a game they put 600 hours into. To summarize, some reasons to why someone with a high playtime gives a game a bad score are:
  • The developers could have updated the game. Most games, including Pubg, are continuously being updated. So a user may have spent many hours enjoying the game before it was updated and the update made the game worse.
  • It could have taken many hours to really understand the game. The more experience you have, the more flaws you will find. Some games are deep and you need experience to really understand the game. While it's fun to play the game when you are new, it's unplayable when you have 1000 hours of experience. 
    • Cities: Skylines: it takes a lot of time to build a large city and realize that it has flaws because it can't simulate enough population for a large city. 
    • Pubg: if you are really skilled then each millisecond counts and then some say Pubg is broken because it can't always handle these milliseconds because of multiplayer issues. 
    • No man's sky: you were promised an infinite universe, but it took some time for players to realize that yes the universe may be infinite but all the planets look the same, so what's the point of having an infinite universe? 
    • Hearthstone (Reddit comment): "Ultimately it was the insulting "developer insights" that killed it for me. You realise many of the games 'flaws' were intentional decisions to leech more money from the player base (ie. Bizarre and poorly justified balance decisions that pushed you towards buying more cards)"  
  • The game is boring to play but you think it will improve the more you play. You think it will be more fun to play if you reach the next level or upgrade to a better tank, but what if it never happens? You spend a lot of time upgrading to better tanks in the game World of Tanks, but when you finally get a better tank the game will force you to play with other better tanks, so what was the point?  
  • You were addicted to the game. What if you enjoyed a game so much that you quit your job and isolated yourself before realizing you were addicted to the game? Would you give the game a good or bad review? Or as a Reddit comment said: "I wasn’t just playing because I was enjoying the game; I was playing to level up and earn a lootbox, so I could get a chance at that elusive skin, and pretty soon I noticed myself continuing to play in spite of not enjoying it any more. I was playing compulsively."  
  • The game never ends. Neither Pubg nor Cities: Skylines have endings - you either start the game over and over again in a hunt for winning a match in Pubg or you build your city over and over again until you run out of space, so it's natural that a few people after 1000 hours wonder what the point of playing is when it never ends.   
  • The pause button increased playtime. Some people pause their games for various reasons, so having 1000 hours of playtime doesn't mean they played the game for 1000 hours.  

What if it's not the players who are to be blamed, but the review system. On Steam, you can either say the game is good or bad: thumbs up or thumbs down. You played the game for 1000 hours but in the end you didn't like it, but it was still sort-of fun to play it. Now you are forced to pick one of the options: good or bad. Sometimes it's useful with more options.   

May 17, 2019

Parkitect - a management game

0 comments
I'm currently working on a management game so I thought it was a good idea to play-test some other management games and try to figure out what I would have done differently. First out in the play-test series is Parkitect which is a game where you manage your own theme park.

Perhaps the most common management games throughout the ages are city builders like SimCity and theme park games. Parkitect is one of the latest in the series and was released in 2018 after some years of development and a successful Kickstarter campaign. The players have rated it mostly positively on Steam.

Parkitect is made with Unity game engine, which is the same game engine I'm using. It's running on a grid, like in the old days, so the entire map is divided into square cells, so you can't build curvy roads like you can in the game Planet Coaster, which is another recently released theme park management game. But using a grid is not necessarily a bad idea because the game still looks good because they are not aiming for a realistic art style - more of a retro art style. The retro art style is also making the game run faster on my laptop, which is not the worst laptop but still far from the best. I saw a video of someone playing Planet Coaster, which has a more detailed art style, and that person had to stop playing the game because the computer couldn't handle all details even though the map wasn't fully built. You can fill the entire map in Parkitect and the game is still running fine.

Parkitect has a campaign where you play scenarios provided by the game developers. For example, your job is to build a theme park on a deserted airfield and you win if you get 500 customers or whatever the goal is. Each scenario has different goals, but it still feels like the goals are the same after you have figured out what to build to attract new customers. You are basically doing the same on each map: you are trying to make the park-guests happy. They want different type of attractions, they want food, they need toilets, they want the park to be free from garbage, and they want the park to look nice. After a while you have learned what you need to build to make them happy and then you build the same thing over and over again. So you shouldn't play it to get a challenge - you should play it because the game is relaxing.

So why isn't the game challenging? The game has a weather system - sometimes it will rain for maybe a day - and the temperature changes. But I haven't noticed that the temperature affects the customers because they happily ride in the fastest, highest roller coaster even though the temperature is around freezing temperature. Some indoor attractions are more popular when it's raining, but because it's raining for just a day you are never noticing the difference. Neither is the water turning into ice (I tried by dropping a guest into the water so yes you can kill guests) and it's raining even though it should snow. So I think they should have utilized the weather system to make the scenarios more different from each other. If you have a weather system, make sure it affects the game. In this image, the temperature is below freezing, but the game looks and acts exactly the same as when the temperature is 20+ degrees:


To make the guests happy, you need to make sure they can buy food. This is something I was really surprised they added to the game: they have "haulers" that will carry boxes of food to the small restaurants when they are out of food. Most other games assume that the small restaurants have some endless amount of food supply. The problem is that your guest hates to see these haulers so you have to build special access roads to the restaurants so they can deliver boxes without any guest seeing it. You also have to hide these access roads because the guests don't want to see them. So what Parkitect does is that they will provide you with a decoration map so you can see where the guests don't like the looks of your park:


I read through the Parkitect development blog and they are using ray-casting to determine if the decoration is low or not. In the image above, they fire a ray (which is similar to a laser) from the stairs and some rays hit the pink delivery box system, which is considered ugly in the game. So when I added fences around the pink building, the red disappeared. Anyway, the pink building is connected to the main warehouse through an underground pipeline system, which looks like this:


The problem with this pipeline system is that it's annoying to build because it's running in 3d and the heights have to be the same for it to connect. It's often difficult to judge at what height the pipeline system is, so you will sometimes need many attempts to make them connect. What I would have done differently is to have the pipes at just one height, like Cities: Skylines sewer system. Sometimes you have to build pipes above areas you don't control, but it could have easily been solved by allowing pipes below the area you don't control. 

To make your guests happy, you have to make the attractions you build look good, so Parkitect has given each attraction a decoration parameter that can be low, medium, etc. So after you build a roller-coaster you have to use one of the several building blocks to make it look better. This is sometimes confusing. For example, this roller-coaster has low decoration even though I've added rocks, flowers, special fences, and space-style buildings:


The decoration suddenly turned to medium after adding this building in the middle:


This ride also had medium decoration:


So what's the difference? I suspect they are again using ray-casting to determine level of decoration and because the roller-coaster is larger it needs decoration not just at the entrance. But the problem is that it's kinda confusing for the player, so they should maybe have added some color map to show where on the attraction the decoration is low.

To make you guests happy, you have to build different types of attraction. I've notices that they complain if you don't have an attraction with high intensity, and if you build one you will get more customers. One odd behavior I've notices is that some attractions are not popular at all. For example, this ride is free but the queue is almost empty:


So an improvement could have been to tell why no-one wants to ride the attraction. In the image above, it has nothing to do with the type of attraction because it was really popular in another scenario. But now almost no-one wants to touch it even though it's free. And sometimes you see that your new expensive roller coaster is empty while the queue to the Ferris wheel is full.

The game gives you a list of what your guests like and don't like while visiting the park. Sometimes they complain they are broke, which can be confusing because you can add cash machines, so you are not really sure why they are complaining.

Another problem I discovered involves the absence of pathfinding. If you destroy a path while guests are walking on it, the guests begin to walk in a random direction hoping to find a path to walk on. But sometimes they are not finding their way back because they just walk randomly. A better way would have been to do some pathfinding back do the nearest road, which is doable because the entire map is a grid and you know which tiles are roads, so a flow field algorithm would have been a fast solution.

To summarize: Parkitect is a relaxing game that's running fine even if you have an older computer. It has some game mechanics you can't find in other theme park management games. Some game mechanics are confusing and should have been easier to understand, and the game could have been more challenging to attract players who want more of a challenge after learning the basics.

Everything you need to know about management games

0 comments
This is an article roundup of all articles related to management games on this blog:

May 2, 2019

Fancy Flying - or how to make a game in 48 hours

0 comments
The Ludum Dare competition was on this weekend and it's a competition where you make a game in either 48 or 72 hours. I've previously participated in the competition eleven times, but I skipped it the last three times, but this weekend I decided to be a part of it again.

The problem with this competition is that it's not entirely fair because of the voting system. Hundreds of games a submitted each time so how can you judge which game was the best? A single team of judges can't play them all, so the participants in the competition will each judge at least twenty games and then the average score will give you the final result. Sometimes you are lucky that the twenty out of hundreds of participants like your type of game, so you will get a good score. There's also a problem with people who vote on your game without even playing the game (to encourage voting your game is displayed higher in a list of all games), which was reported by someone who thought it was odd that he/she got twenty votes but only five people had downloaded the game. So you should participate because it's fun and you want to test an idea - not to win. 

A few days before the competition I was researching an aircraft game I'm working on and read an article about bird strikes. As seen in the the movie Sully: Miracle on the Hudson, which is based on a real even where an aircraft crashed in a river around New York because birds hit the engine, birds are dangerous. So I decided to make an infinite aircraft game where you get points for flying low (to avoid enemy radar) while avoiding dangerous objects like birds, mountains, houses, and radar poles. This was the result:


The entire world consists of a few chunks: mountains, forest, lake, city, which are spawned every 50 meters with some probability, and the chunks are recycled by using a pooling system, which makes it faster. I originally planed to make my own collision system because the game is not physics based, but then I realized that I could use Unity's own collision system even though the game is not physics based, meaning that I use transform.Translate() to move the aircraft and not rigidBody.AddForce(). But if you add a rigidbody to the aircraft and set it to kinematic and then the colliders connected to the mountains should be set to trigger, you can still check for collisions by using OnTriggerEnter in the script attached to the gameobject which also has the rigidbody. The problem is that if you collide with an object, the rigidbody will just continue through it, so you have to make your own collision response system. 

In the first Ludum Dare games I made I didn't include any sound, because you have to make the sound during the 48 hours so it's easy not to prioritize sound if you run out of time. I've gradually added sound to my games with various results, so this time I really tried to add sounds that didn't scare people (or forcing them to turn off the sound because sound was "sooo bad"), and so far no-one has really complained that the sounds are bad. The jet engine sound is from a YouTube clip and I had to make it seamless, which took a lot of time but I learned a lot in the process, which was the point of participating in the competition.

If you want to test the game you can download it here: Fancy Flying

April 18, 2019

Fake fluid simulations in Unity - or how to make the water system from Sprinkle game

0 comments
To research water simulation models I read a PhD thesis called Large-Scale Water Simulation in Games. The author has been working with the water system in Cities: Skylines, so if you want to learn more about how that was done you should read the thesis. But in the beginning of the thesis, the author was discussing different water systems in games. One of the games mentioned was Sprinkle, which is a mobile game where you have a fire truck and your job is to extinguish fires. It looks like this:


I played the game several years ago before I was interested in water systems, but when I saw it now I asked myself "How did they made that water system?" And above all, how could they simulate a water system on a mobile device? To simulate realistic water systems, you have to simulate the Navier-Stokes equations which is taking up a lot of computer power, so you are never doing it in games - and especially not in a mobile game from 2011.

One of the developers has written a blog post on how they made the water system: Sprinkle behind the scenes, and there's also a GDC talk pdf: Constraint fluids in Sprinkle. So what Sprinkle is doing is that they simulate water by using 600 particles and each particle disappears after 3.5 seconds to not make the simulation go slower. To display the particles on the screen they are using a "dynamic particle mesh" which I have no idea what it is, but in the GDC talk they say it's "point splatting with a few tricks." To simulate the particles they are using the built-in physics system together with a simplified Navier-Stokes simulation system. So it looks like this behind the scenes (this is before they add the dynamic particle mesh, so you can clearly see the particles):


To recreate the basic idea I found an article which is implementing something similar in Unity: Liquid Physics. The author is using just Unity's built-in collision system to simulate water, lava, and air. To create the solid surface from the particles, each particle consists of a circle with a gradient circle attached to it. The gradient gets a color (red, green, or blue), and then a render texture is used to capture the different colors:


...and then you use some shader tricks to generate a more solid surface that looks like the element being simulated. To change the type of particle to for example water, you experiment with the rigidbody settings to make something that feels like water. And in the end my version looks like this:

March 21, 2019

Self-driving car 2019 update

0 comments
About four years ago I made a self-driving car in Unity, which is an implementation of the Hybrid A star algorithm. I update it about once a year, except for last year when I didn't update it, so I decided to give it an extra large update this year. The following improvements have been added:

1. Reeds-Shepp paths. The old version used modified Dubins paths to make something that resembles Reeds-Shepp paths, but now I decide to add the real Reeds-Shepp paths. These were really annoying to make, so I've decided to give away the code for free: Download Reeds-Shepp paths for Unity in C#.


2. Voronoi field. A voronoi field tells, from each cell in the grid, the shortest distance to a voronoi edge (which can be seen as the midpoint between two obstacles) and the closest obstacle. This is useful knowledge to help the car find a path through narrow passages between obstacles and it also speeds up the algorithm when you smooth the path and want to find the distance to closest obstacle.



3. GUI. The old version used different keys to display different textures and paths. But now I've added a real GUI to make it easier to change between the different options by just clicking with the mouse.


4. A semi and a semi with trailer. I've also made a Tesla Simulator, and in the last Tesla Simulator update I added the Tesla Semi truck and a trailer. So I thought it would be interesting to see if I could update the pathfinding for cars algorithm, with pathfinding for cars that also drag something behind them. It was easy to add a model to the algorithm that simulates a trailer, but the problem is to make the real trailer follow the path. So sometimes the drag vehicle is colliding with the trailer even though the algorithm is checking for that, so I will in the future try to find a solution for that.


5. Optimized code. I've learned one or two things since the last update, so I've optimized and cleaned the code.

6. Path following. In the old version of the implementation, the car used to follow the path generated by the Hybrid A* algorithm, which uses the rear wheels to generate the path. But to make the car follow the path with greater accuracy, this path has to be moved forward to the front axle. When the car is reversing this path has to be moved to a "mirrored front axle" to make it easier for the car to follow the path when reversing.


You can test it here: Self-driving car.

March 15, 2019

Download Reeds-Shepp paths for Unity in C#

0 comments
My side-project is to make a self-driving car in Unity. I've been working on it for about four years and the last update was 2017. This year I decided to make another update because I've learned one or two things since 2017.

A self-driving car is not one algorithm - it consists of several algorithms combined together. The main algorithm in this self-driving car is a path-finding algorithm called Hybrid A*, which is a modification of the classic A* algorithm. Most games are using A* to make characters find their way around the map. But unlike a character, a car can't turn 360 degrees on the spot, so some modifications have to be made. But no matter how many modifications you make, Hybrid A* will never find the target with the exact position and rotation, so we need some kind of path that ends up exactly where we want to go. 

One such path is called a Dubins path, which is the shortest path from point A (with heading A) to point B (with heading B). In total, there are six Dubins paths and you have to measure all of them to find the shortest one. They look like this: 


The problem with those paths is that sometimes a car has to reverse into the spot where it want to go, and a Dubins path is just forward (or just reverse if you make some modifications). If you can both drive forward and reverse, the shortest path from point A (with heading A) to point B (with heading B) is called a Reeds-Shepp path.

While then Dubins paths are six in total, the Reeds-Shepp paths are 48. Also, the original Reeds-Shepp report called Optimal paths for a car that goes both forwards and backwards is not the easiest report to read. Luckily, Matt Bradley has managed to implement the report in C# - but in another game engine than Unity. So I decided to translate the code to make it work in Unity. The main challenge I met was that it took some time to realize that Unity is using a different coordinate system than the coordinate system used in the original implementation.

This is the end result (black means that the car should reverse and white means forward):


You can download the Reeds-Shepp paths (and Dubins paths) here.

February 11, 2019

Tesla Motors Simulator - 2019 update 1

0 comments
New year and new Tesla Motors Simulator updates are rolling out. In the last update I managed to introduce a bug where the car continued to accelerate for some short time even though you didn't press the gas pedal button. This happened at higher speeds and you felt it most when driving the Roadster 2020. I fixed this bug in this update with maybe 10 lines of code, but it introduced some other inaccuracies, so I had to change the parameters in all cars to make them have the same performance as the real cars.

In the future I might build my own "wheel collider" to have more control over it. I'm currently using Unity's built-in and it's working like a black box where you put in some values and then some values comes out and no-one really know what's going on inside of the box.


In the last update I removed the destruction system that deforms the car when colliding with something. The reason was that I'm using a simplified destruction system and the destruction is sometimes very inaccurate looking from what it would have looked like in real life. But people were sad about it, so I decided to implement it again. I also added dramatic sparks to make it look cooler when colliding. Other games, like BeamNG have more realistic destruction system, which I believe is called soft-body physics. But realism means slower performance and the destruction system I'm using is fast. But I might implement a better one in the future.


The third thing I added was a simple container trailer that the Semi can drag around. The trailer is still a little buggy here and there, sometimes it flips when colliding with some small object, but it's working overall like a real trailer would. I also realized I could take this trailer and add it to my pathfinding algorithm for self-driving cars, so it becomes self-driving trucks!

February 7, 2019

Steering Behaviors - or how not to evacuate a building

0 comments
One good book I read is The Unthinkable: Who Survives When Disaster Strikes - and Why. It discusses an aircraft accident where many people died even though the computer simulations said they should have survived. What went wrong? The answer is that the computer simulations assumed people move in the same way as water.
For a long time, engineers assumed people would move out of a building like water. They would fill the space they had, coursing down the staircases and flowing out to safety like a river of humanity. Buildings were constructed accordingly. The problem is, people don't move like water.

So if you are trying to model real people, you have to take pain and fear into consideration. People make decisions, they stumble and fall, and they fill up space unevenly. On their way out, they pause to rest when they can. But if you are just trying to make a simple game, you can treat people like water. Treating people like water in games is also known as Steering Behaviors. These individual behaviors are supposed to work like Lego bricks - you can combine several of them to get the final character behavior you need.

Let's say you have a character that's following a path. It will work fine until the character is meeting another character moving in the opposite direction? One solution now might be to calculate a new path with some pathfinding method like A* (A star). But this will take some unnecessary computation power. A better way is to use these steering behaviors, which will make the character avoid the other character and then continue following its path.

The following shows a combination of the behaviors:
  • Seek - move along the flowfield direction
  • Solid obstacle avoidance - is in this case finding the closest point on the wall (the walls are just lines), and if the character is predicted to collide with the wall it should steer away from the closest point)
  • Moving obstacle avoidance - is in this case moving a character away from the character it's colliding with. So it's not a steering behavior but a commonly used cheat to avoid intersecting characters

While researching steering behaviors I learned that the most difficult of the behaviors is avoiding moving obstacles, so there are multiple algorithms trying to deal with the problem. 

Algorithm 1. The most simple obstacle avoidance behavior is trying to just avoid the most dangerous obstacle by predicting where it will be in the future, while ignoring all others.


Algorithm 2. Is trying to avoid all of the dangerous obstacles by predicting where they will be in the future, and then scale the prediction so that obstacles closer to our character are considered more dangerous. 


Algorithm 3. This one has a name and it's Power Law. It's similar to Algorithm 2, but is also calculating an energy. As you can see, the characters are finding their way through the congestion in a slightly more realistic fashion.


Algorithm 4. RVO. This is what Unity is using to make characters avoid each other on their navmesh. I never implemented this behavior but might do it in the future.

As you can see, some of the characters are intersecting with each other. This is a commonly used cheat and the idea is to avoid congestion, you shrink the radius of each character until it's not anymore stuck. This cheat was used in the game Planet Coaster (as explained in this article) and they sold millions of copies, so it should be allowed in your game as well!