Author Topic: OP2 Scenario Project for C#  (Read 18718 times)

Offline lordpalandus

  • Hero Member
  • *****
  • Posts: 780
Re: OP2 Scenario Project for C#
« Reply #125 on: September 22, 2019, 02:28:37 PM »
A few questions:

1. How does it decide to focus on building a specific combat unit. Ie should I build a laser lynx, a railgun lynx, or a starflare lynx? Each are similarly priced but each serves a different combat role. Or maybe decide to save up for a Laser Tiger instead?

2. What happens when no one focuses on military? Does no AI become proactive and start building a military or do they all stay in colony mode?

3. Do the AIs suffer from morale and thus from blowing up an enemy's Nursery and the massive morale penalty that follows? Or Morale in general, and thus the need to keep a food surplus, sufficient residences, or an active nursery/university?

4. Do the AIs spend any time on preparing for disasters? ie if an AI had resources for lava walls, would they build them to protect their base from getting melted?

5. Can the AI's people die? Either from starvation, or natural causes or unnatural causes such as a starflare blowing up their workplace?
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline TechCor

  • Jr. Member
  • **
  • Posts: 69
Re: OP2 Scenario Project for C#
« Reply #126 on: September 22, 2019, 03:50:14 PM »
1. How does it decide to focus on building a specific combat unit. Ie should I build a laser lynx, a railgun lynx, or a starflare lynx? Each are similarly priced but each serves a different combat role. Or maybe decide to save up for a Laser Tiger instead?

The combat manager creates a bunch of Threat Zones that contain priority targets. Each zone has an empty combat group assigned to it. The combat group's type (bomb squad, assault group, etc) is based on the type of zone (defend base, attack building, etc). The combat group's "desired strength" is set to something above the total enemy strength in that zone. The combat group then generates a list of unit slots base on the group type and desired strength. Each slot contains a list of "supported unit types" (panther laser, lynx supernova, etc).

The combat manager goes through the list of zones, assigns units that are already in a zone to that group's slots, if it fits. Then it assigns the remaining units to zone groups based on zone priority and whether the unit fits in the slot. Finally, the remaining empty slots are placed into a list (based on zone priority). This is grabbed by base manager when it starts its update and is processed by MaintainArmyGoal.

Right now, it picks the most important empty slot and randomly picks a supported unit type to build. If it can't build it, it will randomly pick a different type. This method has some issues such as not saving metal for more powerful units, and will need to be adjusted.

NOTE: All things combat related are not final!

2. What happens when no one focuses on military? Does no AI become proactive and start building a military or do they all stay in colony mode?

I want to tweak this formula, but the way it currently works, is that it checks all enemy players for combat units. It assigns an importance based on perceived threat. So for example, if all enemies have no combat units, it assigns a importance of about 0.5. If its combat strength is above the strength of each individual enemy, the importance drops lower than 0.5. If its combat strength is less than each enemy, its importance rises. I would like to add Advanced Lab and Vehicle Factory as bonus importance so that it doesn't wait until it's practically being whacked before starting.

When does it pursue building combat units? It depends on where the goal is in the priority list, and if it is being blocked by a higher priority goal. In a previous video, it built weapons right away because it did not need to research anything, and had plenty of metal. In the current one, MaintainPopulation blocked up the labs, preventing weapons research from getting done. It didn't start building combat units until MaintainPop finished all of its optional research. MaintainPopulationGoal is too aggressively important right now and needs to be tweaked.


3. Do the AIs suffer from morale and thus from blowing up an enemy's Nursery and the massive morale penalty that follows? Or Morale in general, and thus the need to keep a food surplus, sufficient residences, or an active nursery/university?
5. Can the AI's people die? Either from starvation, or natural causes or unnatural causes such as a starflare blowing up their workplace?

The AI runs as a human player, including all the pros and cons that provides. Disasters lower morale, people are needed to activate structures, food to prevent starvation, morale/nurseries/universities to grow population, training scientists to fill labs, etc.

4. Do the AIs spend any time on preparing for disasters? ie if an AI had resources for lava walls, would they build them to protect their base from getting melted?

AIs have no knowledge of disasters at the moment and would build in a lava flow if the mission developer put them in a poor location. They will attempt to recover from any disasters that don't kill them.
« Last Edit: September 22, 2019, 03:53:19 PM by TechCor »

Offline lordpalandus

  • Hero Member
  • *****
  • Posts: 780
Re: OP2 Scenario Project for C#
« Reply #127 on: September 23, 2019, 01:48:25 AM »
Ok cool. Thanks for the indepth replies. Here are some other questions:

