Page 1 of 1

Asteroids

Posted: Tue Jan 15, 2008 9:09 pm
by Eric Walch
Last week I found a very nice OXP on the site of Charlie. It adds a dozen new ones to the two default asteroid models in Oolite.

The file was published as beta and had some reference bugs that even crashed my machine. I removed them and the OXP should work now on every system. It is a small OXP that just adds a greater variety of asteroids to the system. It is a must have. I just got the permission of Charlie to put it on the wiki for download:


Asteroids

Posted: Tue Jan 15, 2008 9:24 pm
by LittleBear
They are also included in the Asteroid Storm OXP (and added to the Universe generaly) as this was joint OXP I did with Charlie.

Posted: Tue Jan 15, 2008 9:45 pm
by Cmdr. Maegil
So we don't need this one?

Posted: Tue Jan 15, 2008 10:28 pm
by Eric Walch
Little Bear wrote:
They are also included in the Asteroid Storm OXP (and added to the Universe generaly) as this was joint OXP I did with Charlie.
You are right. I did your mission a year ago and removed it, put in the galaxy 1 folder and forgot about it. When I looked at the wiki I didn't found this. But you copied the same errors of charlie.

Bad naming: a01.png, a02.png etc. Much to common names that could lead to future name conflicts.

Bad letter casing: All the texture files are in lower casing. The model files sometimes use lowercase names and sometimes use upercase names to refer to the lowercase files. Some computer systems have problems with that.

Bad asteroid filling: They would never generate boulders when mined with a pre 1.70 oolite version. These do now. (Since oolite 1.70 also asteroids with no filling defined will generate boulders)

So the visual effect is the same, this OXP only adds the asteroids and does not keep doing the unnecessary mission calculations when the asteroid mission is finished.

Posted: Tue Jan 15, 2008 10:30 pm
by LittleBear
I did fix the case sensitivity bug with V3.0 of Asteroid Storm, but I spawned boulders with death actions of the main rock rather than with likley_cargo (which would have been the better way to do it). :wink: If you've already finished the Asteroid Storm mission you would be better off replacing it with this OXP. (wrote this one about 18 months ago, so does have errors from things I didn't understand properly at the time).

Posted: Wed Jan 16, 2008 6:21 am
by Commander McLane
So I would suggest to reunite the asteroid.oxp with asteroidstorm.oxp, brushing out the bugs of the latter and publish it as v3.1 or so.

I think that's the easiest way, because we really don't need two OXPs that basically do the same. (@Eric: The AsteroidStorm readme said right from the beginning that the OXP does two things: Add the mission, and add greater variety to asteroid shapes generally. So there was never a need to remove it, and I suspect almost no player did. Therefore I advocate bug-squashing in AsteroidStorm rather than adding another OXP that adds the same asteroids again.)

