Tactical AI Notes

One of the things I’ve been working on lately is the tactical AI. I wanted the AI to be better at coordinating attacks. The image above shows pathway and timing information created by the AI. (The numbers in tenths of a turn, so “17” means “1.7 turns”.) In this image, an infantry is being picked up by a transport in about 1.7 turns, rides inside the transport until around turn 5.7 and then moves into enemy territory. The timing information is useful for coordinating multiple units – so that it’s better at bringing all its transports simultaneously, moving combat ships into the area to protect transports, etc.

Random Game Ideas: AI Personalities and Technology

I’ve been kicking around two ideas on the game lately.

The first one is that I’d like to create some better defined personalities for AI players. Maybe some AI personalities would be easy AI players, while others would be expert AIs. For example, maybe one AI player could be bold and swift. He tends to leave fewer defenders around when he goes for an invasion, choosing to rely on “the best defense is a good offense”. Maybe he feigns attacks, and then attacks elsewhere. A different AI personality would be more cautious and chooses to attack when he’s got his own territory well protected and he’s very likely to succeed in an invasion. The idea is that each the AIs personalities would have more defined styles of play.

At first, I thought maybe there would be some “best” AI personality. And why not use the best one all the time? For one thing, that’s not very exciting because it lacks variety. If there’s one excellent AI and two good AIs, it might be good to add all three of them to the game. Even the uncertainty over which type of AI you’re playing against could put the human player at a disadvantage because he doesn’t know exactly which strategy to use against them, and can’t anticipate what types of moves the AI will use. From that perspective, not only would a handful of AI personalities be more interesting, but the mixture might make it more difficult for human players to win the game, as well.

Players who are setting up scenarios could even set different nations to use particular personalities – to mimic the historical situation. (Example: I want the leader of this nation to be cautious. I want the leader of that nation to be daring, quick, and unpredictable.)

The second idea I’ve been kicking around lately is an idea about redesigning the technology system. (I’ve actually been kicking around this idea for a long time, I’ve just never implemented it.) Right now, players upgrade along a predictable path from unit A to unit B. But, what if there were a whole bunch of technologies with levels. For example, what if there was an “armor” technology and an “engine” technology and a “cannon” technology? Players could decide to create a new type of tank. They’d spend some time and money on a new tank design, and they’d be allowed to specify what types of attributes they wanted it to have. For example, they want a heavy tank with good firepower. Or maybe they want a light, fast tank that is cheap to build. They’d then spend some money, and based on their nation’s technology sophistication and some randomness, they’d have a new tank design a few turns later. The tank design might vary in quality and price. Maybe it performs badly in certain types of terrain. Maybe it’s a very good tank for the level of technology that player has. The player could then decide to build it. The key thing here is that tank designs would vary in terms of their attributes. Players would have to decide whether or not the design should be used or scrapped.

Because other players are doing the same thing, each nation has units of different quality and attributes. Players have take that into account when going to war against other nations. It would also mean that players have to adapt their strategies to the current game. They might’ve had good tanks in the last game they played, but poor tanks in this game. Or, they might’ve had good tanks 50 turns ago, but technology in the game has progressed, and they haven’t funded their tank technology enough to keep up with the latest designs.

I could see this system being used with all the different units in the game: infantry weapons, tanks, aircraft, etc. Maybe the player could get a chance to research some anti-armor weapons and they’d come up with something like an RPG. Maybe the player needs to field test some designs to see how well they work in actual combat. I could imagine some of the attributes being things like: attack/defense numbers, movement rate, movement rate on different terrains, movement range (for aircraft and missiles), production and resource cost, maintenance costs, etc.

It might also be interesting to vary the costs and research time of technologies each time the game is played. Players would have estimates of the time and cost of researching a new technology, but it’s not exact. Some technologies in the real-world seem like they’re not far off, but they never seem to arrive. (Example: Fusion power.)

It would be nice to add tactics into the system as well. For example, some technologies are good for a while, but your opponent learns some new tactics and reduce its valuableness. Or maybe some of your technologies are given a boost because you learn tactics that improve its usefulness. Tactics are something that would be improved and refined through combat experience. Maybe if the player has military academies, they learn new tactics more quickly. The longer a war drags on, the more time the enemy has to learn tactics that mitigate your technologies.

Two Months Since Release: 129 Items Added or Fixed

It’s been a little over two months since the game’s release. I’ve been pretty happy with the number of things I’ve accomplished since the release, including doing updates at least once a week. Here’s a list of 129 Items (Suggestions or Bug-Fixes) that have been added to the game since its launch:

