home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


scripted ai

by rknigh21 on 07/02/2008 23:02, 36 messages, last message: 07/08/2008 08:42, 15333 views, last view: 05/18/2024 16:24

Hi

There have been a few threads recently on scripted ai so I wondered how difficult this would be. As a proof of concept I added a call to the main ai loop in monster.h that called a script in the maps cfg file, I also added a couple of new cube script commands (ai_get_state, ai_set_state) that allows the script to get and set the monsters state. This worked and I was able to change the monsters state from the script. It did not seriously impact the frame rate. As it stands this is pretty useless as it has no way of distinguishing one monster from another and can only change it's state. However it does prove it's possible.

This raises a few questions

1)What should the ai script be able to do (change monsters attitude, movement, weapon).

2)How could the script be applied to specific monsters (maybe tag the monsters like platforms are, then have a specific script for that tag).

3)Would it be included in the main release (I do not want to end up with my own mod).

Any comments?

   Board Index    Go to next 20 messagesGo to last 20 messages

#1: ..

by tman_elite on 07/03/2008 00:31

This is a good idea. Maybe a script could be used to tell some monsters to run at the player quickly (rathatattmas specially) some to slowly approach, and some to keep their distance (sliths and rhinos especially).

I'm sure there are plenty of uses for something like this.

reply to this message

#2: scripted ai

by sound48680 on 07/03/2008 00:58

A function to switch monsters between attack and retreat mode, based on monsters returned state. Trying to control the low level stuff like speed and direction with cube script would be too much.

Another function would be to select different targets besides the player to home in on, like a map model or arbitrary location.

reply to this message

#3: Re: scripted ai

by tman_elite on 07/03/2008 01:20, refers to #2

You wouldn't have to control things like speed or direction directly in cube script, you could simply set the monsters' state to a hardcoded command like "stand your ground," "attack," "keep your distance," etc.

reply to this message

#4: Re: scripted ai

by SheeEttin on 07/03/2008 02:07, refers to #3

Maybe not HAVE to control them, but it'd certainly be a good idea to expose those settings to CubeScript... that way, you could have quite a bit of control over monster movements (e.g. show monsters performing tasks).

reply to this message

#5: Re: scripted ai

by Captain_Ahab on 07/03/2008 04:41, refers to #4

I agree completely
I'd love to have the ability to script an arbitrary animation for a monster/npc

I'd love the ability to script lower level AI stuff too, like the game 'Droidbattles'.

http://www.bluefire.nu/droidbattles/

Wouldn't it be interesting to have contests for best scripted monsters?

reply to this message

#6: ..

by Max of S2D [Fr] on 07/03/2008 10:49

I think we could also have as well tweakings for the entities...

like,

/newent monster 1 [x] [y] [z]

Where

x = type of behavior, offensive, defensive
y = number of health points
z = armor

reply to this message

#7: Re: ..

by tentus_ on 07/03/2008 22:18, refers to #6

I'd say it'd make more sense to tweak your proposal just a little bit.

/newent monster 1 [x] [y] [z]
Where
x = behaviour modifications (offensive, defensive, evasive, suicidal, backstabbing, friendly offensive, friendly defensive, etc)
y = health modifier from default health points
z = ID number for additional cfg adjustments

CFG tweaks would then look like this:

monsterID 1 [
run_speed 100
reaction_time 100
fire_rate 100
armour 100
wander_radius 100
ledge_fear 100
water_fear 1
lava_immunity 0
jump_height 100
]

I know I'm missing a bunch, but there's a start of things that could be useful to mappers.

reply to this message

#8: Re: ..

by tman_elite on 07/03/2008 22:42, refers to #7

Behavior Modifications could also be made in the config file, which would mean that you could have /newent monster 1 [x], where x is the id. However I think the best solution would be to have /newent monster 1 [x] [y] [z], x is the behavior type (friendly offense/defense, enemy offense/defense, etc.), y is the trigger the monster is spawned by (if y is 0 or not given, the monster is spawned at the start of the map) and z is the id for additional configuration. Health modifiers can be included in the cfg file.

