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 fileThe 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" folderThe 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 forThe 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)
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: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