1. Does the AI use group tactics, or just sends individual units to a spot? From watching the video, it seems each individual unit is sent to a spot.

2. Where on the list of priorities, does repairing damage fall in? ie a meteor hits a residence; does the AI prioritize resources to building lynxes to fight the enemy pounding on their turrets or do they spend their resources repairing the residence?

3. Similarly, will units use a Garage when damaged?

4. Or a better question, will units retreat after taking X damage, so that they might survive to return to repair?

5. How does the Ai handle earning enemy units via spider hacking? As the unit wasn't built, and its allegiance used to be another player...
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline TechCor

  • Jr. Member
  • **
  • Posts: 69
Re: OP2 Scenario Project for C#
« Reply #128 on: September 23, 2019, 02:28:44 AM »
1. Does the AI use group tactics, or just sends individual units to a spot? From watching the video, it seems each individual unit is sent to a spot.
Combat is not finished yet, but it will have group and individual tactics. Currently, groups stage outside a Threat Zone before entering, but it does not work properly at all. Group tactics are essentially "send this group of units to this zone through this path", individual tactics will be "ESG does not shoot structures", "starflares attack between groups of units", and "stay just out of range of enemy fire, if possible".

Quote
2. Where on the list of priorities, does repairing damage fall in? ie a meteor hits a residence; does the AI prioritize resources to building lynxes to fight the enemy pounding on their turrets or do they spend their resources repairing the residence?
AI prioritizes repairs to structures that have been critically damaged / disabled if it is required to complete another task. For example, if the task is to build a laser lynx, but the vehicle factory is crippled, it will prioritize repairing the factory. Same deal with tubing. If the residence was destroyed, cutting off tube access to the factory, it will prioritize reconnecting the factory. What gets repaired/reconnected/rebuilt first, if more than one building is crippled/disconnected/destroyed, is based on relative goal priority/importance.

There is a general purpose repair goal that does non-critical repairs. If repair units are not busy doing something else, and there is enough spare metal that other, higher priority tasks are not blocked, they will repair structures.

Quote
3. Similarly, will units use a Garage when damaged?
Garages have not been added to the task tree yet. They are not like other structures and need very special handling. It will likely end up as a separate goal.

Quote
4. Or a better question, will units retreat after taking X damage, so that they might survive to return to repair?
Combat is very rudimentary right now. I'd like to get them attacking properly before worrying about retreat/repair behavior. I think I have assault groups set up to take a repair unit for every 10th unit so they can repair during the assault, but individual tactics haven't been worked on yet.

Quote
5. How does the Ai handle earning enemy units via spider hacking? As the unit wasn't built, and its allegiance used to be another player...
No individual tactics yet. Spiders can't reprogram. Captured units, or combat units created by the mission developer, are processed by the combat manager like any other combat unit. Supported unit types for slots include both colonies. Cargo trucks, convecs, etc, are used by the base manager if it can find a use for them.

Generally speaking, any unit or structure that an AI gains possession of will be taken into account. A mission could spawn units and buildings out of thin air, and it will start using them.

Offline Crow!

  • Jr. Member
  • **
  • Posts: 72
Re: OP2 Scenario Project for C#
« Reply #129 on: September 23, 2019, 02:29:28 PM »
A bit off topic here, but someone should totally make a map based on that idea. Disable all weapons except for starflares, so the player is forced to defend with them. Then an AI can send wave after wave of their own tanks at the player's base.  ;)
Commander:
Our situation is dire.  We have spotted a fleet of what can only be described as bombs on wheels headed from Eden's base to ours.  Though we assigned our top scientists to defense projects months ago, they have squandered our resources on flights of fancy like "invisible lasers", "self-cleaning glue", and perhaps dumbest of all, a system that appears to simply be a joy buzzer dispenser.

Useless researchers notwithstanding, our vehicle factory workers can create a rough facsimile of the explosive weapons headed our way.  They may be the most awkward type of weapon imaginable for defense, but at this point we have no choice.

Remember, extinction is not an option.
« Last Edit: September 23, 2019, 02:32:20 PM by Crow! »
Speedruns, my FFIV game randomizer, and more can be found at my twitch page:
https://twitch.tv/iicrowii

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4811
Re: OP2 Scenario Project for C#
« Reply #130 on: September 24, 2019, 06:01:53 AM »
Lol


Well, I like that the AI can take control of any units that happen to get added to the game. It definitely sounds like this is going to have some pretty robust results.