Jump to content

The new guy: A.I. Developer #42 & Discussion on A.I.


Recommended Posts

Hi GJ, I am newly registered to this forum but I follow your posts with interest, as I am very eager to lay hands on Xenonauts. I have seen that apparently you seem somewhat concerned by the duration of the Hidden Movement phase, and that the amount of calculations involved by your AI are quite large, and if handed carelessly, it would dramatically affect the game. I was wondering then, if there is a way you could use the sheer amount of idle time during the player's turn to make some precalculations for the enemy, prechecks or whatever. Something similar to what a good player makes at chess.. where he's not only thinking during his turn, but at the opponent's turn as well.

Since the system requirements during a player's turn in ground combat are quite low, and there are lots of idle moments, some computer power might be used to perform precalculations for trayectories, options or strategies. Later, when the End Turn button is pressed, it would be the time to finalize/adapt those precalculations to the actual situation, instead of starting everything from scratch right after pressing the button.

I don't even know if that would be feasible within the game engine and structure, but I am sure it would go far to optimizing the computer strategy. After all, a human player is quite slow and there is quite a lot of free computing time between key presses, even if we had the fastest fingers and mouse movement in the world!

Good luck and good job, btw

Link to comment
Share on other sites

I was thinking about the hidden movement thing, and I was wondering why the Jagged Alliance 2 model isn't an option? In JA2 the camera position froze on hitting end turn, and was automatically moved to show enemy movement. Also, the way that sound is presented would be less confusing as the camera would center on the soldier that hears the sound (footsteps, gunshots, whatever) and a small text would appear that says something along the lines of "soldier X hears a faint sound of footsteps coming from the north". I rather liked how they handled that in JA2, and it is clearly preferable to the hidden movement screen.

Link to comment
Share on other sites

... I was wondering then, if there is a way you could use the sheer amount of idle time during the player's turn to make some precalculations for the enemy, prechecks or whatever. Something similar to what a good player makes at chess.. where he's not only thinking during his turn, but at the opponent's turn as well..

Quite correct; and a part of these precalculations (the value maps) I am currently rewriting as a multithreaded model which works parallel in the background during the players turn.

So actions of the player are handed over to a separate thread working on the background, continuously updating the AI belief model. Once the turn of the A.I. player starts, it first checks whether all those belief systems have been updated before starting calculation.

Jagged Alliance Camera System

Do you maybe have a youtube link to a gameplay example of this?

Link to comment
Share on other sites

Quite correct; and a part of these precalculations (the value maps) I am currently rewriting as a multithreaded model which works parallel in the background during the players turn.

So actions of the player are handed over to a separate thread working on the background, continuously updating the AI belief model. Once the turn of the A.I. player starts, it first checks whether all those belief systems have been updated before starting calculation.

Very clever.
Link to comment
Share on other sites

I was thinking about the hidden movement thing, and I was wondering why the Jagged Alliance 2 model isn't an option? In JA2 the camera position froze on hitting end turn, and was automatically moved to show enemy movement. Also, the way that sound is presented would be less confusing as the camera would center on the soldier that hears the sound (footsteps, gunshots, whatever) and a small text would appear that says something along the lines of "soldier X hears a faint sound of footsteps coming from the north". I rather liked how they handled that in JA2, and it is clearly preferable to the hidden movement screen.

Clearly preferable to you yes.

I clearly prefer the hidden movement screen, each to their own.

Link to comment
Share on other sites

"Do you maybe have a youtube link to a gameplay example of this?"

http://www.youtube.com/watch?v=38dLCnrl1MM&feature=relmfu

This is a rather outdated video, but 2 or 3 minutes in you can see how JA2 1.13 handles enemy turns. Notice the bar at the top of the screen. You will see every enemy move within your team's visual range. Anything outside their visual range will, of course, be hidden by FOW. I don't know if this is the way you want to go, as the hidden movement screen is a bit of a fixture with Xcom, but you can look at it for comparison.

Edited by fleabittendog
Punctuation.
Link to comment
Share on other sites

