HomeGamesUpdatesPricingMethodology
Steam News9 August 20232y ago

Developer Diary | Tech

Hey everyone! I’m Plankie and one of the programmers on Hearts of Iron. Large parts of my work consists of feature work, bug fixing, and general game improvements.

In this update1

Full notes

Full Hearts of Iron IV update

Read the full published notes in a cleaner layout. The original post stays linked below.

Repeated intro

Hey everyone! I’m Plankie and one of the programmers on Hearts of Iron. Large parts of my work consists of feature work, bug fixing, and general game improvements. My absolute favorite part of game development is working with the AI and trying to make it more fun and interesting and immersive to play with. So, in this week’s dev diary I’ll focus on showing how the AI interacts with one of our major new features: The International Market

What changed

0 fixes2 additions0 changes0 removals
  • Gameplay
addedHey everyone! I’m Plankie and one of the programmers on Hearts of Iron . Large parts of my work consists of feature work, bug fixing, and general game improvements. My absolute favorite part of game development is working with the AI and trying to make it more fun and interesting and immersive to play with. So, in this week’s dev diary I’ll focus on showing how the AI interacts with one of our major new features: The International Market
addedPutting things up for saleBefore anyone can buy equipment from the AI, it obviously needs to put equipment up for sale. Just like for a human player, it is only possible for the AI to add equipment to the market if it has a surplus of it. However, just because there is a surplus doesn’t mean that it’s a good idea to put all of that surplus up for sale. And if the surplus disappears and we start lacking equipment again, the AI should take the equipment off the market so it can use it itself instead. We basically want something like the following behavior:

On a very high level, there are a few things that the AI needs to be able to do in order to utilize the market:

  • Gain market access so that we can see what other countries have put up for sale

  • Sell equipment to others, i.e. putting equipment up for sale on the market

  • Buy equipment from others, i.e. decide what we want to buy and how much

It also needs a surplus of equipment to sell, but fortunately the AI already knows how to produce equipment, so that just needs a little bit of tweaking!

The basis of the AI’s behavior on the International Market is the surplus/deficit it has of different types of equipment on the production stockpile (you know that list of equipment you see under the logistics tab). In general, it will try to buy equipment it has a deficit of and will offer to sell equipment it has a surplus of. This base behavior is then modified by other factors, such as AI strategies.

The familiar logistics tab showing what equipment is available on the production stockpile. The right-most number showing surplus/deficit is an important component of how the AI interacts with the International Market.

Putting things up for sale

Before anyone can buy equipment from the AI, it obviously needs to put equipment up for sale. Just like for a human player, it is only possible for the AI to add equipment to the market if it has a surplus of it. However, just because there is a surplus doesn’t mean that it’s a good idea to put all of that surplus up for sale. And if the surplus disappears and we start lacking equipment again, the AI should take the equipment off the market so it can use it itself instead. We basically want something like the following behavior:

  • If we need the equipment ourselves, don’t sell it

  • If we have a lot of surplus equipment, start selling some of it, but not all of it

The problem is that we need to define how much “ a lot ” is so we know when to start putting the things up for sale. This could depend a lot on what type of equipment it is and what situation our country is in. We could do something simple and say that “if we have a surplus larger than 200, then start selling”, but 200 infantry equipment and 200 strategic bombers are on completely different scales so using absolute numbers is not a good idea. But manually having to define the numbers for different equipment types and situations and countries also means a lot of work and balancing, so we at least want some good default behavior with a possibility of tweaking it.

In one of the first iterations of the market AI, we just made it put a certain ratio (say 20 %) of its surplus equipment up for sale. Despite the simple approach it worked pretty well, and since it’s simple it’s also easy to understand and debug. It had some shortcomings

Source

Steam News / 9 August 2023

Open original post

Changelog.gg summarizes and formats this update. How we read updates.