[WIP] Captain AI overhaul. Updated 09.12.2014

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti » Sat, 15. Nov 14, 21:09

Sucellus VS Xenon K

Sucellus runs at full speed while trying to turn towards its target, this is the fail.
An artillery needs to stay put and turn towards its target. If not in range by then, move closer, if in range, let em have it and reverse if target still coming towards you. Once too close, full throttle and do a fly-by to gain x-distance. Then again, turn in place and use the range.

wwdragon
Posts: 3746
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon » Sat, 15. Nov 14, 22:44

I'm so happy to see this topic got us the info about Egosoft people making those siege ship changes. :D
Editing posts since long before I remember.

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Sat, 15. Nov 14, 22:56

Me to. Fresh pancakes for cicero111 :)

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Sun, 16. Nov 14, 15:08

@YorrickVander
Yup, that long update interval does not work good in "close combat" situations. Are experimenting with different strategies, update intervals and interrupts based on ranges, ship type and hull/shield states on both sides.
On close range evade strategy (enemy hull below 15%) I've removed the target destroyed interrupt to avoid them stopping to take a close look at the explosion if no new targets, and using a fixed "runaway" timer instead.

@swatti
The mod should do this + are coming in ego's new AI package too.
Ranges for Sucellus in current alpha is:
Maxdistance: 7500
Holddistance: 3500
Minimum distance: 1000.
For station targets the ranges are increased with 2KM.
It will prefer to be between max and hold distance ranges (hold position/rotate to target), start reversing when between hold and minimum, and break off and try to gain distance when below minimum. Have changed minimum range to 2KM in the version I'm working on now.

swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti » Sun, 16. Nov 14, 18:15

Was this changed just now or?

Cause mine wasnt staying put but instead flying at the target, slightly orbiting it and then bumping into it.

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Mon, 17. Nov 14, 00:49

@swatti
Yeah, can think of a couple scenarios where that may happen - is mainly when they are flying straight toward each other, and happens more often if using the fasterships mod (I do). Doing a new attack order when enemy comes a bit closer will force it to recheck ranges and make it stop/rotate if in correct range.
Are experimenting with some interrupts to force them to recheck ranges when flying to waypoint - with promising results.
Have to do some more testing before the next release, and will support a lot more ships in that one.

@sparky
Almost forgot - thanks for the pancakes :D

swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti » Tue, 18. Nov 14, 11:21

Maybe add a range-check every XX-sec?

Oh jeah, im using the faster ships mod too. Cant imagine living without it.

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Tue, 18. Nov 14, 21:44

Hi folks,
new version is up. Added a bunch of new stuff so renamed the mod - list updated in OP.
Calling this one beta since is getting close to feature complete to what I had planned.

Decided to remove the reversing function from B/S - was good idea in theory, but did not work well in practice (slooow turnrate and speed when reversing, and often flailing away from correct vector to fire). The breakoff distance have been shortened to have as much fire at target as possible before turning away - seems to work nice.

Still have to do a lot more testing/tuning, especially when it comes to formation behavior. Which takes a lot of time - anyone know if the debugging tools shown in one of the pre release videos (timecompression and visible path spline) is available to mere mortals?

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Tue, 18. Nov 14, 22:08

Hi and thanks.

I've not heard of anyone using that tool but if I was to guess, it probably didn't have collisions active as that came to the release version of Rebirth later and I guess collisions would be relevant to this.

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Tue, 18. Nov 14, 22:31

Yeah, you're probably right - those were the early days of ghost ships. Well, patience is a virtue and so on I guess :)
Tried enabling in sector boosting to get them moving faster to enemy - besides getting some really good laughs out of it that did not help much in the way of testing :P

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Tue, 18. Nov 14, 22:56

lol

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Wed, 19. Nov 14, 00:21

cicero111 wrote:Yeah, you're probably right - those were the early days of ghost ships. Well, patience is a virtue and so on I guess :)
Tried enabling in sector boosting to get them moving faster to enemy - besides getting some really good laughs out of it that did not help much in the way of testing :P
Heh yeah I tried that too :D The best result was 'Boson! F**k shooting let's ram the b*****d!' lol. The rest was more like a Benny Hill sketch...
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Wed, 19. Nov 14, 02:07

cicero111 wrote:anyone know if the debugging tools shown in one of the pre release videos (timecompression and visible path spline) is available to mere mortals?
afaik nope, but i think you can hack in time compression with a hex editor - try to find a memory address which switches between 0 and 1 when you pause and unpause the game, maybe you find something..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Thu, 20. Nov 14, 15:13

@YorrickVander
Would be really cool if one could make short boosts work though - an interesting problem to solve :)
Have been thinking about a stop/rotate, when aligned boost/move x seconds (either range check interrupt or move timer calculated by magic math - i.e. trial&error bruteforcing) to come within 10-15 km of target.
A rats nest of problems though - wingmen is in theory doable with interupt/align/start booster/stop booster sequence when leader charges boosters/boosting/stops boost. But how to make this work in regions with stations though..
LOS check/boost only if in direct sight else move normally maybe... Will most likely end in the entire fleet exploding madly in all directions, worth a try just for the laughs I think :P