Posted: Wed Jan 16, 2008 9:17 am
by Eric Walch
McLane wrote:
I think that's the easiest way, because we really don't need two OXPs that basically do the same.
I disagree because the way Oolite works. Asteroid incorporates mission code that runs on every update time. So it keeps slowing down performance, even when finished the mission. (OXP's with the new java scripting wont have this problem). So for increasing performance a little it is better to have a separate OXP that only brings the asteroids.

I have just one remark on my statement of bad asteroid filling: The problem is not as bad as I suggested. The problem was discussed in Bug-reports and improved in Oolite 1.70.

Just to give normal players that haven't followed that thread, a little more insight I will explain asteroids a little.

Internally in asteroids there is a key "likely_cargo", that defines in how many boulders an asteroid falls apart. With Oolites internal asteroids this key has a value zero. When a new system is created and the value is zero, Oolite gives the asteroids a random filling. This also includes the original asteroids from Charlies OXP that will have a filling in those cases.

Problem arises when an OXP adds additional asteroids. When those have a key of zero, they don't generate boulders. e.g. the asteroids around some Pirate Rocks are OXP generated and thus empty. And there are more OXP's that add asteroids to a system. This was a bug inside Oolite itself that Charlie just copied. (very few programmers new what "likely_cargo" was for, so don't blame them).

With the new changes in Charlies Asteroids, these also have a filling when OXP added. Starting with 1.70 Oolite the problems are less as Oolite now looks more at scanclass = Rock to determine if something falls apart in boulders. And even with the key of zero it will generate a random amount of boulders. There is a new key introduced to suppress boulder formation if desired.

But all this is of no interest for most players as even filled asteroids, in most cases don't generate boulders when no mining lasers are used. It is only annoying for those players that invested in expensive mining lasers and see that they don't work with some asteroids.

Posted: Wed Jan 16, 2008 9:38 am
by Commander McLane
Eric Walch wrote:
McLane wrote:
I think that's the easiest way, because we really don't need two OXPs that basically do the same.
I disagree because the way Oolite works. Asteroid incorporates mission code that runs on every update time. So it keeps slowing down performance, even when finished the mission. (OXP's with the new java scripting wont have this problem). So for increasing performance a little it is better to have a separate OXP that only brings the asteroids.
I disagree with you. AsteroidStorm.oxp doesn't contain much code, so it doesn't considerably slow down the game. And for a version 3.1 there could even a clever outer condition be implemented, to prevent any further conditions-checking after finishing the mission. At the same time the currently 9 scripts could be combined into only one.

And on the other hand I find it user-unfriendly to expect everybody to remove AsteroidStorm.oxp as soon as the mission is finished and to replace it with Asteroids.oxp. That's not how people act.

So I still say: Make a new version of AsteroidStorm.oxp. Period.

Posted: Wed Jan 16, 2008 9:46 am
by LittleBear
Oh yeah forgot the script is pretty messy too! The showshipmodel command was broken at the time and somebody suggested that breaking it into seperate scripts would help. It didn't but I then never put it back into one. If I broke one script into two sets of conditions one that is only checked at the planet in question (as this is where most of the script commands are needed) and one that is only checked when docked (to give the mission failed / successful / attempted briefing), it would cut the checking down. The OXP doesn't do anything though execpt at the planet suffering from deadly asteroid storms as the adding asteroids to the general game is done by the system populator,

Posted: Wed Jan 16, 2008 3:45 pm
by Eric Walch
McLane, with putting things behind one end condition you probably mean:

Code: Select all

{
    "asteroid_storm" = (
        {
            conditions = ("mission_asteroids equal asteroids_FINISHED"); 
            do = (); 
            else = (
                {
                    conditions = ("dockedAtMainStation_bool equal YES"); 
                    do = (
                        {
                            conditions = (
                                "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_SHORT_RANGE_CHART", 
                                "mission_asteroids undefined", 
                                "galaxy_number equal 0", 
                                "planet_number equal 55", 
                                "score_number greaterthan 63"
                            ); 
                            do = (
                                "setMissionImage: GalCop.png", 
                                setGuiToMissionScreen, 
                                "setMissionMusic: warning.ogg", 
                                "addMissionText: asteroidsbrief_1", 
                                "set: mission_asteroids asteroids_BRIEFED", 
                                "set: mission_asteroids_statdead 0", 
                                "set: mission_asteroids_rockdead 0", 
                                "set: mission_asteroids_toldoff 0", 
                                "set: mission_asteroids_final 0"
                            ); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_RUNNING", 
                                "mission_asteroids_toldoff equal 0", 
                                "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_SHORT_RANGE_CHART", 
                                "galaxy_number equal 0", 
                                "planet_number equal 55"
                            ); 
                            do = (
                                "setMissionImage: GalCop.png", 
                                setGuiToMissionScreen, 
                                "setMissionMusic: warning.ogg", 
                                "addMissionText: asteroidsbrief_2", 
                                "set: mission_asteroids_toldoff 1"
                            ); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_COWARD", 
                                "mission_asteroids_final equal 0", 
                                "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_SHORT_RANGE_CHART"
                            ); 
                            do = (
                                "setMissionImage: GalCop.png", 
                                setGuiToMissionScreen, 
                                "addMissionText: asteroidsbrief_3", 
                                "awardCredits: -200", 
                                "setLegalStatus: 25", 
                                "set: mission_asteroids asteroids_FINISHED", 
                                "set: mission_asteroids_final 1"
                            ); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_OVER", 
                                "mission_asteroids_statdead equal 1", 
                                "mission_asteroids_final equal 0", 
                                "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_SHORT_RANGE_CHART"
                            ); 
                            do = (
                                "setMissionImage: GalCop.png", 
                                setGuiToMissionScreen, 
                                "addMissionText: asteroidsbrief_4", 
                                "awardCredits: 200", 
                                "set: mission_asteroids asteroids_FINISHED"
                            ); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_OVER", 
                                "mission_asteroids_statdead equal 0", 
                                "mission_asteroids_rockdead equal 1", 
                                "mission_asteroids_final equal 0", 
                                "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_SHORT_RANGE_CHART"
                            ); 
                            do = (
                                "setMissionImage: GalCop.png", 
                                setGuiToMissionScreen, 
                                "addMissionText: asteroidsbrief_5", 
                                "awardCredits: 1000", 
                                "setLegalStatus: 0", 
                                "awardEquipment: EQ_ENERGY_BOMB", 
                                "set: mission_asteroids asteroids_FINISHED", 
                                "set: mission_asteroids_final 1"
                            ); 
                        }
                    ); 
                }, 
                {
                    conditions = ("status_string equal STATUS_LAUNCHING"); 
                    do = (
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_BRIEFED" 
                            ); 
                            do = (
                                "removeEquipment: EQ_ENERGY_BOMB", 
                                "addSystemShips: ast1 27 1.0", 
                                "addSystemShips: badrock 1 1.0", 
                                "set: mission_asteroids asteroids_RUNNING", 
                                "set: mission_asteroids_toldoff 0"
                            ); 
                        }, 
                        {
                            conditions = (
                                "galaxy_number equal 0", 
                                "planet_number equal 55"
                            ); 
                            do = ("addSystemShips: ast1 3 1.0"); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_RUNNING" 
                            ); 
                            do = ("set: mission_asteroids_toldoff 0", "removeEquipment: EQ_ENERGY_BOMB"); 
                        }
                    ); 
                }, 
                {
                    conditions = ("status_string equal STATUS_EXITING_WITCHSPACE"); 
                    do = (
                        {
                            conditions = (
                                "galaxy_number equal 0", 
                                "planet_number equal 55"
                            ); 
                            do = (
                                "addSystemShips: ast1 3 1.0", 
                                "addSystemShips: ast1 2 0.0", 
                                "addSystemShips: asteroid 6 0.0", 
                                "addSystemShips: asteroid 4 0.6"
                            ); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids equal asteroids_RUNNING" 
                            ); 
                            do = (
                                "set: mission_asteroids asteroids_COWARD", 
                                "set: mission_asteroids_statdead 1", 
                                "setSpecificPlanetInfo: 0=55=station=none", 
                                "setSpecificPlanetInfo: 0=55=description=The planet Leesti is reasonably fabled for Zero-G cricket and Leestiian evil juice, but cursed by deadly asteroid storms. Leesti's orbital station was recently destroyed by a large asteroid strike. Ships without planet landing capabilities are therefore advised to avoid this system."
                            ); 
                        }, 
                        {
                            conditions = (
                                "mission_asteroids_statdead equal 1", 
                                "galaxy_number equal 0", 
                                "planet_number equal 55"
                            ); 
                            do = (
                                "setSpecificPlanetInfo: 0=55=station=none", 
                                "set: mission_asteroids asteroids_FINISHED"
                            ); 
                        }
                    ); 
                }
            ); 
        }
    ); 
}
This way all the code is skipped after mission completion. But although it just needs not to evaluate anything, after completion, it still has to read in the structure every update to see there is nothing to be done. But written in the above way the code will use only a few percent of the time after mission completion as it is using now.

With javascript the code can delete itself from execution. That would still be the best.

Posted: Thu Jan 17, 2008 1:06 pm
by Commander McLane
Yes, that's exactly what I mean. Thanks for doing it. :D

Oh, and I haven't really dug into the script (or the whole OXP, for that matter). So I can't tell whether there are other things that should be re-written or corrected for a new version. Perhaps you could be so kind?

Generally this first check for whether the final stage is reached, and put the whole script into the else-part can of course be applied to all mission scripts that have a final stage. (We could've done that to Deposed as well, but haven't. Perhaps I should return to it and create one final version 3.2?)

Posted: Fri Jan 18, 2008 11:54 am
by Ark
Commander McLane wrote:
So I still say: Make a new version of AsteroidStorm.oxp. Period.
I have to agree on that. Having 2 oxps in wiki that do the same think (increase the variation of asteroids) is not a good concept especially for new players ( :? ). If we can have an optimized version of asteroid storm it would be much better.

For one more time excellent work commander Eric