Home   Help Search Login Register  

Author Topic: Dynamic OFP  (Read 2734 times)

0 Members and 1 Guest are viewing this topic.

Kinnon

  • Guest
Dynamic OFP
« on: 02 Apr 2003, 00:53:42 »
Hi all, new guy here :)

I'm working on controlling multiple groups at the moment, the big picture is a dynamic, strategic battle where you can order HALO's, extractions - the lot !

(Ambitious newbie !)

My multi-group script works fine but for this :

If you select a group using it's group-name you can only do this once, since it joins a null group when you switch command.

If you select a group using the leader-name this overcomes the once-only effect, but when the leader dies you (obviously) can't select by his name again ...

... so, can i dynamically assign the leader's name to the next guy to take command ?

Or could i somehow store the old group name and force the group you're switching control from to reuse that name ?

thx a lot :)



CrashnBurn

  • Guest
Re:Dynamic OFP
« Reply #1 on: 03 Apr 2003, 15:43:44 »
You should be able to just use leader groupname for your commands instead of an actual name, and whoever the leader is at the time should carry out your order.

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #2 on: 03 Apr 2003, 19:46:45 »
Thanks for that Crash, but i've just seen Command Engine 2 over at CoC, so no point in my little effort, except for learning purpouses.

What i'm working on now is a Guerilla Warfare AI script to combat Command Engine, gimme six months and i should have something decent.

OpFlash is AMAZING ! I bought it back in 2001 but have never got so deep into it, bye bye life !

;+}

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Dynamic OFP
« Reply #3 on: 03 Apr 2003, 23:12:15 »
What do you mean, "to combat the Command Engine"???  Two scripts going head-to-head??

Doolittle

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #4 on: 04 Apr 2003, 00:34:29 »
Hehe, NO !

ComEng may be a script but it's for the use of people. I mean for a good AI opponent using guerilla tactics against a much larger, more well-equipped force.

The CoC guys are so NATO-centric i thought it would be interesting ...

I plan proper hit-and-run guerilla tactics, weapon/ammo dumps hidden in the forest, stealing equipment and scavenging it from dead enemies etc ...

I've just started coding the recon unit yesterday, it's going well, it chooses random waypoints until it spots an enemy, it then halts and goes into stealth observation mode.

funfunfun ;+}

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Dynamic OFP
« Reply #5 on: 04 Apr 2003, 19:10:16 »
NATO-centric?
Well, I can't speak for the other CoC guys, but for what I do there are a lot of field manuals that help out in simulating about every aspect of modern warfare.  So NATO hardware and tactics are just easier to do.  But we really want to simulate both sides, and to do so fairly.
Anyway, I look forward to seeing what you come up with.
I don't know if the CoC boards are back up (a software SNAFU), but when they are, feel free to check through.

« Last Edit: 04 Apr 2003, 19:14:23 by Dinger »
Dinger/Cfit

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #6 on: 04 Apr 2003, 20:38:25 »
Understood, yes there's LOADS of western military info, the US sites seem to love publishing it, so i guess it is easier to create NATO-type stuff.

I'm going to have to totally understand ComEng so that my scripts don't impact on it, one starts to wonder about things like 'script overhead' as well, i used to code a lot and OFP-Script is like a mixture of c and BASIC, but i am totally without knowledge about the 'internals' of the game, speaking of which, what happened to OFP internals ?

Any pointers to any 'deeptech' stuff would be well appreciated.

Cheers Dinger ;+}

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #7 on: 05 Apr 2003, 11:16:21 »
A Guerilla AI script would come in handy for dynamic vietnam missions against the vietcong. I came up with some ideas on my own for dynamic battles for ia drang (wrote a design doc, need to translate it to english though).

I'm a c++ programmer but lately realized i don't have the amount of sparetime to learn scripting for opf to such a level that i could do it on my own. But i'd love to help you testing certain routines, like this recon script u mentioned.

I'm watching this thread from now on.  :)

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #8 on: 05 Apr 2003, 14:47:13 »
Nice one Dr :)

abomb1508

  • Guest
Re:Dynamic OFP
« Reply #9 on: 06 Apr 2003, 06:25:52 »
nato-centric? don't you think that's just a little harsh?

but don't worry. BS11 is a russian mission, and a very cool one too. i'm working on it as we speak.

