Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AI script ported to F.LF
#1
AI script is now ported to F.LF! The first ported script is Crusher by YinYin.
You can try beating him on F.LF demo by pressing F4 to go to character selection menu.
The ported source of Crusher is available, and you can read the diff to see the difference side by side, where the left is AI angelscript and right is F.LF javascript.

The translation process was semi automatic. There was indeed a translation program being developed to translate from AI angelscript to F.LF javascript. Major differences are simply naming convention (look at the source of the program to know the translation scheme). However there are few semantic and systematic differences to be pointed out, that must be resolved manually:
  1. function overloading is not allowed in javascript, because a function can have any number of parameters
  2. javascript has 1 more primitive type 'undefined' than angelscript, such that undefined!==0, but both undefined and 0 evaluates to false. that means one should NOT do `if( some_var!=0)`, instead, should do `if( some_var)`
  3. F.LF do not use an object number system from 0 to 399. F.LF has a slightly better design by not pre-allocating memory and not imposing a hard limit on max. number of objects (though performance of F.LF at this moment is still bad). Thus, F.LF uses sparse array.
    so, instead of
    Code:
    for (int i=0;i<400;i++){
        if (game.exists[i]) {
            // do something about `game.objects[i]`
        }
    }
    one can simply
    Code:
    for ( var i in game_objects)
    {
         // every element in the sparse array game_objects exists on scene
         // do something about `game_objects[i]`
    }

that's all about it right now, be sure to try it out, and because things are all preliminary, there are lots of bugs, and please report any problem and suggestion to me. I hope this porting effort is going to raise people's interest in AI scripting and F.LF. For more information about F.LF, visit this thread or F.LF Portal.



I am not sure why Crusher acts awkwardly right now. And it does not defend at all. And the zwidth calculation is a little bit wrong.
A tips on debugging: you can use Chrome > Tools > Javascript Console to debug the application. It is a very good tool.

[Image: lVDbjHh.png]
Reply
Thanks given by: The Hari , TamBoy
#2
Apart from never defending he also sometimes stopped doing anything at all and resumed later on.
Reply
Thanks given by:
#3
.... You removed all functionality of the defend key in this build. No rolling, no special moves, nothing works when I press the defend key.
To live a life of power, you must have faith that what you believe is right, even if others tell you you're wrong.
The first thing you must do to live a life of power is to find courage. You must reach beyond the boundaries of time itself.
And to do that, all you need is the will to take that first step...
Ask not what others can do for you, but what you can do for others.
Reply
Thanks given by:
#4
Yeah. It generally doesn't run as stable as the previous one.
Reply
Thanks given by:
#5
Some bugs here.
Besides the AI trying to walk itself upwards to no avail, it tends to just "tap" the direction it wants to go repeatedly. Also, flipping bugs are shown from Deep's Swing.
To live a life of power, you must have faith that what you believe is right, even if others tell you you're wrong.
The first thing you must do to live a life of power is to find courage. You must reach beyond the boundaries of time itself.
And to do that, all you need is the will to take that first step...
Ask not what others can do for you, but what you can do for others.
Reply
Thanks given by:
#6
(12-28-2013, 09:30 PM)Bat Tamer Wrote:  .... You removed all functionality of the defend key in this build. No rolling, no special moves, nothing works when I press the defend key.
that must be a key issue... there should be no problem on defend. try changing all keys again.
(12-28-2013, 10:01 PM)Bat Tamer Wrote:  Some bugs here.
Besides the AI trying to walk itself upwards to no avail, it tends to just "tap" the direction it wants to go repeatedly. Also, flipping bugs are shown from Deep's Swing.
thank you so much for the video capture. The second bug must be a rowing problem that during rowing that allowed the character to flip x velocity. But right now I cannot locate its exact cause.
Reply
Thanks given by:
#7
(12-29-2013, 03:00 AM)tyt2y3 Wrote:  that must be a key issue... there should be no problem on defend. try changing all keys again.
It was. My fault.

(12-29-2013, 03:00 AM)tyt2y3 Wrote:  thank you so much for the video capture. The second bug must be a rowing problem that during rowing that allowed the character to flip x velocity. But right now I cannot locate its exact cause.
No problem. I use Camtasia, but it isn't free sadly. It works wonders though!
To live a life of power, you must have faith that what you believe is right, even if others tell you you're wrong.
The first thing you must do to live a life of power is to find courage. You must reach beyond the boundaries of time itself.
And to do that, all you need is the will to take that first step...
Ask not what others can do for you, but what you can do for others.
Reply
Thanks given by:
#8
the flipping during rowing bug solved. thanks for pointing out
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)