Home   Help Search Login Register  

Author Topic: A useful Idea for AI scripts  (Read 1252 times)

0 Members and 1 Guest are viewing this topic.

Clees

  • Guest
A useful Idea for AI scripts
« on: 06 Mar 2004, 17:20:14 »
So ....

Every unit can be discribed by a pre-programmed vars such as, health (getdammage), skill ... and so on .. thats ok ... but it is not enought for a large script (such as AI scripts). People who are writing AI scripts always find a problem of shering pices of information between units .... simply were forced by a BIS script syntax to save all data in local or global vars.


I found out a solution for it... Its not perfect (you cant save strings) but only numerical data

This is my idea :
Almoste all numerical pre-programmed vars in the game are using all the digits (above dot and below it). But there is a exeption:
"rating" parameter. It uses all the time only digits above dot so it means that digits below dot are free to use. We can read rating by using command :
      rating (unitName) - (or somthing like it)
and save some change to it by giving command :
      (unitName) addrating (for example 0.01)

When you (or AI) play and shoot an enemy soldier your rating will rise for example about 200 points, but it dosent change a thing in digits below dot :) and this is my idea - you can save there whatever you want

Of course it req. a quite complicated read mechanism - but its one time effort - someone writes a function which can read and return a single digit after dot form rating var and its it :) - after it you only have to use it

....

what do you think about this ?

Komuna

  • Guest
Re:A useful Idea for AI scripts
« Reply #1 on: 08 Mar 2004, 13:34:27 »
[...]
what do you think about this ?

Hmm... Clever. But you're missing examples of usage. You should add a few examples to convince us of its effectiveness against other methods.

It has, indeed, a few advantages:

- You can handle units without resorting to arrays or unit variables. Basically, you don't need to declare a variable for each unit to handle.

- Spares memory.

- A single variable can act like an array: 1000.2345 -> 1000 is rating, 0.2 is the priority level for something, 0.03 is another value for something else and so on.

However, there are a few methods that are much more dynamic in what concerns to variable handling, variable declaration and even code execution - all I have to say is that it involves strings...
« Last Edit: 08 Mar 2004, 13:35:22 by Komuna »

Clees

  • Guest
Re:A useful Idea for AI scripts
« Reply #2 on: 08 Mar 2004, 16:54:11 »
To be honest I thought about a personality script for units. In that var you could store info about level of morale of a unit (if it gets too low he/she will decide to surrender or run away (can be done be is "fleeing" command but here can be much more complex)current action (for example if he/she is at careless , units will start chating between each other, search for some tents or buildings - if in base - or whatever else), mood of a character, info about type of traning unit recived (not everyone can drive a truck or tank or use M60 ect.) if unit is dead (dont know if it is possible to do it) friendly units could check out what with him (or we can make them pretend too look like it), ect.

I think it it possible to give some life into flashpoint without need of scripting every mission - of course with use of ECP Mod.

When I get my hands on my computer i will work it out a bit :)

Unnamed

  • Guest
Re:A useful Idea for AI scripts
« Reply #3 on: 09 Mar 2004, 07:21:55 »
It would certainly be handy used in conjunction with arrays\variables. Maintaining large arrays of infantry can be time consuming when you have to search through the entire list to find the guy, returned by say the fired event.

You could embed the array index in rating, much easier to locate a particular unit in an array this way.

PsyWarrior

  • Guest
Re:A useful Idea for AI scripts
« Reply #4 on: 11 Mar 2004, 17:01:21 »
Greetings,

This is certainly an interesting idea for storing information about a unit without using variables. I think storing information about training /morale/mood would be interesting. You could essentially create a dynamic universe, with every unit being asssigned living quarters to return to at the end of each shift (this would be particularly useful for long missions or for RTS mods, which (usually)  either take a long time to finish, or have accellerated time).

I also like the 'skills' idea, but if you count up all the skills: (car driving, truck driving, tank driving, tank gunning, tank commanding, boat driving, boat gunning, boat commanding, plane pilot, plane gunner, fixed MG operator, M60 proficient, M60 specialist (boosts Skill when using this weapon), M16 trained, m16 specialist, ...)
You're going to need a lot of digits to store all the information, although you could combine the weapon proficiency/ weapon specialist into one (0 = cannot use weapon effectively, 1 = proficiency, 2 = specialist)

However, you wouldn't need to store if a unit was dead or anything like that, as you could simply run a !(alive _unit) check.

What you really want to consider is if the insane amount of coding this would require and the constant CPU drain of checking the 20+ digits after the decimal place of the rating of 255 units all the time, and then making them act accordingly, is worth it, when the disadvantages of simply assigning the information to a global variable are not that great. However, global variables rapidly become useless when dealing with the createUnit command (unless you define 255 global variables at the start of the mission, and assign one to each unit that is created - which is also an option).

Some things to think about, anyway...  ;D

-Supreme Commander PsyWarrior
-Psychic Productions Studios