as for a company ai, we are working on one of those. well, denoir, another member of our team is. you should get in touch with him. we could do with more work on the ai front. he has knowledge of neural nets, algorithms etc, and the sooner there is an ai the better. but you must know, if going alone, that the ofp squad ai is hardcoded, and cannot be messed with. but good luck anyway.

cheers,

A-Bomb

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #10 on: 07 Apr 2003, 19:46:17 »
Denoir sounds interesting. Neural nets, GA etc are good things, but probably not in a script unless fairly simple. Yes i knew about the internal AI, thank god it's there really, what i'm doing is similar, i suppose to a commanding officer script, juts directing the troops.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #11 on: 12 Apr 2003, 09:51:00 »
I'm also trying to create a strategic ai script. There are so much scripts around - i believe everything that is possible with Opf has been done by now. Besides: when it comes to strategy it's more a match to know what you want to do script.

Basically i want an AI that gathers all info it can get, overthinks the overall situation with those infos and then spawns troops, tell them where to go and what to do there. That's not very difficult to code, but it's a bit tricky to judge what info is 'used' in which way by the AI.

I decided to use status variables that have values from 0-99 to get easy percentages and to get rid of the standard digital ON-OFF variables, because you can't really script a decent AI with 0-1-switches.

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #12 on: 12 Apr 2003, 15:29:22 »
That sounds good, then you get a continuous range of changing data rather than just present/not present.

Mines a mixture of an overall AI, like a general i suppose, plus a little 'on the ground' group by group AI.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #13 on: 13 Apr 2003, 12:14:57 »
I'd enjoy making a real good AI that can handle battles on ground, air and sea. The final version should even be enhanced with some variables defining how the AI 'plays'. It is careful ? It is aggressive ? Is it specialized in ground battles, but is weak when it comes to air threats ? Will defend itself or waste all resources for 1 big attack force ? That way the AI could act like different persons which should be quite fun to play against.

Anyway, i thought about it and made these basic rules for my 1st version of the AI:

- a Base minds its own business (troops of different bases don't work together in this version)

The AI wants to gather info into its variables. It's like seeking an answer to certain questions.

Order of important questions:

1.) Where is the enemy ?
2.) What is the enemy ? Which weapons ? How many units have been spotted?
3.) What is my best reaction force to this threat, regarding my resources ?
4.) Where is the best place to attack / to defend for my groups ?
5.) Judging my info of known battle outcomes, what went wrong and what was my greatest victory? What do i need to do to get 'better' and win the war ?


Obviously there are many variables needed that will simulate a 'thinking & judging' routine. The point is that the AI mustn't cheat in any way. It has to use 'real' info and judge everything with these infos like a real human would. It would certainly be easy to code an AI that never fails and knows everything from the start, but i don't want to do that. If the AI has wrong or outdated info because the players chose the stealthy commando-gamestyle then the players should win the war this time. That's ok, it should be fun to play - maybe too much realism isn't always the answer.

Any comments, ideas ? If you feel i'm getting off topic within this thread just say so, i'll start a new one.  ;)

titan

  • Guest
Re:Dynamic OFP
« Reply #14 on: 13 Apr 2003, 12:47:55 »
have u started this script yet? and when do u think u wld finish it by?


what some varibles they have include smething like a group of AI seeing a convoy and making a tatical retreat due to over relming odd's, without fighting at all!


Rappy

  • Guest
Re:Dynamic OFP
« Reply #15 on: 13 Apr 2003, 12:54:42 »
Nice idea :)

Wanted to start an AI improvement/randomisation script aswell to make it more intresting, challenging and varied.

Havent had time yet however.

The idea itself is nice however.
You could add stuff into classes.

Like depending on weapon/type, so an AI platoon with one or two rpg troops wont attack 4 tanks, rather call for more rpg soldiers and hide until their arrival, or even follow the tanks around to get their position constantly and follow their movement.

perhaps even mark their position/route on map via markers.

or will scatter and hide from choppers etc.

It could all prove very intresting and add tons of new stuff to the typical boring battles.

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #16 on: 15 Apr 2003, 00:11:41 »
At the moment mine is only land and air. I like your thinking Strangelove. I have small 4-man patrols that do recon and order in the appropriate units to attack.

If they spot tanks but also a Vulcan then they order a group in to take out the Vulcan before sending in helicopters for the tanks.

The recon groups run and hide in forests if they feel threatened, and they each have a base in a randm forest from which they now rearm.

