Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: AI anti-aircraft gun for outerra  (Read 5930 times)

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1755
AI anti-aircraft gun for outerra
« on: July 10, 2019, 05:16:39 pm »

Download from here my first draft of an actively shooting  AI anti-aircraft gun for an outerra war-game

https://www.dropbox.com/sh/ieu7kdo1j7n4gni/AAArMXcDGN8dTEFZ1v1JGlHha?dl=0


Installation is a two step process:

first click on self-extracting  flak.otx file
The file will install into  fly77/packages/flak   that is the outerra user packages folder

Then copy the "bullet" folder from the download link into your "Outerra/Anteworld/packages/outerra"  folder
The bullet is never seen but is needed for the gun to function. It may be accessed if desired in the scenery editor searching under assets for "bullet"


The AI anti-aircraft gun is found under the vehicles tab of outerra and is named "flak" ("flugabwehrkanone" in german)
and can be placed in a scenery using the scenery editor (F7 key) searching under "assets" for "flak"
Note that when spawned form the vehicles menu the gun will be immediately active while when placed from the scenery editor you need to enter it as for any vehicle to activate it
(and of course then exit) . Also note that once active by default the gun will shoot at you when in outerra ufo mode and when you are nearer than 500 m to the gun but not when nearer than 50 m.
These values can be changed in the header of the model's javascript if needed (see below)


The guns activity and status visibility can be controlled with L and V keys as follows:

Commands:

change status:   L key:  pressed once make idle....pressed twice  reactivate
show status:      v key:  first person camera view: pressed once makes status of gun visible ..pressed twice makes status invisible







How it works and what it is needed for
The anti-aircraft gun is controlled by a "minimal version of artificial intelligence (AI)" which makes it shooting at the camera when in OT ufo mode (in-game-camera)
or when inside a plane shooting at the plane if an in-game-camera has been attached to the plane in the plane's javascript.
This can be done by adding apropriate lines of code in the needed places (see below).

I introduced some random inaccuracy to the AI-gun otherwise it would be too deadly !
The precision of the AI-gun as well as shooting rate, bullet-speed etc..may be modified by changing some variables
in the header of the models javascript (see below).
The gun is the basis for my outerra aereal combat war game that I am trying to experiment with, were planes can try to attack some military installations defended by such AI anti-aircraft guns.
For the moment you can use it just for fun to see what it feels to get " shot at"  by an "artificial intelligence gun" in outerra.
You will have noticed that the model is very rudimentary without any animations. In fact I just consider it as a temporary "placeholder" for a future improved version for the game, possibly with much better graphics and animations....maybe with some help from Revolver  ;)



Make anti-aircraft gun active on outerra planes:
Lines of code to be added to the javascript of the model (for instance to Cessna 172)

Code: [Select]
var $igc;

function initialize(reload){
   ...
   this.geom = this.get_geomob(0);
   $igc = this.$query_interface("ot::js::igc.get");
   ...
}


function update_frame(dt){
...
if (this.get_camera_mode() != 256){           
    $igc.set_pos( this.geom.get_pos(), this.geom.get_rot());
}
...
}


Parameters that may be changed to adapt the performance of the AI-gun to your needs and avoidance-skills:

Code: [Select]
var maxaccuracy =  0.1 ;  // change value to higher values (max 1) to improve accuracy if the AI-gun
var mindist = 50       ;  // gun will not shoot when nearer than mindist to the gun
var maxdist=500;          // gun will not shoot when farther away than maxdist from the gun
var interval = 0.75 ;     // sec between consecutive shots
var bulletspeed = 500;    //m/sec
« Last Edit: July 11, 2019, 06:42:19 pm by fly77 »
Logged

Occams Razer

  • Jr. Member
  • *
  • Posts: 48
  • Freelance Graphic and Game Designer, 3D Artist
Re: AI anti-aircraft gun for outerra
« Reply #1 on: July 10, 2019, 08:15:03 pm »

Neat! This should prove a good first step in making the world more alive. Would it also be possible to tune the AI to only fire on targets above a certain altitude?
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1755
Re: AI anti-aircraft gun for outerra
« Reply #2 on: July 10, 2019, 11:59:10 pm »

Hi Razer ! Good idea. Yes it's possible. Will implement it: Indeed at the moment it will shoot also when you are very close to the ground, which seems unrealistic to me. Will make a modification so that it will shoot only in directions at angles above horizon not lower than say 10 deg ... unless its then too easy to defeat. Will test. Thanks for the suggestion !
« Last Edit: July 11, 2019, 12:37:19 am by fly77 »
Logged

aWac9

  • Hero Member
  • *****
  • Posts: 2538
  • newbie
Re: AI anti-aircraft gun for outerra
« Reply #3 on: July 11, 2019, 04:30:33 pm »

good work, I like ... another great contribution of Fly77.
I had to manually install the flak folder in the packages fly77 folder. the otx installer did not address it correctly, I do not know why.
 :)


« Last Edit: July 11, 2019, 06:37:05 pm by aWac9 »
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1755
Re: AI anti-aircraft gun for outerra
« Reply #4 on: July 11, 2019, 06:45:49 pm »

I see you apparently managed to attach the in-game camera to the baloon script !...or just kept the camera in the direction of the baloon..  ;) 
About installation you are right I made a mistake.
Now corrected the installation instructions (see above) and download content.
« Last Edit: July 11, 2019, 06:54:39 pm by fly77 »
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: AI anti-aircraft gun for outerra
« Reply #5 on: December 20, 2019, 07:41:16 am »

Been thinking ... would the script work added to a vehicle ? Like its turret doing it on its own while you would drive it normally.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1755
Re: AI anti-aircraft gun for outerra
« Reply #6 on: December 20, 2019, 08:24:20 am »

Well yes..not much of a problem.. have any nice 3d model to apply it ?
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: AI anti-aircraft gun for outerra
« Reply #7 on: December 21, 2019, 01:39:39 am »

Thought about the BTR80  ... the last version should work fine still.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1755
Re: AI anti-aircraft gun for outerra
« Reply #8 on: December 21, 2019, 02:33:41 am »

I think I never downloaded it. Can you repost the link ?  Ah---I found this one  https://forum.outerra.com/index.php?topic=2336.45  will try
« Last Edit: December 21, 2019, 02:53:05 am by fly77 »
Logged

aWac9

  • Hero Member
  • *****
  • Posts: 2538
  • newbie
Re: AI anti-aircraft gun for outerra
« Reply #9 on: December 21, 2019, 08:47:37 am »

BTR has long since stopped working, it remains as a static floating object.
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1755
Re: AI anti-aircraft gun for outerra
« Reply #10 on: December 21, 2019, 09:12:50 am »

Yes but I can try to repair it..mantlet and turret axis commands have changed since
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: AI anti-aircraft gun for outerra
« Reply #11 on: December 22, 2019, 12:43:31 am »

Yes, remember now ... its surely the turning lights script of mine too ... it has to be deleted ( ill try to implement the OTs one later ).
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.