aliens

Author Topic: Random thoughts on external AI  (Read 9520 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9056
    • View Profile
Re: Random thoughts on external AI
« Reply #15 on: September 26, 2018, 10:38:34 am »
I already answered, that if OpenXcom does the hard job of precalculating everything for the neural network then yes, it won't need that many.

The neural network doesn't need to deal with individual pixels, merely objects and the details of those objects.

Don't "details of those objects" include each voxel (and more)? :)

though then each needs to recognize what object is there, what facing that object has (if any), what objects it can see, and what objects can see it.

Which it could either do on its own, based on those 176 million voxels...
... or let OpenXcom do the hard job for it.

PS: I'm not saying this thing is unthinkable... I'm saying that it inevitably requires a LOT more effort on OpenXcom side than "just calling" some random external engine.

EDIT: I've split the discussion into a separate topic
« Last Edit: September 26, 2018, 10:43:37 am by Meridian »

Offline Whispers

  • Sergeant
  • **
  • Posts: 42
    • View Profile
Re: Random thoughts on external AI
« Reply #16 on: September 26, 2018, 11:11:42 pm »
They way most modern neural networks work is by defining training data and then building networks of decision trees. I've dabbled in some tensorflow network designs, and it takes a long time to get used to how it works, and get your mind wrapped around a lot of the concepts. However, someone with some experience could easily build a network in a few months time.

At it's most basic level, the neural network has a series of points to spend. Time Units are the currency of the game in Battlescape. Because of which, it actually becomes easier to define the network. You can spend those points by moving, attacking, throwing, or various other things, but it's still just a currency. Now, selecting the right thing to spend that currency on is the trick. First, you develop a hierarchy of networks. One for scouting(when no enemies are seen), another for attacking(for when an enemy is spotted), and maybe another one for retreating(for when forces are too strong), and perhaps a fourth one for regrouping. You train each of the sub-networks in isolation, then combine them for a more strategic AI that oversees it all.

For scouting, you define the success of the network by it's ability to find each enemy, and weigh that against defensive metric(have they ended up in a spot with a good defence ability, like behind a wall or in some smoke). For attacking, the success criteria is a lot easier, kill everything with minimal damage to your own units. For retreating, you have to get your units back to a point without killing them. And finally, for regrouping, the success depends on the ability to get everyone to a point with some defensive ability. Once you've trained each of the individual AIs, then you can easily train a strategic AI.

All of this is months and months of work. I won't have time to do this, but someone with some more interest in this could do it.

Offline Yankes

  • Commander
  • *****
  • Posts: 3328
    • View Profile
Re: Random thoughts on external AI
« Reply #17 on: September 26, 2018, 11:46:23 pm »
https://www.youtube.com/watch?v=GOFws_hhZs8
Probably good introduction of genetic algorithms that are closely related to networks and AI.

KZad Bhat

  • Guest
Re: Random thoughts on external AI
« Reply #18 on: September 27, 2018, 08:23:51 am »
No, you do not need information on each individual voxel to give that information. In fact, all of those states can be the same, but if you apply a different image, you've not created a completely new set of inputs that are unnecessary, because nothing has actually changed as far as AI is concerned.

Yes, there could be ways of having OCX or its branches package the information in more useful ways, but off-hand the best I can think of is to report to the neural network the placement of objects, rather than the pixels representing them. Especially, if this is meant to develop a more effective AI algorithm, it's better to have the neural network processing exactly the information that the AI engine will be dealing with anyway. Since the AI engine is not looking at pixels/voxels (I really hope it isn't), no need to waste time having the network look at them either.

In fact, it may turn out that tying it each individual block and having those 108,000 neurons is not nearly the most efficient method of handling it. Perhaps an input just for each actor, or at most the visible blocks of each actor, again similar to however the AI engine already processes it. However the tech developing the network's processing sheets finds most effective, I don't know, but he almost certainly won't be looking at voxels, not for this part.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9056
    • View Profile
Re: Random thoughts on external AI
« Reply #19 on: September 27, 2018, 10:08:20 am »
Especially, if this is meant to develop a more effective AI algorithm, it's better to have the neural network processing exactly the information that the AI engine will be dealing with anyway. Since the AI engine is not looking at pixels/voxels (I really hope it isn't), no need to waste time having the network look at them either.

The current AI spends 99% of the processing time looking at voxels, calculating LOS and LOF.

The actual decisions (after all voxel calculations prepared the possible options) are just a few ifs and a few dice rolls, taking zero time.

Yes, there could be ways of having OCX or its branches package the information in more useful ways, but off-hand the best I can think of is to report to the neural network the placement of objects, rather than the pixels representing them.

OpenXcom is not Xcom2012.... it cannot shoot through walls and solid objects.
Just a placement of an object is not enough to do anything in OpenXcom.
« Last Edit: September 27, 2018, 10:15:49 am by Meridian »