It's bloody slow going though, and OFP is kinda flaky, i'm getting variables corrupting themselves when they were fine just ONE LINE OF CODE BEFORE in the same script !!! ???

Offline benreeper

  • Members
  • *
  • I'm a llama!
Re:Dynamic OFP
« Reply #17 on: 15 Apr 2003, 05:21:05 »
I also would be very interested in the "OpFor" engine.  It will help with what I'm working on.

Ben

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #18 on: 15 Apr 2003, 18:13:45 »
Good report, Kinnon.

Had 2 lonely days at work so i thought i'd better design my basic AI structure. (I'll try to solve this project with object orientated software design, that's a good way to train programming project skills for my job)

So far i think i've identified 4 object classes that will do the job (in Opf this could mean there are 4 main scripts running i suppose, not sure yet):

ThreatEvaluator:
This object/script oversees all friendly units and mainly deals with the question: if something happened, what was sighted, where and when was it reported ? Then it classifies the (maybe potential) threat and reports the threattype, position and time to other scripts.

GameplanManager:
Its main job is to generate/update/delete threat symbols on the map. Every symbol is connected with the time it was generated. To use the advantage of the Opf engine, i decided the GameplanManager will only work with the gamegrid (50mx50m). To my Manager the world of opf should 'look' like a big tictactoe game where certain fields are neutral, friendly or a threat.
Also, i want it to handle mixed threat symbols, that means a field could also be occupied by an infantry-threat and a tank-threat symbol.

TroopManager:
Its main job is to spawn troops of various types and numbers, give them orders and waypoints and takes care that a group is called back after a certain threat is 'dealed' with (in various ways). It's a dumb script that isn't  decisive, it just follows orders of the SituationAnalyser.

SituationAnalyser:
This is the decisive routine, sorta 'The Brain' - it depends on / works with infos / events from the other objects/scripts.
It takes resource levels, threat symbols and his 'personal' behaviour settings into account and decides what the TroopManager should do next.
It only reacts to changes of resources and threat symbols. A new threat will trigger an order to the TroopManager, who will spawn&command the appropiate troops. If resources drop, the Analyser will take appropiate steps to get more resources (reinforcements/supplies). If resources raise beyond a certain level the Analyser will take steps to built a new base. Once this base is finished the Analyser starts the new AI script, therefore creating a 'living' copy of its own.

By the way this works, the players will have to deal with lots of independant bases if they wait too long.

Ideas/Comments/whatever welcome  :)

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #19 on: 15 Apr 2003, 20:50:01 »
Nice analysis. I now have the basic mechanisms for the units/groups (you should see the combined helicopter/multi-RPG attack on tanks) but have to work on a strategic-overview-brain thing, as at the moment the forces are purely reactionary, although with good planning a reactionary force seem to do quite well.

I've just had trouble with the main framework, i liked Planet of War but was disapointed that the computer didn't attempt to expand at all. So i think i'll start off simply and juts do a 'discover the base and destroy the enemy' type scenario, so the first step is to locate the enemy base.

I can't wait to sit down and play it i've been going for ... is it 3 weeks now ?

Tell ya what, bloody helicopters are difficult when it's a pure script and not a named unit, because practically every helicopter command requires an object to operate upon rather than a group or unit, i managed to solve it using a quirk in OFP. I couldn't get them to land when they RTB after being called out so i ended up saying 'unAssignVehicle _leader', and strangely enough, in a single-man chopper, he just lands, gets out then gets in again, which is fine, but if you ahve a pilot and gunner, the pilot gets back in again but the gunner runs into the rear passenger space !

I need to know more about the internals of this excellent but infuriating game but info seems thin on the ground, there used to be an OFP Internals site didn't there ?


Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #20 on: 16 Apr 2003, 00:12:39 »
I wouldn't try to give exact orders to your groups at the front. That's where the 'normal' AI of Opf kicks in and it gets the job done. For my part, i just care about the 'conquer island and manage resources' strategic thing. Sending the appropiate units to where the action is hot will be enough for a first basic version, i think.

I take it OpF can solve logical things like 8 AND 10 (=8) ?
Never tested it. I'd need that for a unit vs unit table i made up today. Every bit stands for a certain unit (inf, aainf, tank, heli, etc) and by combining bits with AND the AI can judge what units are a good answer against mixed threats.
Say, that BMPs with AAInfantry have been spotted. My AI (as i plan it) will find out that it could send (for example) Tanks, Fighters and RPGInfantry. It wouldn't suggest attacking with Choppers due to the AAInfantry, nor it would suggest attacking with normal Infantry, due to the BMPs.

