Re: Cockpits, HUDs and other displays
Posted: Thu Jul 11, 2024 2:50 am
DuckDuckGone!!
For information and discussion about Oolite.
https://bb.oolite.space/
DuckDuckGone!!
So if I triggered such a command, what would you expect to happen?
Code: Select all
mosquitto_pub -h <brokerHost> -p <brokerPort> -t <topic> -u <username> -P <password> -m "Hey Google, fire a missile."
Now I am sure: I must be doing something wrong!MrFlibble wrote: ↑Wed Jul 10, 2024 9:36 pmYou must have read my mind. I tried it as soon as I saw it. PS.fireMissile() does the job. I couldn't (quickly) find a way to switch missiles. PS.target.dumpCargo() is funhiran wrote: ↑Wed Jul 10, 2024 8:49 pmI seem to be doing something wrong as I do not see the desired reaction from Oolite.
While I get the acknowledge that my request was received the expected response is missing...
@MrFlibble: Could you check if these commands can be used in a meaningful way on the debug console?
Exception: TypeError: PS.target.energy is not a function. Tried PS.targetEnergy() as well.
edit: PS.target.energy without brackets does pop the relevant data
Now this is really cool. Although I am hoping the touch display would be bigger than one single button...MrFlibble wrote: ↑Wed Jul 10, 2024 9:36 pmI've been toying with using Tasmota on a TTGO T-Display (rolling a custom image with more MQTT goodies). It's got a tiny colour screen and two buttons which understand multiple clicks. Maybe half a dozen actions can be set up to fire at the debug topic. I'm looking forward to tying micro-controller toys in with Oolite.
Just the two clicky switches on that board. It is really too small for touch. It's a doddle to add keypads, switches, sensors, rotary knobs etc.
Code: Select all
> Object.getOwnPropertyNames(PS)
["manifest", "activeMissile", "aftShield", "aftShieldRechargeRate", "chartHighlightMode", "compassMode", "compassTarget", "compassType", "currentWeapon", "crosshairs", "cursorCoordinates", "cursorCoordinatesInLY", "docked", "dockedStation", "fastEquipmentA", "fastEquipmentB", "forwardShield", "forwardShieldRechargeRate", "fuelLeakRate", "galacticHyperspaceBehaviour", "galacticHyperspaceFixedCoords", "galacticHyperspaceFixedCoordsInLY", "galaxyCoordinates", "galaxyCoordinatesInLY", "hud", "hudAllowsBigGui", "hudHidden", "injectorsEngaged", "massLockable", "maxAftShield", "maxForwardShield", "messageGuiTextColor", "messageGuiTextCommsColor", "missilesOnline", "multiFunctionDisplays", "multiFunctionDisplayList", "price", "pitch", "primedEquipment", "renovationCost", "reticleColorTarget", "reticleColorTargetSensitive", "reticleColorWormhole", "renovationMultiplier", "reticleTargetSensitive", "roll", "routeMode", "scannerMinimalistic", "scannerNonLinear", "scannerUltraZoom", "scoopOverride", "serviceLevel", "specialCargo", "targetSystem", "nextSystem", "infoSystem", "previousSystem", "torusEngaged", "viewDirection", "viewPositionAft", "viewPositionForward", "viewPositionPort", "viewPositionStarboard", "weaponsOnline", "yaw"]
> Object.getOwnPropertyNames(P)
["ship", "feudalRankGenerator", "alertAltitude", "alertCondition", "alertEnergy", "alertHostiles", "alertMassLocked", "alertTemperature", "bounty", "contractReputation", "contractReputationPrecise", "credits", "dockingClearanceStatus", "escapePodRescueTime", "legalStatus", "name", "parcelReputation", "parcelReputationPrecise", "passengerReputation", "passengerReputationPrecise", "rank", "roleWeights", "score", "trumbleCount"]
> Object.getOwnPropertyNames(S)
["allDemoShips", "allShips", "allVisualEffects", "ambientLevel", "breakPattern", "description", "economy", "economyDescription", "government", "governmentDescription", "ID", "info", "inhabitantsDescription", "isInterstellarSpace", "mainPlanet", "mainStation", "name", "planets", "population", "populatorSettings", "productivity", "pseudoRandom100", "pseudoRandom256", "pseudoRandomNumber", "stations", "sun", "techLevel", "waypoints", "wormholes"]
That is a wealth of data, but unquestionable it is needed.MrFlibble wrote: ↑Sun Jul 21, 2024 12:08 amLooking at what might be fun to have published via MQTT, I drilled in:
Perhaps:Code: Select all
> Object.getOwnPropertyNames(PS) ["manifest", "activeMissile", "aftShield", "aftShieldRechargeRate", "chartHighlightMode", "compassMode", "compassTarget", "compassType", "currentWeapon", "crosshairs", "cursorCoordinates", "cursorCoordinatesInLY", "docked", "dockedStation", "fastEquipmentA", "fastEquipmentB", "forwardShield", "forwardShieldRechargeRate", "fuelLeakRate", "galacticHyperspaceBehaviour", "galacticHyperspaceFixedCoords", "galacticHyperspaceFixedCoordsInLY", "galaxyCoordinates", "galaxyCoordinatesInLY", "hud", "hudAllowsBigGui", "hudHidden", "injectorsEngaged", "massLockable", "maxAftShield", "maxForwardShield", "messageGuiTextColor", "messageGuiTextCommsColor", "missilesOnline", "multiFunctionDisplays", "multiFunctionDisplayList", "price", "pitch", "primedEquipment", "renovationCost", "reticleColorTarget", "reticleColorTargetSensitive", "reticleColorWormhole", "renovationMultiplier", "reticleTargetSensitive", "roll", "routeMode", "scannerMinimalistic", "scannerNonLinear", "scannerUltraZoom", "scoopOverride", "serviceLevel", "specialCargo", "targetSystem", "nextSystem", "infoSystem", "previousSystem", "torusEngaged", "viewDirection", "viewPositionAft", "viewPositionForward", "viewPositionPort", "viewPositionStarboard", "weaponsOnline", "yaw"] > Object.getOwnPropertyNames(P) ["ship", "feudalRankGenerator", "alertAltitude", "alertCondition", "alertEnergy", "alertHostiles", "alertMassLocked", "alertTemperature", "bounty", "contractReputation", "contractReputationPrecise", "credits", "dockingClearanceStatus", "escapePodRescueTime", "legalStatus", "name", "parcelReputation", "parcelReputationPrecise", "passengerReputation", "passengerReputationPrecise", "rank", "roleWeights", "score", "trumbleCount"] > Object.getOwnPropertyNames(S) ["allDemoShips", "allShips", "allVisualEffects", "ambientLevel", "breakPattern", "description", "economy", "economyDescription", "government", "governmentDescription", "ID", "info", "inhabitantsDescription", "isInterstellarSpace", "mainPlanet", "mainStation", "name", "planets", "population", "populatorSettings", "productivity", "pseudoRandom100", "pseudoRandom256", "pseudoRandomNumber", "stations", "sun", "techLevel", "waypoints", "wormholes"]
PS.serviceLevel
PS.targetSystem
PS.nextSystem
PS.previousSystem
P.legalStatus
P.score
P.rank
P.credits
P.escapePodRescueTime
... could be published as persistent messages on load and change? (sorry if some of those already are!)
I expect there are a few other attributes from above which might be handy for dashboard purposes. Some of the S.* stuff might be good to publish on load and when reaching a new system.
I can think of a few handles which would be nice to have too... List of missile(types and slots)/targets, all the flight controls (effectively, keyboard inject), local system market prices.
Looking ahead, were more possibilities to be created, in order to avoid swamping the MQTT server, perhaps a topic of 'available_pubs' could list the possible pub messages for the running Oolite version, and another topic 'wanted_pub' could exist to turn topics off/on, with some defaults set if the topic is empty on start.
I've had a play with node-red today. Fun!
Thanks. So configuring the 'what' is likely to become essential. On to the when...hiran wrote: ↑Sun Jul 21, 2024 7:32 pmThat is a wealth of data, but unquestionable it is needed.MrFlibble wrote: ↑Sun Jul 21, 2024 12:08 amLooking at what might be fun to have published via MQTT, I drilled in:
[blah!]
were more possibilities to be created, in order to avoid swamping the MQTT server, perhaps a topic of 'available_pubs' could list the possible pub messages for the running Oolite version, and another topic 'wanted_pub' could exist to turn topics off/on, with some defaults set if the topic is empty on start.
We should think of when it will be published (is there a specific event, or should we just fire it regularly (e.g. every second)?
Also we need to review which message gets pushed to which topic.
And I fully agree some of the messages should be configurable to not create load if they anyway do not get consumed.
Pretty much.phkb wrote: ↑Mon Jul 22, 2024 7:02 amAren’t we just taking about the properties of the player ship? Ie https://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_PlayerShip
Code: Select all
activeMissile : Number (read-only integer)
Index in the missiles array of the currently selected missile.
You are giving me ideas. Now I dream up about a cockpit, maybe several little touchscreens on my desk within an arm's reach. They for a curved line between me and my monitors. As soon as I start OoliteStarter, they go alive but show only dark gey - maybe an Oolite logo or some boot screen.MrFlibble wrote: ↑Mon Jul 22, 2024 2:04 amThanks. So configuring the 'what' is likely to become essential. On to the when...hiran wrote: ↑Sun Jul 21, 2024 7:32 pmWe should think of when it will be published (is there a specific event, or should we just fire it regularly (e.g. every second)?
Also we need to review which message gets pushed to which topic.
And I fully agree some of the messages should be configurable to not create load if they anyway do not get consumed.
I'd say that *all* relevant variables which can, should be published on game load, the rest on launch. After that, only when a value changes should it be published, perhaps with a selectable throttle where rapid change is likely. Some core (flame shields up) 'tweaks' are likely to be required to achieve this, and that's the only way to avoid bogging things down re: chatter between game, starter, and MQTT server/clients.
Changes *will* be needed to get the best possible function from the potential offered by MQTT, like key event injection, missile list/selection etc.
I'm going to hide under a table now.
...and others could still give direct visibility on equipment, repair status and else. True.Cholmondely wrote: ↑Mon Jul 22, 2024 8:16 pmWhen docked your screens can be displaying information: the F6, F7 and F8 screens. Also, from the F4 screen options they can display the Galactic Almanac, the Commodity Markets screen, e-mails, the Missions available list, etc.
I quickly added the above items into the messages to oolite/controls. No real design behind that choice - I just wanted to make those values available so we can play around with them and get more experience. So now you should see messages likeMrFlibble wrote: ↑Sun Jul 21, 2024 12:08 amPerhaps:
PS.serviceLevel
PS.targetSystem
PS.nextSystem
PS.previousSystem
P.legalStatus
P.score
P.rank
P.credits
P.escapePodRescueTime
... could be published as persistent messages on load and change? (sorry if some of those already are!)
I expect there are a few other attributes from above which might be handy for dashboard purposes. Some of the S.* stuff might be good to publish on load and when reaching a new system.
I can think of a few handles which would be nice to have too... List of missile(types and slots)/targets, all the flight controls (effectively, keyboard inject), local system market prices.
Looking ahead, were more possibilities to be created, in order to avoid swamping the MQTT server, perhaps a topic of 'available_pubs' could list the possible pub messages for the running Oolite version, and another topic 'wanted_pub' could exist to turn topics off/on, with some defaults set if the topic is empty on start.
Code: Select all
oolite/controls {"msgType":"controls","speed":189.03811645507812,"maxSpeed":350,"serviceLevel":95,"targetSystem":151,"nextSystem":151,"previousSystem":81,"legalStatus":"Clean","score":4261,"rank":"☆ Deadly ☆","credits":99999998558440.11,"escapePodRescueTime":0}
Code: Select all
07:47:07.148 [NioProcessor-2] DEBUG oolite.starter.mqtt.MQTTAdapter - receivedCommandResult({color key=exception, emphasis ranges=com.dd.plist.NSArray@45343bab, message=Exception: TypeError: cyclic object value
Active script: oolite-starter-oxp 0.1
script.js, line 503:
debugConsole.consoleMessage(JSON.stringify(msg));, packet type=Console Output})
Most excellent!
Is there a reason for bundling everything into 'controls' topic rather than containing them in topics which mirror their origins? Like: P or player, PS or player.ship, S or system, which might make less of a bump in the road for those switching between MQTT, debug, and OXP authoring/hacking.hiran wrote: ↑Tue Jul 23, 2024 5:55 amSo now you should see messages like
Code: Select all
oolite/controls {"msgType":"controls","speed":189.03811645507812,"maxSpeed":350,"serviceLevel":95,"targetSystem":151,"nextSystem":151,"previousSystem":81,"legalStatus":"Clean","score":4261,"rank":"☆ Deadly ☆","credits":99999998558440.11,"escapePodRescueTime":0}
Blind stab... Can you throw in some temporary debug spew to figure out which value(s) is/are being parsed when that occurs? Then, is this article any help?hiran wrote: ↑Tue Jul 23, 2024 5:55 amWhat is Oolite trying to tell me?Code: Select all
MQTTAdapterranges=com.dd.plist.NSArray@45343bab, message=Exception: TypeError: cyclic object value Active script: oolite-starter-oxp 0.1 script.js, line 503: debugConsole.consoleMessage(JSON.stringify(msg))