Author Topic: Active Alien Geoscape AI - has anyone ever taken a stab at this?  (Read 31219 times)

Offline Slaughter

  • Colonel
  • ****
  • Posts: 282
    • View Profile
Has anyone ever tried to take on alien geoscape AI - as in, the aliens acting and reacting to human behavior on the geoscape.
And by that, I mean (mostly) things like aliens fighting an active air war and attacking your Interceptors and Skyrangers?

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #1 on: June 02, 2016, 05:41:29 am »
I've suggested this in the past but so far no one has picked it.

Things like having to escort the Skyrangers on their way to and back from a mission. UFOs set to patrol specific zones, like the airspace around mission sites or alien bases.

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #2 on: June 07, 2016, 12:19:13 am »
I'm working on a prototype for better adversary simulation for geoscape.

My motivation is that Piratez factions' actions in geoscape look even more ridiculous than vanilla game's aliens', to the point I can't play Piratez in geoscape any more. So the prototype aims at supporting a believable simulation of multiple factions mostly zooming around minding their business, but occasionally clashing, or banding together against some other faction or the player.

I want tens to hundreds of flights in progress, deeper detection simulation, escorts, hostile interceptions, and  reasons why all this is happening. For the first step, something barely looking as living, ala the enemy in c64 ROBB will suffice.

This will also show what changes would be needed to the OpenXCOM itself, since the current alien mission implementation there just cannot support anything fancier than a bunch of random stuff happening randomly plus a retaliation or two. Emulates the original faithfully, great work, but the original was very limited. So it has to be extended, and it is completely unclear how.

That is why the prototype is being developed completely separate from the openxcom codebase, sharing only the data.

Also, traditional geoscape view is not really suited to debugging such sims, so I currently use half-baked 2D Miller cylindrical projection map like they use in space mission control, generated from the geoscape data, to see the whole world at once.
(Polar regions are mostly unusable, but I hope to get the north-south scrolling to work).

No idea if the map even has a chance to getting into OX, but it is sure easier to keep track what's going on.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #3 on: June 07, 2016, 01:47:10 am »
This will also show what changes would be needed to the OpenXCOM itself, since the current alien mission implementation there just cannot support anything fancier than a bunch of random stuff happening randomly plus a retaliation or two. Emulates the original faithfully, great work, but the original was very limited. So it has to be extended, and it is completely unclear how.

Hm? With the current missionScripts you can have a lot more than 'random stuff happening randomly plus a retaliation or two', unless you mean some specific features that you'd like to be implemented.

Offline Slaughter

  • Colonel
  • ****
  • Posts: 282
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #4 on: June 07, 2016, 02:47:39 am »
Stoddard if you implement this you will be a saint.

If it can be dynamic then even better.

I'm imagining the start being like vanilla, with UFOs just doing their thing and minding their bussiness and laughing at puny humans and their puny jets and radar.

Then in month 2 or 3 they start sending UFOs to escort vessels, or even do Close Air Patrol missions near mission sites.

Late-game it would probably be sending battleships in groups to patrol and attack everything flying nearby, doing so to obtain total control of worldwide airspace.

Btw, how would Reverse-Interception work?

Enviado de meu SM-G3502T usando Tapatalk
« Last Edit: June 07, 2016, 02:53:18 am by Slaughter »

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #5 on: June 07, 2016, 02:51:50 am »
Hm? With the current missionScripts you can have a lot more than 'random stuff happening randomly plus a retaliation or two', unless you mean some specific features that you'd like to be implemented.

Current code does it like this (github.com/SupSuper/OpenXcom@a617d7c):

Code: [Select]
void GeoscapeState::time1Month()
{
    _game->getSavedGame()->addMonth();

    https:// Determine alien mission for this month.
    determineAlienMissions();
    ...
}

void GeoscapeState::determineAlienMissions()
{
    ...
    https:// level four condition check: does random chance favour this command's execution?
    if (process && RNG::percent(command->getExecutionOdds()))
    {
        https:// good news, little command pointer! you're FDA approved! off to the main processing facility with you!
        success = processCommand(command);
     }
    ...
}

bool GeoscapeState::processCommand(RuleMissionScript *command)
{
    ...
    https:// more randoms here ...
    ...
     mission->start(command->getDelay());
    ...
 }