@UniTrader
Direct memory hacks is probably way way way above my abilities, especially on winOS which I don't have much lowlevel competence on - looking forward to dat Linux port :)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Thu, 20. Nov 14, 17:04

well, you dont need special knowledge, just a cheat program like artmoney for that ;)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Fri, 21. Nov 14, 15:51

@UniTrader
That looks nice, thanks for the tip :) Have to look in to that, some speed hacks would be great for testing.

Actually got in sector boosting working relatively reliably yesterday :) Only challenge now is to force the get_safe_pos to give a consistent output. Trying to force it to return a point in space from the target toward ship which is ca 13KM away from target with:

Code: Select all

<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
Works relatively OK but the output is sometimes a bit random and might give me a point on the opposite side of target, but usually get a OK position after 1-5 tries so have a do_while recheck hack for now. The range from target is always consistent. Any tip on what I'm doing wrong here?
The direction statement is not often used in the vanilla code so not much to go on, only in the undock code IIRC.

Here is the current codesnippet if someone want to play with it over the weekend. Have cleaned up some of my debugging stuff to help readability.
The forceposition="false" in boost move is important, without it the game will throw the ships around wildly on arrival. Have the minimum range for IS boost set to 20KM here.

Code: Select all

<do_if value="this.ship.distanceto.{$target} gt 20000 and this.ship.isplayerowned" >'
	<!--Stop and hold position/rotate to target-->
	<create_orientation name="$targetvector" refobject="$target" orientation="look_at">
		<position object="this.ship" space="this.ship.zone" />
	</create_orientation>
	<move_to destination="this.zone" object="this.ship" >
		<position object="this.ship" z="5m" />
		<rotation value="$targetvector" />
		<interrupt_after_time time="60s" />
		<interrupt>
			<conditions>
				<check_any>
					<event_object_destroyed object="$target"/>
					<event_boost_started object="$target" />
				</check_any>
			</conditions>
		</interrupt>
	</move_to>

	<!--Find safe pos ca 13KM from target in direction of this ship-->
	<set_avoid_collisions object="this.ship" enabled="false" />
	<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
	<set_value name="$counter" exact="1"/>

	<!--HACK!: position sanity validation/force rechecks, max 30 retries to avoid infinite loop lockup...-->
	<do_while value="(this.ship.distanceto.{$target} - this.ship.distanceto.{$pos}) le 7000">
		<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
		<set_value name="$counter" exact="$counter + 1"/>
		<do_if value="$counter ge 30">
			<break />
		</do_if>
	</do_while>
        <set_value name="$posY" exact="$target.position.y"/>
	<do_if value="$isstation">
		<set_value name="$posY" exact="$pos.y"/>
	</do_if>
	<do_if value="player.ship == this.ship">
		<speak actor="this" line="1029" comment="Engaging boosters." />
	</do_if>
	<start_boost object="this.ship" />
	<move_to destination="this.zone" object="this.ship" forceposition="false" finishonapproach="true" usehighways="false">
		<position x="$pos.x" y="$posY" z="$pos.z" />
		<rotation value="$targetvector" />
		<interrupt_after_time time="$updatetime" />
		<interrupt>
			<conditions>
				<check_any>
					<event_object_destroyed object="$target"/>
					<event_boost_started object="$target" />
					<check_all>
						<event_boost_charging_started object="$target" />
						<check_value value="this.ship.distanceto.{$target} le 15km" />
					</check_all>
				</check_any>
			</conditions>
		</interrupt>
	</move_to>
	<stop_boost object="this.ship" />
	<set_avoid_collisions object="this.ship" enabled="true" />
</do_if>

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Fri, 21. Nov 14, 15:53

I can't wait for v3.00 to be released so I can try this baby out :)

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Fri, 21. Nov 14, 17:17

@sparky
Been a really fun little project - and any "what if they do this"/ "when X they should Y" etc. ideas will be most appreciated :)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Sat, 22. Nov 14, 22:31

cicero111 wrote:Actually got in sector boosting working relatively reliably yesterday :) Only challenge now is to force the get_safe_pos to give a consistent output. Trying to force it to return a point in space from the target toward ship which is ca 13KM away from target with:

Code: Select all

<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
Works relatively OK but the output is sometimes a bit random and might give me a point on the opposite side of target, but usually get a OK position after 1-5 tries so have a do_while recheck hack for now. The range from target is always consistent. Any tip on what I'm doing wrong here?
The direction statement is not often used in the vanilla code so not much to go on, only in the undock code IIRC.[/code]
maybe you should add a » ignored="this.ship" « attribute here to avoid getting a diffrent position when your Ship is already nearby? i am not really sure if this is in any way related you your problem, but i jast saw this when looking through the move.autopilot and thought it might be useful for you ;)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
Sandalpocalypse
Posts: 4447
Joined: Tue, 2. Dec 03, 22:28
x4

Post by Sandalpocalypse » Sun, 23. Nov 14, 14:44

My balor definitely wasn't holding position, nor did ships move away from an exploding ship. Is there any indicator ingame to verify that the mod is working? I've verified it's in the right folder. Also, running 3.00 beta4.
Irrational factors are clearly at work.

Post Reply

Return to “X Rebirth - Scripts and Modding”