[WIP] LibPlanetInfo 0.1

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Post Reply
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

[WIP] LibPlanetInfo 0.1

Post by cim »

Inspired by a comment of Maik's, here's a short library to organise planetinfo and deal with conflicts between OXPs.

This is a test version for proof of concept. It does nothing at all of use at the moment. Unless you're an OXP developer who would like to use this functionality and wants to see how it might work, you probably shouldn't even download it. It doesn't do anything on its own, anyway.

Still reading after that warning? Here's the link: LibPlanetInfo 0.1

The basic problem is that if more than one OXP wants to add planet info description data for the same system, the result is an unpredictable mess. If they both use planetinfo.plist entries, then only one - and not even necessarily a consistent one - can win. If they use system.info, then the changes can remain long after the OXP is uninstalled, and there's still no easy way to deal with two OXPs acting at once.

So, here's a short library OXP to allow other OXPs to co-ordinate their efforts in an agreed fashion.

When you hit the F7 key, the library looks through its list of registered OXPs, and calls each of them in order to dynamically build up a system description in four categories. When you move away from the system data screen, it discards the information again to keep it out of the save file.

Information is currently available in four categories:
  • General: the information currently in the base game, or flavour text added by OXPs like Famous Planets. If nothing changes it, this will be whatever planetinfo.plist would normally say.
  • Economy: special economic information. Bloomberg Markets, New Cargoes, etc.
  • Affiliation: "This is GalNavy Sector Command 3", "This is one of the Royal Houses of Santaari", etc.
  • Mission: temporary information added by mission OXPs.
I'm considering adding a category for sector information, too: "This is on Spaceway 3", "This is part of the Sidewinder Expanse".

To make room for this information, your HUD will be temporarily disabled on the F7 screen.

0.1 comes with a demonstration script (Scripts/libplanetinfo-demo.js) to show off the functionality. If you have Famous Planets installed, then Arexe in Chart 1 is a good example. (All planetinfo.plist-only OXPs are automatically compatible with this OXP, though not of course with each other...)

Between the readme.txt and the demonstration script the API should be pretty obvious. There will be more documentation later.

Known issue: Your save file will eventually fill up with a load of blank planet entries. This is a bug/feature in the way Oolite manages local_planetinfo_overrides. Any other OXP that sets and then unsets system.info is affected in the same way; if you play long enough, Bloomberg Markets will also fill up your save file, though at perhaps a millionth of the rate that this OXP will. Total impact - probably about 100k of extra file size once you've thoroughly explored the eight, 95k of which is XML padding.

So, what do you think? Is this worth doing? Is the API sufficient? Are there any unexpected issues with doing it this way?
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Re: [WIP] LibPlanetInfo 0.1

Post by pagroove »

Gonna try it out! Looks interesting. I will look at Arexe.
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
Post Reply