Progress

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Got around to ensuring that the list of changed JavaScript features for 1.73 is accurate.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Out of curiosity, what's the status of max vertex/triangle count for ship models and the (just saw the post about 1.73.1, before it was withdrawn again) the direct usage of .obj in addition to .dat files for them?
Last edited by Thargoid on Sat Sep 05, 2009 6:37 pm, edited 1 time in total.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

For the benefit of Mr. McLane, the SystemInfo objects generated by system.info are getting a bit more independent for 1.74. In particular:
  • SystemInfos now have galaxy, system and coordinates properties (read-only) in addition to planetinfo.plist keys.
  • They also have a distanceToSystem() method to measure the jump distance to another SystemInfo. (This is necessary because jump distances are calculated at a lower precision than normal vector distances in order to maintain the same jump routes as Elite.)
  • There is a function SystemInfo.filteredSystems() to search through systems, much like System.filteredEntities().
  • The prefix script provides a utility function SystemInfo.systemsInRange() to find the systems within a given distance from the current one.
The implementation of SystemInfo.systemsInRange() serves as a handy example:

Code: Select all

SystemInfo.systemsInRange = function(range)
{
    if (range === undefined)
    {
        range = 7;
    }
    
    var thisSystem = system.info;
    return SystemInfo.filteredSystems(this, function(other)
    {
        return (other !== thisSystem) && (thisSystem.distanceToSystem(other) <= range);
    });
}
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Thargoid wrote:
Out of curiosity, what's the status of max vertex/triangle count for ship models and the (just saw the post about 1.73.1, before it was withdrawn again) the direct usage of .obj in addition to .dat files for them?
As per the forgotten release notes, 1.73 supports arbitrary vertex and face counts, but most of the other model loading stuff stalled.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

In testing SystemInfo.filteredSystems(), I discovered a problem that also affected timers and system.filteredEntities(): when the function parameter is called,it’s done in such a way that it can’t access variables in the function that created it (in technicalese, it didn’t close over its declaring scope). This explains several problems I’ve encountered before, but not got around to analysing properly. (The use of thisSystem in the previous code snippet is an example.)

It turned out to be a known bug in SpiderMonkey; fortunately, there is a workaround, and it has now been fixed for 1.74.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

To better support strict mode, and to avoid buggy scripts carrying information across games, I intend to reload scripts whenever the game resets in 1.74 and forward. This means:
  • The reset() handler will no longer be called. Instead, a new instance of each script will be run, and startUp() called.
  • There will be no persistent timers.
Last edited by JensAyton on Wed Sep 09, 2009 5:36 pm, edited 1 time in total.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

All known bugs regarding Strict Mode are fixed.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

General note to OXPers: remember to include a requires.plist file if you use new features, like high vertex/face counts. I just tried to start 1.65 for testing, and it hung during startup due to over-large models in these OXPs:
  • griff_adder_normalmapped.oxp
  • ramon_anaconda.oxp
  • griff_boa.oxp
  • griff_cobra1_normalmapped.oxp
  • griff_cobra3_normalmapped_less_scuffed.oxp
  • griff_ferdelance_normalmapped.oxp
  • griff_krait_normalmapped.oxp
  • griff_sidewinder_normal_mapped.oxp
  • griff_thargoids_normalmapped.oxp
  • Neolite.oxp
There are almost certainly more with this problem, these are just the ones I happened to have installed at the time.

We have a nice, simple mechanism to avoid this, but it is (by necessity) the responsibility of OXPers to use it. If you haven’t tested with 1.65, you must include a requires.plist with { version="<the oldest version you’ve tested with"; } in it.

I’d quite like to simply refuse to load OXPs without one, but that would break compatibility with old OXPs that actually work.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Ahruman wrote:
For the benefit of Mr. McLane...
I am thrilled! :D :D :D

Actually I just stumbled across the distinct difference between the planetinfo.plist-properties and the system-properties in respect to the SystemInfo objects, when Oolite refused to respond to System.infoForSystem(galaxyNumber, i).techLevel = 0. Turned out the planetinfo-property is techlevel, not techLevel.

Now there is yet one thing I'd like to do: Setting government, economy, and techlevel to something like "N/A" instead of one of the pre-defined values. Doable?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Commander McLane wrote:
Now there is yet one thing I'd like to do: Setting government, economy, and techlevel to something like "N/A" instead of one of the pre-defined values. Doable?
Err, doable already, set the system property to nova:

System.infoForSystem(galaxyNumber, i).sun_gone_nova = true;

About the techlevel/techLevel thing: yes, I noticed the inconsistency too! One is the property of system, the other a property of info.

Same thing happens here: system.techLevel = system.info.techlevel

Unfortunately the lower case property is the key as it appears in planetinfo.plist. Probably the best way to remove the inconsistency is for us to completely remove the convenience shortcuts:

I'm sure Frame wouldn't be too pleased about the idea, but we could deprecate system.name in favour of system.info.name, system.techLevel in favour of system.info.techlevel.

As an aside, techlevel, according to the way most oolite plist keys are written, should really have been written tech_level to begin with. But let's not talk about that yet!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Kaks wrote:
Commander McLane wrote:
Now there is yet one thing I'd like to do: Setting government, economy, and techlevel to something like "N/A" instead of one of the pre-defined values. Doable?
Err, doable already, set the system property to nova:

System.infoForSystem(galaxyNumber, i).sun_gone_nova = true;
Interesting solution. But wouldn't that have some side-effects as well (like the system not being visitable anymore)? Well, will try it out.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Kaks: I think a better solution might be to support camelCase properties for “well-known” properties like techLevel and sunGoneNova, and also continue to support arbitrary keys (or possibly only arbitrary keys without capital letters). Need to think about it a bit.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Commander McLane wrote:
Interesting solution. But wouldn't that have some side-effects as well (like the system not being visitable anymore)? Well, will try it out.
Good point. There might be a scriptable way to survive inside a nova system. You can already resize the sun to something smaller, and shrink its corona too, but I wouldn't know what happens to ship temperatures once you do that.... If it's possible to make a novaed system survivable, you could add all sort of planets, stations & stuff... :)

Ahruman: yep, it's a bit of a conundrum that one. camelCase is the standard for js, and underscore_as_space is the standard we mostly stick to for plists.
Of course, that's not the case in descriptions.plist. There the hyphen-between-words notation reigns supreme!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Kaks wrote:
camelCase is the standard for js, and underscore_as_space is the standard we mostly stick to for plists.
Of course, that's not the case in descriptions.plist. There the hyphen-between-words notation reigns supreme!
Consistence above all ;-)
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

At least we is consistently inconsistent.. :lol:
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Post Reply