Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  


Outerra Tech Demo download. Help with graphics driver issues

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


  • Sr. Member
  • ****
  • Posts: 466
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


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:


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 »

Occams Razer

  • Jr. Member
  • *
  • Posts: 36
  • 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?


  • Sr. Member
  • ****
  • Posts: 466
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 »


  • Hero Member
  • *****
  • Posts: 1281
  • 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 »


  • Sr. Member
  • ****
  • Posts: 466
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 »