Just an idea.

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #21 on: 16 Apr 2003, 18:40:53 »
Blimey ! Your using bitwise comparisons !!! It's not assembly language ya know :)

Offline benreeper

  • Members
  • *
  • I'm a llama!
Re:Dynamic OFP
« Reply #22 on: 17 Apr 2003, 00:31:22 »
LOL!

Great start.  I think the only that stalls good scripting in oFP is that the AI sometimes falls alseep.  An example is giving a formation command and a minute later they change formation (this is in safe mode).  

This is really the last piece to the OFP puzzle.

Ben

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #23 on: 26 Apr 2003, 13:21:29 »
Blimey ! Your using bitwise comparisons !!! It's not assembly language ya know :)


Hmmm - in that case: could this be 'simulated' with boolean arrays ? Sorta like: if all fields say 'true', but 1 field is 'false', then the whole answer is 'false' ?

In other words, it's like comparing bit by bit that way. Shame OpF doesn't support bitwise OR & AND, it's written in c++ - it shouldn't be a problem.  :-\


Btw Kinnon: what's your status ? Anything works yet ?
For my part: the beast called RealLife kicked me around a bit lately, so i'm still in the planning process. Also i'm worried about all this server-side and client-side routines of OpF. If i got that right, one should plan with these problems in mind or the script won't work in MP. (?!)

OpF - you gotta love it  :-*
« Last Edit: 26 Apr 2003, 13:25:12 by DrStrangelove »

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #24 on: 27 Apr 2003, 12:23:57 »
Well, i've got a working version that's nowhere near final but playable and fun.

It works with Command Engine 2, i've made tiny modifications to 1 or 2 CE2 scripts, nothing clever, just ensuring that my scripts get called by the CE2 main loop.

So far i have recon groups that wander around circularly-defined recon areas in a random fashion, when they spot enemy units then they call appropriate support, they do not rate the enemy at all, just call in infantry and BMP to attack infantry, helicopters to attack tanks, RPG infantry to go for Vulcans ...

They are purely reactive, but the management systems work well, support can't be called in if it's already busy, only one chopper at a time will try and land back at base etc ...

That's the old version though, i've started work on a strategic script now that analyses a threat before responding, and the individual response units respond more intelligently. For instance, infantry groups now attack from the cover of forests when possible rather than going straight for the enemy.

If you want i can mail you a copy of the old versoin, it's fun to play with ...

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #25 on: 27 Apr 2003, 13:38:58 »
That would be awesome, of course i want it!  :)
If i find something very useful in your script, can i use & edit it in my ai script ? You'll get full credit of course. In turn i'll contact you when i have something up. That way our scripts could get better in a shorter time period.

Some questions:
---------------------
CE:
By using that it can't be used in MP, can it ? Last time i checked CE was purely SP (or did i miss something?).

Use forests for cover:
How do you find the pos of a forest object ?

Idea:
-------
It should be easy to customize an ai script to other units. Names of custom units should be defined at a central script, like units.sqs or something. That way ppl would need to figure out the internal names of their fav units and write them into it.

Another advantage of this is that modified 'units.sqs' could be swapped by ppl over the inet very easily.
« Last Edit: 27 Apr 2003, 13:44:45 by DrStrangelove »

Kinnon

  • Guest
Re:Dynamic OFP
« Reply #26 on: 27 Apr 2003, 17:31:35 »
Of course you can use any parts of it.

I don't know off the TOMH about CE2 and multiplayer ... But the point is this is an AI Opponent for single-player play anyway ... Since this is my first scripting project i am not going into the MP arena yet !

I don't know any way of finding the position of a forest object, so i just placed triggers in every forested area on jungle everon, then looked up the positions in the 'mission.sqm' file then deleted the triggers.

Universal script is a good idea, mine are all easily modifiable anyway, they operate using the name of the group so ....

Miles

  • Guest
Re:Dynamic OFP
« Reply #27 on: 04 May 2003, 20:47:43 »
Any news on this? I think it got moved back when they merged the forums.
« Last Edit: 04 May 2003, 20:49:38 by Miles »

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Dynamic OFP
« Reply #28 on: 05 May 2003, 00:01:36 »
I'm still in the planning phase, but almost finished now. I'll start coding the prototype within 2 weeks i guess.

(Still waiting for Kinnon's script)