Page 1 of 1
AI code generator
Posted: Fri May 09, 2014 4:15 pm
by MD
Hi everyone,
I created a quick python script to help generate AI code for your levels. It's not fully functional, but I'm hoping it one day will be. I put up the source code on GitHub, so that perhaps others will contribute and expand it!
As an example of how to use it, I've included the AI code and raw parts list of my level, "
Checkers", in checkersLevel-aiCode.py and checkersLevel-parts.txt.
Just run "python checkersLevel-aiCode.py"
It would be awesome if others would add to it!
Go to the GitHub repository now.
Cheers,
~MD
Re: AI code generator
Posted: Fri May 09, 2014 4:57 pm
by asdasdg
Well....this is rather unexpected. Thanks.
Re: AI code generator
Posted: Mon May 12, 2014 10:40 am
by MD
Yup! I wrote it over a year ago, and figured since I probably won't have time to polish it and make better I may as well just post it as-is and see if someone finds it useful.
~MD
p.s. I'll move this thread to Editor Help - just realized I posted this in the wrong section.
Re: AI code generator
Posted: Fri Oct 17, 2014 5:55 am
by zxzx89002
MD I Cant understand how u make the rocket make explode..can u write me he code here ?
i checked the Github code i didnt understand it..same as machine guns
Re: AI code generator
Posted: Thu Apr 16, 2015 4:08 pm
by MD
The "exploding" rocket consists of two parts:
1. The body of the rocket moves linearly away from its parent object (the mothership), then disappears by moving off screen (distance = 9999).
(see macro_linearMove in zfai.py)
2. At the same time that the rocket disappears, a timer is set to do the following 3 things:
- enable the singularity guns (which cause the "explosion" - the guns themselves are hidden).
- set each gun's timer to play the firing sequence ("explode")
- then disable the singularity guns (until it's enabled again in the next explosion)
(see macro_singularityFire in zfai.py)
Also, you can try out the level within the
level editor yourself by:
- copying the part list from
checkersLevel-parts.txt into the "text edit" window
- execute
checkersLevel-aiCode.py using the typical Python command:
> python checkersLevel-aiCode.py
which will generate a long list of text, which are AI commands - copy these into the AI code window in the editor.
- now run the level, and tinker with it as much as you like
Re: AI code generator
Posted: Tue Dec 29, 2020 12:31 pm
by MD
I have updated this library. Go to
https://github.com/skylogic004/zetaflow-levels to check it out.