PROMETHEUS IN GAME ENGINE UPDATE

HELLO CREATORS!

As you know, The Universim has evolved dramatically since our original pitch on Kickstarter. With your support, we’re improving nearly every aspect of the game on a daily basis. We do our best to keep production quality high and not prioritize release dates over quality and fun. In today's update, we want to talk about our future plans and keep up the standard of transparency you have come to expect from us. The Universim remains 100% crowdfunded, and we’re very proud of that.




DOWNLOAD WALLPAPER

Let’s talk about our in-game engine 
PROMETHEUS

The Prometheus engine takes up a huge amount of our time. It’s the primary life simulation system, so it makes sense that it will. It controls Nugget behaviour, animal AI, and even the functioning and generation of planetary environments. A few updates ago, we introduced an updated version of the Nugget Artificial Intelligence. This was our first major step towards a Smart AI System that’s been in development for some time now. Our goal is to make Nuggets feel real, like they’re organic creatures. However, in The Universim, a lot of systems are linked together and by updating one, we have to ensure that it works with its siblings and neighbors. It makes this process very challenging and time consuming. But hey, we didn’t choose to make games because it’s easy, right?


So in order to update Nugget artificial intelligence, we also have to update other features simultaneously. No amount of clever modularity or maintenance techniques could save us from this. In addition to the work on Nugget AI, improvements are being made to our planet generation mechanics.

We’re almost ready to start moving into different eras, which will allow you to try out updated buildings, build new ones, and research new technologies. We also want to introduce Road Networks, so the city formation feature can finally take form in the game. In order to make roads 
usefull and not just cosmetic, Nugget AI will have to recognize and utilize them as needed. In order to have roads on the planet, we have to update our planet generation algorithm to allow it to account for roadways around the planet. This is a big change that has been happening behind-the-scenes for some time now, with roughly half of our team dedicated to this feature. We’ve been working on this on a separate branch, which means it’s not really in the game build that you have access to right now.

At this moment, we have reached the milestone where we want to start implementing the first round of these features in the live project. This will probably take us a little while, as we want to play it safe by setting aside enough time for proper testing and implementation. Because of this, we might skip one of our patch releases that usually happens on the 1st of every month. We’re still going to release V12 on October 1st, though, so be ready for some new goodies. It will have the new Weather Forecast Building and a Season-Specific Engine Update. We changed how the season calculations and predictions work in order to give you a more accurate representation of what is to come and create more lifelike seasons. We are going to discuss this more at length in a future update.

These changes will also finally allow us to implement the load/save feature. While we have done a fair amount of background work on this, a lot of features are very dependent on one another (as mentioned previously), so we have more work to do before it’s ready to go. The Universim is a very complex project and we’re really excited to take it to the next stage. After all of these updates are done, we will start implementing new eras, research items, and so much more.

You can read a blog post below from one of our lead AI developers responsible for the smarter AI system and a lot of other nifty stuff.

Thanks again for helping us make the best god game ever!

THE NEW AI SYSTEM FOR THE UNIVERSIM

Author 
Bartek Dzieńkowski is a 
Ph.D. Student at the Wrocław University of Science and Technology


Artificial Intelligence is a subject that has always kindled the imagination. But when it comes to technical details, it can bore you to death (unless you are the one who talks about it). When folks hear AI, they imagine smart Nuggets who walk around trees instead of into them, rather than dense math and algorithms. We have decided to reveal to you some of the most heavily-guarded “secrets” of our new AI system, which Nuggets will receive soon. The description provided in this article should hopefully be especially interesting for other indie devs who are hungry for practical knowledge.

ARTIFICIAL INTELLIGENCE

To understand how a good AI is achieved, we need to clarify what it is. It is a field of science that brings a range of tools to solve everyday problems of the Nuggets:

  • Detecting the player/god’s cursor gestures to cast god powers (classification problem)
  • Running away from an angry bear (decision problem)
  • Making sure that the Epicenter doesn’t run out of resources (optimization problem)
  • Assigning jobs to Nuggets so they don’t starve in the future (planning problem)

Each class of a problem is solved using specialized methods invented by the nerdy science Nuggets. Although we are planning to solve each of the listed problems, the last two are especially important to us, because they are required to build a self-contained nation of Nuggets. The next part of the article covers what kind of magic it requires.


AUTOMATED PLANNING