So there goes any possibility of a hostile intercept, for example. The code gets called once a month.

I accept than on the timeframe of a year  the mission set is not entirely random and it is possible to see some correlation to player actions. But inside a month or two it quite is, which is what I wanted to say.

I didn't even begin to write down what I want to accomplish besides the vague idea of much more stuff happening on the planet, adversaries actions being much more clearly attributable to either their agenda or player's actions, and player having much more visible impact on adversaries' strategy. The only clear thing is that the current code just doesn't cut it, and that I have no idea what would be required of any future code.

So I hack around. Maybe something will come out of it.




Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #6 on: June 07, 2016, 03:02:59 am »
As for hostile intercepts, well, I imagine there would be some means for adversaries (aliens,  bought-out governments, etc) to detect the flights and to dispatch intercept missions against player craft. So the player won't be able to send lone transports all over the world with impunity in mid-late game. I thought about making inter-base material transfers a separate mission that can be shot down (but are faster than standard 24-48-72 hour transfer).

The logic would have to run at minimal - 5sec intervals, plus some modding to grant the detection ability and UI to tell the player that he's being intercepted. Nothing quite impossible, just a big bunch of workfun.

Offline Cooper

  • Colonel
  • ****
  • Posts: 151
  • Chryssalids are awesome
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #7 on: June 07, 2016, 05:19:02 am »
Active Alien Geoscape AI would be awesome, and make a not so interesting part of the game a lot more fun! Would also make it more interesting to create a mod where you attack Mars.

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #8 on: July 06, 2016, 12:14:54 am »
Since it's been a month already, time for an update.

I had the custom map projection working at the beginning, drawing continents, borders, cities, labels, bases, craft markers, radar ranges, missions and their areas.

Now instead I have a mod loader that correctly loads and merges the OG ruleset and all the mods enabled in the options plus loading whatever resources that might be needed for the geo/basescape. So that the whole thing would work with whatever modset one prefers.

The modloader itself might be useful for finding stupid errors and typos while modding, it has some basic consistency checks and is verbose about them. Many more can be added (I don't really know what might be useful).

Next step would be to redo the renderer to a) drop SDL_gfx in favor of GLES/GLSL (SDL_gfx is no good, I could actually see the triangles being textured at each redraw) and b) switch  between original (orthographic)  and arbitrary cylindrical (miller, mercator, whatever) projections at will. Horizontal ( logntitude-wise) scrolling worked already, it will be grandfathered in. Vertical (latitude-wise, as when one wants to take a look at the pole) scrolling in cylproj mode will be done too.

After that the whole OG mission logic will be reimplemented, to a) learn how it works down to the last detail and b) see what's the best way forward for the new AI API so that it can be turned on and off at will (depending on a mod).

Detection/Intercept UI will be reimplemented at this stage too, starting with OG's one, to see exactly how inadequate it gets given massive increase in flights detected.

It might further be necessary to do the basescape, so that the whole project gets to be a semi-playable half of a game, without the battlescape (tactical mission results decided by RNG plus maybe some function defining abstract strengths of opposing squads, taking into account terrain, races, geoscape-level morale, whatever).

If all that leads somewhere, there would be a fork of Meridian's tree with the new AI support. That's the long range goal.

These are the plans.

I'll be putting up the code on github shortly, I have to whack the SDL_gfx graphics code into shape so that it at least displays something again. Just a question of adapting the draw code to the modloader API from an ad-hoc one.


Offline Slaughter

  • Colonel
  • ****
  • Posts: 282
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #9 on: July 10, 2016, 09:23:09 pm »
I can only understand half of your tech details but yet they are very interesting!

Seems like your sainthood miracle is soon a go!

From one modder to another - fantastically done!

Enviado de meu SM-G3502T usando Tapatalk


Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #10 on: July 15, 2016, 11:48:09 pm »
Thank you.

Here goes an example of 2D map, that's X-Piratez mod, but it should work for any mod out there.
Note that the radar circles are all of the same 800 nmi radius.

SpoilerEPSG:54003 - World Miller Cylindrical:

The modloader works, projection/renderering sort of works.

The code is at https://github.com/StoddardOXC/minicom

