Page 2 of 3

Re: WIP - Space Battles

Posted: Tue May 24, 2011 10:11 am
by m4r35n357
maik wrote:
If I may suggest some changes to the distribution:
Yeah, just realized I messed up this release a bit ;) I'll fix it up and do another one . . .

Re: WIP - Space Battles

Posted: Tue May 24, 2011 10:19 am
by Commander McLane
One suggestion for the OXP: it may be more efficient to attach the ship script in the shipdata with script = "faction.js"; in each entry than to do it after spawning with shipList[i].setScript("faction.js");.

The same applies to all other shipdata properties, like AI, bounty and scanner display colour.

Re: WIP - Space Battles

Posted: Tue May 24, 2011 10:27 am
by m4r35n357
maik wrote:
If I may suggest some changes to the distribution:
Yeah messed that one up, sorry everyone! Try version 1.1, debug switched off now . . .

http://www.box.net/shared/3rp8udhdff

Re: WIP - Space Battles

Posted: Tue May 24, 2011 10:33 am
by m4r35n357
Commander McLane wrote:
One suggestion for the OXP: it may be more efficient to attach the ship script in the shipdata with script = "faction.js"; in each entry than to do it after spawning with shipList[i].setScript("faction.js");.

The same applies to all other shipdata properties, like AI, bounty and scanner display colour.
Right, I did all the key customization in javascript to keep the shipdata.plist short & simple (especially considering the choice of ships is meant to be modifiable), but of course constant stuff like that could be added to the shipdata instead.
So in that case I'd end up with a much bigger shipdata, in which most of the data would be duplicated, is the trade-off really worth it? I don't really understand the efficiency issues . . . is there a simple explanation?

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:03 am
by Commander McLane
m4r35n357 wrote:
So in that case I'd end up with a much bigger shipdata, in which most of the data would be duplicated, is the trade-off really worth it? I don't really understand the efficiency issues . . . is there a simple explanation?
I don't think it's a real trade-off, because the shipdata doesn't cost you anything. It also would allow anyone who is interested to poke around to understand quickly in which ways the ships are modified from their originals.

As for efficiency it's just a guess, but I think it should be faster to create the ships with their correct properties right away than to create them with their original properties and then modify them after the fact. The difference in processor time will be marginal, though. For me it's just cleaner.

There is also the question of possible OXP-clashes. For instance, NPC-shields.oxp inserts a piece of script into each ship's ship-script after the ship is spawned. I think it's indeterminable which script will run first. If Factions runs first, the ships will get their custom script via the setScript, and then the NPC-shields will be able to make its amendments. If the NPC-shields script runs first, it will make amendments to the default ship scripts of the factions ships, and then the Factions script will trash those scripts entirely and replace them with your script. In this second case the factions ships would not have shields. The same would apply for other OXPs that amend ship scripts on spawning.

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:11 am
by maik
Moved it from the WIP to the main section of the [wiki]OXP List[/wiki] and renamed it Factions. Are you planning to give it its own wiki page?

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:20 am
by m4r35n357
maik wrote:
Moved it from the WIP to the main section of the [wiki]OXP List[/wiki] and renamed it Factions. Are you planning to give it its own wiki page?
I hadn't really planned on that at this stage, and am not a particularly creative writer ;) If the OXP gains wide usage that might change things . . . but I'd like to take care of the technical stuff first in case I suddenly find myself without enough spare time!

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:31 am
by Commander McLane
m4r35n357 wrote:
maik wrote:
If I may suggest some changes to the distribution:
Yeah messed that one up, sorry everyone! Try version 1.1, debug switched off now . . .

http://www.box.net/shared/3rp8udhdff
Yes, that's better. :D

However, it is still missing a license. So, strictly speaking, nobody may use it.

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:33 am
by m4r35n357
Commander McLane wrote:
I don't think it's a real trade-off, because the shipdata doesn't cost you anything. It also would allow anyone who is interested to poke around to understand quickly in which ways the ships are modified from their originals.
I'm not a big fan of the declarative side, this was more of an exercise in learning JavaScript for me, as well as the Oolite js and AI APIs ;) Also I really like conciseness, hence the one-liners in the js.
Commander McLane wrote:
As for efficiency it's just a guess, but I think it should be faster to create the ships with their correct properties right away than to create them with their original properties and then modify them after the fact. The difference in processor time will be marginal, though. For me it's just cleaner.
The ships are spawned half way down the lane, so timing is not an issue either. I'll watch out for the system entry delay next time I play.
Commander McLane wrote:
There is also the question of possible OXP-clashes. For instance, NPC-shields.oxp inserts a piece of script into each ship's ship-script after the ship is spawned. I think it's indeterminable which script will run first. If Factions runs first, the ships will get their custom script via the setScript, and then the NPC-shields will be able to make its amendments. If the NPC-shields script runs first, it will make amendments to the default ship scripts of the factions ships, and then the Factions script will trash those scripts entirely and replace them with your script. In this second case the factions ships would not have shields. The same would apply for other OXPs that amend ship scripts on spawning.
I'll have to think about this one a bit more offline, but for now if it just means that there is uncertainty over the precise capabilities of the Faction ships, I'm not too bothered because they are only fighting each other; player beware ;)

BTW looking into the licence issue, thought I'd taken care of that.

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:36 am
by maik
m4r35n357 wrote:
maik wrote:
Moved it from the WIP to the main section of the [wiki]OXP List[/wiki] and renamed it Factions. Are you planning to give it its own wiki page?
I hadn't really planned on that at this stage, and am not a particularly creative writer ;) If the OXP gains wide usage that might change things . . . but I'd like to take care of the technical stuff first in case I suddenly find myself without enough spare time!
It is likely it gains wider usage if people can read more about it than just the one-liner in the OXP List. I can whip something up from the contents of your readme when I find the time.

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:42 am
by m4r35n357
maik wrote:
It is likely it gains wider usage if people can read more about it than just the one-liner in the OXP List. I can whip something up from the contents of your readme when I find the time.
That would be absolutely fantastic if you could do that! I'll have a think if there's anything else I can add to the README . . . .

Re: WIP - Space Battles

Posted: Tue May 24, 2011 11:48 am
by m4r35n357
Commander McLane wrote:
However, it is still missing a license. So, strictly speaking, nobody may use it.
OK, Version 1.2 . . . http://www.box.net/shared/k9yozhokpj

Hope this one is acceptable!

Re: WIP - Space Battles

Posted: Tue May 24, 2011 2:36 pm
by maik
m4r35n357 wrote:
maik wrote:
It is likely it gains wider usage if people can read more about it than just the one-liner in the OXP List. I can whip something up from the contents of your readme when I find the time.
That would be absolutely fantastic if you could do that! I'll have a think if there's anything else I can add to the README . . . .
Alright, you can find it [EliteWiki] here.

Re: WIP - Space Battles

Posted: Tue May 24, 2011 2:44 pm
by m4r35n357
maik wrote:
Alright, you can find it [EliteWiki] here.
Wow, that is absolutely brilliant - Thanks!

Re: WIP - Space Battles

Posted: Tue May 24, 2011 5:11 pm
by m4r35n357
Just noticed that the start position of the factions is still on its debug setting of 0.2, this should really be 0.3 (I was injecting through for testing). For me, the fight was nearly over by the time I'd dealt with the pirates. If you edit Config/script.js like this:

Code: Select all

  // Each faction starts this fraction away from the site
  this.$start = 0.3;
you can recover the intended operation. I wasn't planning on doing another release just for this, it will be fixed in the next one anyway, but I am prepared to change my mind on that. Sorry for the cockup!