Version 1.01.3737, January 26, 2009
– Fixed a bug that caused turn-processing to run very slowly (in one case, the time dropped from 67 seconds to 2.7 seconds)
– Added additional information to the city-build window
– Added the Pangea map-type to the New Game window
– Fixed a display bug with radar lines
– Fixed a crash
– Fixed a bug with city-population growth
– Removed the city ‘anchor’ icon and replaced it with a blue number indicating the number of city improvements.
– Fixed a display bug with the technology tree
– Fixed an issue with aircraft combat

Version 1.01.3118, January 18, 2009
– Fixed a crash
– Fixed the washout bug
– Faster draw system (about 20% faster)
– Added “Pangea” to the Map Editor, but not the New Game window because the AI seems to run slowly on Pangea maps (will be fixed in the next update)

Version 1.01.2818, January 11, 2009
– Border Violation bug: The AI should not detect units inside transports
– The AI won’t complain about submarine border violations unless he actually saw the submarine
– “Sightings” list now shows the unit-name, rather than just “Sighted”
– Fixed some problems with the AI that caused it to consume lots of memory on large maps
– Adjusted ship/submarine combat balances
– – Some of the changes
– – – Reduced Battleship->Submarine power, Increased Battleship->Ship power
– – – Slightly reduced Cruisers->submarines power, Increased Cruiser->Aircraft power, reduced the cost of cruisers by 7%
– – – Increased Destroyers->Submarines power, reduced the cost of destroyers by 10%
– – The end result is that ships have more defined roles
– – – Destroyers->Submarines (good), Destroyers->Ships (fair), Destroyers->TacticalAircraft (fair)
– – – Cruisers->Submarines (fair), Cruisers->Ships (fair-good), Cruisers->TacticalAircraft (good)
– – – Battleships->Submarines (poor), Battleships->Ships (good), Battleships->TacticalAircraft (fair/poor)
– Satellites move faster now
– Fixed problem with Battleship bombardment (can’t target) and artillery bombardment (can’t target some enemies)
– Added a ‘random’ option to Game Setup > Land Density
– Added a ‘random’ option to Game Setup > City/Resource density
– Cities could see submarines out to a range of 60. Changed this – cities cannot see submarines by default anymore
– Fixed a bug in the Map Editor that was switching to the wrong player
– Added some debug settings to the Preferences Window to help track-down the washout-bug
– Fixed a crash that occurs when you change the “View As” setting
– Added a flag to the map-tooltip (important when hovering over a yellow-diamond and you can’t see the unit)
– Fixed a bug that caused aircraft unit-groups to ignore field orders

Version 1.01.2609, January 4, 2009
– When the AI sends a “violating my borders” message, it will tell you exactly which units are violating its borders
– Reduced the amount of memory used by borders
– Fixed a bug that would cause the AI to falsely complain about border violations
– Fixed a bug with the rules-editor that could cause the game to crash
– Players can see other players borders if they are near their own borders
– Fixed a crash during Turn-Processing. It’s related to expired TradeAgreeements

Version 1.01.2459, December 31, 2009
– Fixed bug: Sometimes the city-build window wouldn’t appear, causing player to think the game locked up
– Added Borders
– – Borders are created automatically, based on cities and resources
– – The AI gets irritated if you violate his borders
– Fixed a crash during turn-processing
– Fixed a lockup during turn-processing
– Adjusted some things on the MapEditor interface to make map< ->scenario more obvious
– Aircraft can be given more complex (move to, land, move to, land) orders
– Added ‘sentry for five turns’
– Units which are set to ‘sentry until repaired’ will not attack enemies based on field-orders
– UnitGroups can be given orders to ‘sentry until repaired’ (until all units inside the group are repaired)
– Repairs cost iron. The iron cost is equivalent to the original iron cost (e.g. a ship at 50% damage will require 50% of the iron that it cost to build it originally).
– Fixed bug: AI was not accepting trade agreements

Version 1.01.2038, December 23, 2009
– Fixed bug: sometimes the ‘trade window’ doesn’t allow players to enter numbers
– The game-setup window now let’s players individually adjust land-density, cities, gold, iron, food, and oil abundance.
– – This applies to random maps and custom maps/scenarios.
– – Added the same feature to the map-editor’s random map generator tool.
– Changes to the AI:
– – Now, the AI can experience resource shortages
– – Fixed a bug that was causing the AI to be too passive
– – Added more behaviors to the AI to make it smarter
– Nukes automatically trigger war
– Added ability to turn-off the ‘low oil’ warning on the cursor (in the preferences window)
– Made adjustments to the pathfinding system to (hopefully) avoid the ship-beached-on-land problem
– Fixed problems with satellites:
– – it sometimes showed the wrong time until crash
– – they were jumping to their target location after launch
– Fixed bug: Sometimes if aircraft land at the very end of a turn, they are not refueled
– Fixed a bug with food-shortage starvation
– Added warning popups that appear if you try to submit your turn and you’re about to have a resource shortage.