Next step - original mission mechanics, I don't want to dive into GL right now.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #11 on: August 19, 2016, 05:58:08 pm »
Stoddard, any progress on this?

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #12 on: August 20, 2016, 12:36:10 am »
Yup, factions launch intercepts if you fly too slow / often near a city. Makes bulding the first base in a populated area a bad choice :)
Just this evening  I made nearby craft assist each other, very hacky, but it turned the regular 'secret base' hgunship/frig/cruiser swarm from a turkey shoot megascorp hunt into an omg gtfo moment, baracudas and dragons nonwithstanding. The can't disengage if your speed is too low feature I like the most.

I'm working on UI side of this. 4x4 dogfights just might be possible without drastic changes, but i'd like to go beyond that. No idea how though.

I wonder, what all the comments like

https:// Set UFO size - going to be moved to Ufo class to implement simultaneous dogfights.
(DogfightState.cpp)

are about? Was there some abandoned work on this? I'd hate reinventing more wheels than abs necessary.


Current version is a scrapheap, and also kills fps on anything above 5 minute rate. Only works on linux too,
but i'm getting there, yeah!

Economy stuff took the farthest seat for now.

EDIT:
also, the cylindrical map worked for some time alongside the game in a separate window, but got bitrot as it's not really needed right now.
« Last Edit: August 20, 2016, 12:48:43 am by Stoddard »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #13 on: August 20, 2016, 01:05:17 am »
Yup, factions launch intercepts if you fly too slow / often near a city. Makes bulding the first base in a populated area a bad choice :)
Just this evening  I made nearby craft assist each other, very hacky, but it turned the regular 'secret base' hgunship/frig/cruiser swarm from a turkey shoot megascorp hunt into an omg gtfo moment, baracudas and dragons nonwithstanding. The can't disengage if your speed is too low feature I like the most.

I'm working on UI side of this. 4x4 dogfights just might be possible without drastic changes, but i'd like to go beyond that. No idea how though.

Oh, this sounds really interesting. I suppose the alien bases could also be set to launch interceptions?

The reason I asked has to do with some experiments I've been making for a possible new mod project set on the Terminator series and this feature would fit like a glove since right now I'm looking to make the Geoscape a little more active:



Each of the different letters is a type of Skynet base. Bases generate Aerial Hunter-Killers (UFOs) which perform regional missions: Supply, Retaliation, Infiltration, Research etc. Each different base type generates different missions:
* H bases generate additional bases of type B or C or Supply missions
* I generates Retaliation/Infiltration/Supply missions
* L generates Abductions/Harvest/Supply missions

Or, if there was instead an 'Interception' alienMission, it could be assigned to base type I, or a base type specifically dedicated to Interception and it would be run several times in a month, and even set specific patrol areas using missionZones.

But alien bases launching automatically interceptors works too.
« Last Edit: August 20, 2016, 01:10:25 am by Hobbes »

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Active Alien Geoscape AI - has anyone ever taken a stab at this?
« Reply #14 on: August 20, 2016, 01:45:28 am »
Oh, this sounds really interesting. I suppose the alien bases could also be set to launch interceptions?

But of course. Cities are there only because there's much more of them currently than the bases, and it fits xpiratez lore, which I understand assumes there's big faction presence in cities.



Each of the different letters is a type of Skynet base. Bases generate Aerial Hunter-Killers (UFOs) which perform regional missions: Supply, Retaliation, Infiltration, Research etc. Each different base type generates different missions:
* H bases generate additional bases of type B or C or Supply missions
* I generates Retaliation/Infiltration/Supply missions
* L generates Abductions/Harvest/Supply missions

Or, if there was instead an 'Interception' alienMission, it could be assigned to base type I, or a base type specifically dedicated to Interception and it would be run several times in a month, and even set specific patrol areas using missionZones.

But alien bases launching automatically interceptors works too.

That's really nice.

I didn't start yet on how all the activity will be guided by rulesets really. Currently it's like GCI, in addition to regular missions, if the code decides you're detected, and random gods wink so an so (to be tied into craft availability), it spawns an ufo and guides it to the target, no connection to existing AlienMissions.

As it is, the only AlienMission that resembles interception a bit is the base assault, and it is so hardcoded, that it's useless as a model. So something else will emerge. Currently I'm reassigning missions from ufos to flights of ufos, so that the dogfight UI will have some uniform place to fetch info from.