reply to this message

#9: waypoints!

by fjdslkfsdconorfhdsjk on 07/03/2008 22:48

^^

reply to this message

#10: Re: ..

by SheeEttin on 07/04/2008 00:06, refers to #7

How about "monster TYPE YAW ID", kind of like it is now?

Or actually, why not just go whole-hog and make it "monster ID", and put EVERYTHING in the CFG? Monster type, yaw, behavior, etc.?
Heck, you could just script the monster's actions right there!

reply to this message

#11: Re: ..

by tman_elite on 07/04/2008 00:19, refers to #10

This would work, but you should be able to make semi-intelligent monsters without having to script anything. You should only have to script the monsters to make changes from the default behavior(s) or settings like health, speed, etc. Basic things like the monster type and basic behavior should be command line options (in my humble opinion.)

reply to this message

#12: I like the cfg file idea

by rknigh21 on 07/04/2008 01:25

I like the idea of putting it all in the cfg. You could then just add monster type 3 to the map. If you did nothing in the cfg you get the standard slith. If you add a config for monster 3 to the cfg then you get whatever that does. Also you could specify the model to use for that monster which would really make a map look different.

The parameters that control the monsters behaviour (i.e. fear, aggression, speed) could be changed via a script say from a trigger in mid game.

This looks like a doable small mod, maybe 3-4 weeks spare time effort to me. Which I will have a go at.

Waypoints would give a lot of control over monster movement but would need vastly more changes to the code which I do not feel capable of doing at the moment, later maybe.

reply to this message

#13: Re: I like the cfg file idea

by tentus_ on 07/04/2008 05:10, refers to #12

tman_elite is right, you don't want to cut it down to a single number because you'll make the system difficult to use and redundant. Type, yaw, and possibly behavior should be kept ingame because otherwise you're going to end up with a list of 80 individual IDs, when you only really need maybe 5. I list behavior because I foresee mappers making clusters of "teams"... a couple of rushers, a sniper, maybe a suicidal and a coward. All of that cluster would otherwise share an ID number.

Maybe it would be better to think of them as classes, rather than IDs. You have
/newent monster T Y F S
T = type
Y = yaw
F = first class
S = second class

By allowing two classes it'd be easy (and efficient in theory) to overlay attributes across a large number of monsters. The first attribute would override any redundancies in the second, and there could be a set of default classes that mappers could use if they don't want to define their own.

reply to this message

#14: Re: I like the cfg file idea

by SheeEttin on 07/04/2008 06:36, refers to #13

Eh... Or maybe predefined behaviors, i.e. define once, use many?

Though the dual-class sounds interesting...

reply to this message

#15: ..

by Quin on 07/04/2008 11:04

You mean like this? http://pastebin.com/m5b745366

reply to this message

#16: Re: ..You mean like this !

by rknigh21 on 07/04/2008 18:49, refers to #15

Looks interesting. Does that cube script currently work or is it an example of how you would like it to work?

reply to this message

#17: Re: ..You mean like this !

by Hirato Kirata on 07/05/2008 02:35, refers to #16

if you can get sauermod working, run it with -gssp, and you'll see it in action

reply to this message

#18: ..

by Quin on 07/05/2008 05:10

Maybe this would help a bit, but realise SSP worked only on a 4-axis meachnism so movement was easier to predict in this circumstance.. http://pastebin.com/m2ba15197

reply to this message

#19: ..

by {Qs}Homicidal on 07/05/2008 07:11

who plays single player anyways :P

1+1= <---- lol

reply to this message

#20: Re: ..

by CC_machine#12742398 on 07/05/2008 11:14, refers to #19

we do.
[/obvious]

reply to this message

   Board Index    Go to next 20 messagesGo to last 20 messages


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
54037039 visitors requested 71817131 pages
page created in 0.026 seconds using 9 queries
hosted by Boost Digital