One of the most popular approaches for solving AI problems in video games are based on Utility Systems, Behaviour Trees, and Finite State Machines. Without going into details, it can be said that they are simple and efficient in many cases. However, as the game grows, it is difficult to manage them as they require the developer to arbitrarily specify rules and parameters that will result in a desired behaviour of Nuggets.

Let’s consider this example: Once a new Eatery was built in the town, Nuggets become picky and stopped eating raw fruits from bushes. This triggered a high demand for processed food. All Nuggets, including the ones responsible for transporting new food to the eatery, started queueing for food at the eatery. Delay in food delivery worsened the crisis. Because of this unfortunate chain of events, all Nuggets died. It’s not a very happy ending.

The described case shows that even the Nuggets’ economy in the Stone Age can be a complicated system. For the devs, it is challenging to handle all links between objects and predict domino effects - especially when the game grows and evolves dynamically. Is there a better way to gain control over Nuggets’ minds? Rather than spending hours on tuning a number of parameters and hoping the economy will work as we want, we can explicitly define the desired outcome (like fill Nuggets’ bellies) and then run a clever method that will automatically find what should be done to reach that state.


The approach that is being introduced to the game involves Automated Planning. The idea that stands behind planning is quite straightforward. Imagine that you are playing chess and you try to predict what will happen if you make a certain move. Can you take into account all possible moves or predict the effect of more than two moves forward in the future? A computer program can and it uses a form of planning to do that. To avoid possible confusion, it should be noted that the common understanding of planning may differ from the technical term of planning in AI, which is defined as follows:

“Planning is the reasoning side of acting. It is an abstract, explicit deliberation process that chooses
and organizes actions by anticipating their expected outcomes.”
- M. Ghallab, D.S. Nau, P. Traverso: Automated Planning: Theory and Practice


Now, after we cited a wise book and you are still with us, we can give you more detailed information. First, a planning method builds a game state which is a structure holding data describing the current state of the game. Next, the method applies a set of possible actions in such a game state to simulate the future game states. The procedure is repeated until the method finds a game state that was defined by us as the goal. Finally, the routine returns a sequence of actions that must be executed in order to reach the goal state.

planning.png


Does it sound complicated? Then, let’s analyse this example: A Nugget is hungry. He can eat from a melon tree, go to the eatery, or grow a carrot. We define our goal as a fed Nugget, and run the planning method. The procedure simulates small actions like moving towards one of the food sources and using it. The method considers all opportunities to feed the Nugget and returns a solution with a minimal cost. The cost can be specified freely, but usually it is the time of reaching the goal. In that way, we make sure that Nugget will eat a melon if the eatery is empty or too far away. Alternatively, it can plant a carrot if none of them is available.

The described approach ensures that Nuggets make smart decisions, and since it is done automatically, we have more time to chew bubblegum and watch silly videos on youtube.


NEW DESIGN

In reality, implementing a planning system in a game is not that simple. Actually, it is challenging enough that not so many games have done it before. The reason for that is either you use an existing planning system or design a custom one - both options are equally terrifying.

Ready-to-use planning systems (e.g., SHOP2) follow a domain-independent fashion of defining planning problems. It means that they have a special syntax for describing the game state, actions, and search criteria. This would force us to convert the game rules into a language that such a planning system understands, and then retrieve a solution returned by the system. Because by default they don’t use domain-specific information, this makes them very inefficient. Of course, they can be tweaked, but they don’t offer enough benefits in exchange for problems with data conversion and consumption of computational resources, which is unacceptable.

A decision was made to design a new planning system for The Universim. Making such a system was an adequate task for a person who implemented similar ones in the past. In practice, it required making most of data structures cloneable and implementing A* algorithm that would process game states and actions on an abstract level. Such a planning system has direct access to data implemented for the game logic. Therefore, it does not produce unnecessary overhead computation. It also enables parallel computation and provides a high degree of flexibility.

The core of the system has been already implemented by Bartek (me!). However, a considerable part of the legacy implementation became incompatible with the new idea of handling AI. At the moment, we are deeply engaged in the migration process that involves moving (and fixing) parts of code to the new system. The majority of that cleanup process is being done by Grey (aka the Cheshire Cat’s grin). Let’s never forget who makes for us that dirtiest part of work.


FUTURE WORK

As previously mentioned, the new AI will lead to much more intelligent Nugget behavior. What is not obvious is that the planning system is general and can solve a range of optimization problems. It will be also utilized to handle urban planning in the long-awaited road system.

More details soon!
Do you like technical articles? Write what you want to learn about AI.

Thank you,
Crytivo Games Team.