"Do you maybe have a youtube link to a gameplay example of this?"

http://www.youtube.com/watch?v=38dLCnrl1MM&feature=relmfu

This is a rather outdated video, but 2 or 3 minutes in you can see how JA2 1.13 handles enemy turns. Notice the bar at the top of the screen. You will see every enemy move within your team's visual range. Anything outside their visual range will, of course, be hidden by FOW. I don't know if this is the way you want to go, as the hidden movement screen is a bit of a fixture with Xcom, but you can look at it for comparison.

Just to point out, that is how Xenonauts is meant to function (in beta, when tweaked + fixed). If it's in visual range you'll see it happen, the only difference is that you'll flop back to the Hidden Movement Screen if it's not in visual range.

Which is the same as the old XCOM games.

I'm not quite sure, but from your posts you seem to think the Hidden Movement screen is hiding *all* non Xenonaut actions, which isn't the intended design from what Chris has said.

Link to comment
Share on other sites

Just to point out, that is how Xenonauts is meant to function (in beta, when tweaked + fixed). If it's in visual range you'll see it happen, the only difference is that you'll flop back to the Hidden Movement Screen if it's not in visual range.

Which is the same as the old XCOM games.

I'm not quite sure, but from your posts you seem to think the Hidden Movement screen is hiding *all* non Xenonaut actions, which isn't the intended design from what Chris has said.

Actually, that was my only post on the subject. I guess what I was trying to say was that in JA2 the bar at the top representing the progress of the enemy's turn stayed on whether they were in visual range or not. However, unlike Xcom, if no contact was made, or it was lost after 2 turns, then the game would revert to real time mode. However, the maps are quite a bit larger than Xcom maps. Also, in JA2 1.13 you could force "real time sneaking", which would allow you to exit turn based mode if the enemy had not spotted you. I just meant that the hidden movement screen was a fixture from the original that some people would like to stay in Xenonauts.

Link to comment
Share on other sites

Well yes, apart from the out-of-combat real-time of JA 2, they're pretty much the same except that where Xenonauts goes to a hidden movement-screen when the enemy moves outside of your sight, JA2 would just keep the cam wherever it happens to be and display an "enemy turn"-message at the top.

