jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

ENH: HUD? #37

Closed jpcsupplies closed 6 years ago

jpcsupplies commented 8 years ago

What are your thoughts on this? - In line with the role play elements of this being a "trade interface" is it worth looking into adding a HUD? Like top left or right displays player balance, and later on maybe basic stats on how many items are for sale/on order/fulfilled/active contracts.

Eg: Balance: 100 | Faction: UFP | Ordered: 3 / Filled: 75% | Selling: 2 / Sold 50% | Contracts Held: 2 / Available: 4 | Next deadline 00h:09m:04s

Or something prettier or less cluttered. Maybe offer players commands to turn on or off particular hud info.

The GPS mod in the autopsy list seemed to work well with no lag, and it polled the players location and updasted an on screen hud. We dont need gps coords anymore thanks to gps points obviously, but the info we have would require much less polling that coords so it shouldnt be causing physics lag..

midspace commented 8 years ago

I think I mentioned this, but I've been considering something like this for my Scan mod.

Currently, most LCD mods work by using the Programmable Block. But they have the convenience of accessing the Ingame Api, which gives them plenty of access to information about the Grid that the LCD is attached to.

The problem is once you move into the Mod API Script (not Ingame) to get access to more information, your PB LCD no longer has access to this information. Ingame cannot access Mod API.

Now, what you could do is write a Custom LCD which would have it's own logic to access the Mod API Script code. The logic would run on the server I believe, and not the clients (I haven't tested this. I'm assuming, but I hate to assume). Except that there is a limitation. You can only have 1 Custom block of any given type that accesses Mod API code. If there is another Mod out there written as a customized LCD, it will conflict with ours, and only one of them will run. There are a a couple of attempts on the Keen Git source to address this issue, but Git PR's are on hold at the moment, so there is no fix in sight for this issue.

The alternative I've been considering is based on the code we have added for the Client/Server interaction. We could add a command for a user use when pointing at a LCD, which will connect the LCD to the 'Merchant Network' (just made that up now). What it does, is tells the Server code to track that particular LCD block, and update it with the trade interface at regular intervals. As the Server has all the information it needs, and the server itself will be aware if information changes, it can update the LCD when it is ready. We can also enforce delays, to prevent updating the LCD too often, which is usually the cause of Server's slowing down (run-away mods doing too much processing).

Of course we need to add in various checks, like if the LCD is hacked, or destroyed to remove it from the Server update list. If it's turned off, then it stops updating.

jpcsupplies commented 8 years ago
I was thinking more an on-screen hud (your scanner could do that too actually -eg ------------------------------- -------------------

\ |

the pipe being the direction of the detected vessel.. in effect a crude target lock radar hud (actually you could expand your scan mod to be a full radar mod, use numbers to indicate ships by distance and direction, or have a LCD in the background with a proper radar read out visible from control seat)

Not sure if you have been on a server while GPS mod is running but it displays on the top of the game screen in the middle your current coordinates. I was thinkning use the same top row for some sort of economic summary.

But using LCDs for detailed info on trades and so on, would be great idea too.. i love the idea "connect to trade network" thats cool, you could display realtime trade info. might even be able to use the picture display function to show a pic of the item lol Use phoenix's trick (from FTL MOD - different phoenix to me) of scanning for objects with a particular name (in his case FTL) and use that for things like deciding which way is the front, what sound block to play the jumping sound from, what LCD to display jump statistics on etc

midspace commented 8 years ago

There was one thing someone showed me a while ago, was a PB block and script, with a Control Panel operating in conjunction with a LCD. The Control Panel's 4 buttons were like a Mobile phone. Up/Down, Enter/Back. It allowed to scroll through an interactive menu on the LCD, and was very responsive.

jpcsupplies commented 8 years ago

The in game scripting can do some crazy stuff on lcds, in my periodic /tps 's to locate derelicts or space junk to clean up, ive come across some ships and bases running some pretty crazy data read outs on their LCD screens.

jpcsupplies commented 8 years ago

Hmmm - I might just make a basic hud that displays player balance(using our currency type string), faction, and trade network...

Eg. Blue Mining Inc Trade Network: Balance: 100 Credits, Employed by BLU "XX(name) Trade Network: Balance YY ZZ(currency unit), Employed by YZ(faction)"

jpcsupplies commented 8 years ago

Oooo something useful - Have the hud show all available storage/mining space vs how full that space is.. eg. Blue mining inc trade network. Balance 100 Credits. Cargo used: 34000 / 48000. Employed at BLU

This would be handy if you fly into a trade region and you know how much space you have left to fill, or if you are mining you know how much more to mine before the miner is full.

jpcsupplies commented 8 years ago

Note to self use client init to set header, then update message class to update balance. This leaves being paid by pay command as a bug where it wont update correctly.. add update in client was paid notifier

midspace commented 8 years ago

I want to say that MyAPIGateway.Utilities.GetObjectiveLine() should be only used for mission objectives, not for displaying status messages. Short term, quest like objectives that are only there until you complete the quest. It's a missuse of the API for something that should be used for missions.

Unfortunately, there isn't any other API for a persistent on screen text.

I did implement this particular API for my derelict scanner, as a mission oriented task. You set an objective to a specific derelict. It provides directions on the objective line as you approach. Once you reach it the objective is completed. If you exit the cockpit, the objective is cancelled.

jpcsupplies commented 8 years ago

Would it be worth asking keen about adding some sort of modapi "writepos(string,row,column)" facility to the game? (i am surprised there isnt actually)

jpcsupplies commented 8 years ago

This code has a section that displays a cargo graph similar to what I am trying to do in the hud - any chance of adapting this for the cargo readout on our hud? https://gist.github.com/jpcsupplies/d99da5ca22e21b4f22ed id prefer kgs to % tho so if a player isnt in a ship you see carried inventory space

jpcsupplies commented 6 years ago

supercede last point to #36