MegaGlest Forum
MegaGlest => Feature requests => Topic started by: MuwuM on 1 April 2014, 15:31:09
-
I recommend to use JavaScript Function Notation (JSFN) (http://muwum.org/page/jsfn) instead of XML in MegaGlest.
Here is a sample unit.jsfn
function jsfnUnit(){
this.parameters = function(){
this.size = function(){return 2;};
this.height = function(){return 2;};
this['max-hp'] = function(){return 800;};
this['max-hp-regeneration'] = function(){return 2;};
this['max-ep'] = function(){return 100;};
this['max-ep-regeneration'] = function(){return 5;};
this.armor = function(){return 20;};
this['armor-type'] = function(){return 20;};
this.sight = function(){return 15;};
this.time = function(){return 100;};
...
};
this.skills = function(){
return [
function(){
this.type = function(){return 'stop';};
this.name = function(){return 'stop_skill';};
this.speed = function(){return 100;};
...
},function(){
this.type = function(){return 'attack';};
this.name = function(){return 'attack_skill';};
this.speed = function(){return 150;};
...
},
...
];
};
this.commands = function(){
return [...];
};
}
-
That could be very interesting. We could modify the values returned by using conditionals and such. However, I don't think this provides much difference unless an API is also provided to allow access to data like the player type (then mega CPUs could be given units with higher stats), map size, scenario name (if any; would allow the same faction to work differently in a scenario), etc.
It would create a bit of overhead, though, as we'd have to run a JavaScript engine when loading everything in the beginning, which I imagine would be far slower than parsing a static file.
-
That could be very interesting. We could modify the values returned by using conditionals and such. However, I don't think this provides much difference unless an API is also provided to allow access to data like the player type (then mega CPUs could be given units with higher stats), map size, scenario name (if any; would allow the same faction to work differently in a scenario), etc.
It would create a bit of overhead, though, as we'd have to run a JavaScript engine when loading everything in the beginning, which I imagine would be far slower than parsing a static file.
The MegaCPU thing is possible with XML, too. And the other stuff you mentioned.
In order to justify a large change, there should be obvious benefits to functionality or performance or usability. I wish Muwum would have explained in his original post what he expects the benefits of such a change to be.
-
This actually was meant to be an april fool (as JSFN combines giant overhead with bad performance with big security risk)
-
Oh. Haha.
-
:O