Version 1.01.1609, December 17, 2009
– Reduced memory use
– – Reduced memory-use by 20% or more when playing the game
– – Save-game files are about 35% smaller (which also means faster loads/saves)
– Faster AI
– – In one test case involving a 4000×3200 map and 5 AI on turn 110, the AI processing time was halved
– Fixed bug: Nuclear Bombers running out of fuel/not destroying target
– Altered the AI to reduce wolfpack attacks (where players jump in and attack players already at war)
– Fixed bug: Game sometimes crashes after forming a team
– Added “oil shortage/low oil” icons to the cursor, and a warning message when submitting turn

Version 1.01.1203, December 11, 2009
– An upgrade order no longer turns-off ‘sentry’.
– Added a “70% Population” Victory condition
– Improved the trade window interface
– – The interface splits immediate-trade and ongoing trade
– – Allow per-turn open-market trade
– – The AI gives more feedback on trades
– – You can improve foreign relations with the AI by giving generous trade agreements or gifts
– Fixed bug: Can’t cancel ongoing trade agreements
– Fixed a bug invoving the production money in cities without orders
– Small decreases in memory use and AI processing time
– Removed ‘Freighters’ from the Field Orders list
– Fixed bug: The Foreign Relations window showed the wrong information if you’re not Player 1
– Fixed bug: Saved Games don’t remember the ‘sneak attack’ state
– Fixed bug: Infantry UnitGroup cannot capture a neutral airfield
– Added a “Full” icon to transports/carriers when they are full
– City list is sorted from highest-production city to lowest-production city

Version 1.01.777, December 5, 2009
– Fixed bug: The scenario editor forgets player restrictions if you edit the map-setup settings.
– Fixed bug: Players were allowed to do per-turn open-market trades
– Added a page to the game-manual for the “Unit Description” window.
– Bumped up the version from 1.0 to 1.01 because it was triggering a bug that users weren’t being automatically notified of updates
– Fixed lockup (turn processing never ends) that can happen when sending Units to join a UnitGroup
– Fixed bug: sometimes unit-groups cannot target enemies
– Improved some things with unit-groups and orders, to make it more intuitive
– Fixed bug: National Summary information was wrong if you weren’t Player 1.
– Added “Show All Paths”/”Show all Orders”, and a hotkey (K)
– Fixed bug: Nuclear Bomber was showing up on the idle-units list even though it had orders
– Thumbnails are automatically added to map/scenario uploads
– Fixed a bug in the download system – only the first paragraph of the “Description” section was showing up
– Fixed a lockup during Turn Processing

Version 1.0.613, December 2, 2009
– If a city has a “Produce Wealth” order, and you select a new build item, “Produce Wealth” is automatically removed from the queue
– Fixed bug: Problem moving ground unit that was next to water
– Fixed bug: Sometimes units don’t capture resources
– Fixed bug: Aircraft can’t land on moving aircraft carriers
– Fixed bug: Sometimes sea-units cannot move into/out-of certain coastal cities
– Fixed bug: Certain units (air-units that self-destruct) were not showing up on the “idle units” list (this was by design, but I decided to change it; players can just hit ‘sentry’)
– Changed some code around to hopefully avoid crashes
– Fixed the crash that occurs if you try to pickup an air-unit from a city
– Fixed a problem with AI technology research
– Tweaks to the AI to make it more active

Version 1.0.461, November 29, 2009
– Fixed some memory leaks, reduced memory use
– Faster AI
– Players can now see how many people are in the chatroom from the main-menu
– Players can tag others as friends, and see if they are in the chatroom from the main menu
– Thumbnail images on the ‘Downloads’ tab (inside ‘Updates and Downloads’). This isn’t fully functional yet, but you can see the Europe and Mediterranean thumbnails.
– Fixed a variety of bugs related to unit-repair and “sentry until repaired” orders
– Fixed a crash that occurs when loading certain files. Error in a compression algorithm.
– Fixed bug: Aircraft in aircraft carriers sometimes show up in ‘idle units’ list even though they have orders
– Fixed bug: Sometimes aircraft won’t move if they are given orders to move to nearly their maximum range