My post may have been a bit misleading, since the discussion was more about how to cut down on the hidden movement thingy. The important difference is really in the way that sound is presented; if a soldier in JA 2 would hear the enemy move, the cam would center on him (at least, that's how I remember it) and the sound would then be panned so that you would hear where it emanated from, also there would be a text at the bottom where it said "Ivan hears a sound coming from the northeast". THIS is clearly preferable to centering on the thing that makes the sound while blocking the view with a hidden movement-screen so that you have no clue where the sound came from. At this point, all the shooting and footsteps you hear during the enemy turn only serves to confuse the player. Also, it would cut down on the hidden movement-screen time, since any enemy/civilian action that generates a sound close or loud enough for one of your soldiers to hear would have the camera show that soldier instead.

I'll try to find a video that demonstrates this and then edit this post.

(btw, will aliens react to both gunfire and footsteps? If so, will there be any stealth movement option?)

*EDIT*

Ok, so I might have remembered a bit wrong here. It was during the real-time that sound would be displayed this way. Still think it's a good suggestion though, if it worked the way that I described. Here is how it worked in the real-time phase of JA2 (7:40)

Quality is shit, but you get the idea. The yellow text in the bottom left is saying that "soldier x heard a faint noise coming from below" or something like that. (Ignore the soldier saying he heard something, that is not something I want in Xenonauts, even if I thought it possible.) Edited by Morgurthion
Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
I'd be interested in:
  • Can the aliens act as a squad?

  • You are using a HFSM. How do you ensure that the AI is not predictable, since this seems to be a major flaw of FSMs?

Thanks!

Hm, I have never thought that predictability would actually be seen as a flaw. I would definitely prefer aliens acting logically (i. e. predictably) as opposed to erratically (i.e. unpredictably). This is how you master a game - you learn the acting patterns of the NPCs.

Link to comment
Share on other sites

The use of a finite state machine does not inherently enforce strict action flow; I think in this case (with the admittance that I am obviously not privy to the central designs of the system in question and have not fully researched how it will be implemented) the states would simply be altering certain weights that the AI actor uses to evaluate his decisions. If, for example (and again, these are highly speculative ideas) the actor just witnessed two friendly agents die, he may enter a "Seek Help" state where more value is placed on running to friendly or secure locations rather than fighting back. This would not, however, entirely eliminate that option; the actor would still evaluate risk/reward (if the only enemy he can see is a clear shot and wounded, he may decide to stay and fight after all) and Gijs-Jan is probably going to implement some kind of fuzzy logic in the game just to add another layer of unpredictability or spontaneity to the AI's actions.

Link to comment
Share on other sites

Seems I forgot to post my answer to Hawk66's question, my apologies!

<Warning, bit more technical than normal>

The units will be able to act as a squad (If all goes well, in the very-very near future).

And to be clear: the planning logic will use a custom HTN (Hierarchical Task Network) logic planner.

Because Xenonauts is written in C++ and the planner needs to be efficient in the extreme, I can't use any quick prototyping languages.

This is the main reason why it's taken this long.

The HFSM is only used to alter the motivation (with fuzzy logic) for the units.

So, each units describes certain characteristics (P.e. aggressiveness, etc) which are used to influence the score certain actions give.

However, the planning of the actions is done by exploring a state space using HTN. The plans formed by the HTN are then evaluated using these characteristics.

This, coupled with some randomization, will ensure that logic is both rational, but unpredictable. (to some extent)

Link to comment
Share on other sites

The problem with this is that I'm trying to move away from the traditional "If you see Unit X with weapon Y, and Health < Z; then do A, else B". Essentially, I'm trying to move to a system in which we give the aliens a set of actions that are possible, some way to give a score to each action based on some preference, and let the aliens try to calculate what the best action would be. (Instead of explicitly telling it what to do)

So you're trying to implement game theory style decision making into the AI? Sounds neat. How far are you planning on going with this and will we be able to modify the A.I. ourselves beyond a simple set of predetermined parameters?

Link to comment
Share on other sites

So far the AI seems fairly good. I went several frustrating rounds with a sebilian who was smart enough to move out of my LOS at times and keep moving around a set of barrels for cover.

I think they need some work inside the ship, though. Currently, you can see if aliens are just inside the craft doors (intended?). The player can move close enough to spot them, then move back out of LOS. Since fog of war is not restored immediately, the enemy movement phase will show you if the aliens leave the ship (even though you can't see the entrance anymore). Then you can move a spotter forward slightly and open up from long range.

Other than the potential for abusing the fact that fog of war isn't reset at the end of your turn, I was disappointed in how the aliens left the ship one by one. They would have been a lot more dangerous if they had all left at once or all hunkered down in the ship.

Link to comment
Share on other sites

So far the AI seems fairly good. I went several frustrating rounds with a sebilian who was smart enough to move out of my LOS at times and keep moving around a set of barrels for cover.

I think they need some work inside the ship, though. Currently, you can see if aliens are just inside the craft doors (intended?). The player can move close enough to spot them, then move back out of LOS. Since fog of war is not restored immediately, the enemy movement phase will show you if the aliens leave the ship (even though you can't see the entrance anymore). Then you can move a spotter forward slightly and open up from long range.

Other than the potential for abusing the fact that fog of war isn't reset at the end of your turn, I was disappointed in how the aliens left the ship one by one. They would have been a lot more dangerous if they had all left at once or all hunkered down in the ship.

Have you reported the FOW problem as a bug? Or is it intended?
Link to comment
Share on other sites

  • 2 weeks later...

Can aliens hear you? Because I've had several occasions in V18 where I watch an ufo from afar for a few turns and nothing happens. But when I approach it and get to a certain distance and end my turn, 1 or 2 aliens run out of it towards me (not necessarily, sometimes they run away from me), reserve few tu's for reaction fire and then just stand there and end their turn. At which point I utilise this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...