Skip to content

8. General notes to self

jpcsupplies edited this page Sep 29, 2015 · 8 revisions

========================= re inventry access This is the Admin command for clearing your own player inventory. https://github.com/midspace/Space-Engineers-Admin-script-mod/blob/master/midspace%20admin%20helper/Data/Scripts/midspace.adminscripts/InventoryManagement/CommandInventoryClear.cs

The code would go a little like this.

var inventoryOwnwer = player.Controller.ControlledEntity as IMyInventoryOwner; var inventory = inventoryOwnwer.GetInventory(0) as Sandbox.ModAPI.IMyInventory; //inventory.Clear();

decimal amount = 123; var items = inventory.GetItems(); foreach (var item in items) { if (item.Content.TypeId == ???? && item.Content.SubtypeName == ??) { var point = MyFixedPoint.DeserializeString(amount.ToString(CultureInfo.InvariantCulture)); MyFixedPoint altPoint = (MyFixedPoint)amount; inventory.RemoveItems(item.ItemId, point); } }

================== I just had a thought - maintain pay others, buy/sell to server (NPC RRP list) to run within game.. but for the commodity market part have that exclusive to a website?

https's can be configured to work a virtual directory out of the appdata/game/storage folder - which gives it the inside track on talking to the server data files directly, assuming we close all our files between uses in game, and work similarly on the http side (means on error routines to retry loading file on lock error) this avoids needing any sort of communication channel to the server itself at all.. the website can directly alter player balances - and means programming requires no familiarity with the keen mod api, just the layout of the file, and some cgi/perl/php skill - which are much better documented.

Things get tricky if we want to do real estate tho; we need a method to tell the game mod to change ownership in game; but for resources should be fine.

Maybe the in-game market first makes more sense.. but one day knock up a web site that can read the same data file structures... getting way ahead of myself tho, this level of features would be several milestones before we even think about doing them.

======= Is it worth adding an option to back the value of currency with something like gold ingots; this adds extra complexities such as automatically updating a players bank balance based on the value of any gold ingots he has refined; which given the ambiguity of ownership in a faction refinery may render this idea unworkable; short of making the trade block belong to a faction, and gold deposited into it increases their NPC trading funds and having a faction bank seperate to player balances.. (actually i like that idea - it means players can manage their NPC trader's bank balance if they maintain elite style trade - ie multiple markets with different ores for sale or wanted by each space station - maybe consider this a late stage upgrade to the mod) ?????????????????

================== I wonder if it is possible for two installed mods to communicate with each other.. that way other mods could potentially access the economy implemented in this mod that worked out well in economy mods under minecraft; someone might create for example a "jobs" mod where players become employees or such in a career (mining building etc), or a role play mod where they uncover/hack treasure, collect bounties, do missions etc and get paid via the economy mod, or other server staff, or particular players get paid an "allowance" under some mods? ?????????????????

=============== The mod probably needs a better name than simply "Econ" Suggestions: Blue Mining Trader Mod Economy Mod Blue Trading Mod Etc ????????????????

If the bank balance and default value file can be stored in a common folder, it could become accessable to all game servers running maps on that machine with this mod installed..

this means items sold by miners mining map 2, would be available to players playing map 1 for example.. likewise the default value file is a fixed list so sharing it shouldnt hurt as it never gets written to.. possible issues - file locked, need to implement a catch and try error detection routine to retry reading the file - potentially tho this could become an issue if two maps try to add items to the market at once, as the reads and writes might not have completed, resulting in the second item being added while the first item vanishes.. in elite style however this wouldnt be an issue as markets are tied to a particular space station trade block; other maps wont share those.. kills the global market idea off somewhat tho; unless we also implement ways to travel between the worlds; if nothing else the players bank balance carries over anyway so not so bad

????????????

Units should be in decimal places. Variables to 8 decimal places.

Then converted - 1 unit of currency = for example 0.00000100 Used in game would be shown as 1.00 So 1 whole real unit would be equal to 1,000,000.00 in game (or 1.00000000)

This is a simple multiply by 1000000 function in the progam code before display as in game currency. Or a divide by 1000000 to convert back to the real world currency or crypto or This allows future use with crypto integration if possible.

Ie, a server manager could purchase a single unit of cryto currency eg ltc or mrs which is worth between 10 cents and $4 - each and then divide that into units of game currency.

That way a cash shop could use real crypto coin, (or even fiat dollars and cents) but not really cost more than a few cents to maintain massive in game currency reserves.

Note: This level may only need to function at the website end - the mod itself could just stick with whole units, and they only get converted back at the web shop stage.

?????????

Further notes: I wonder if it is possble to make simple outbound socket connections from a mod. Probably not. This limits communication to readonly command queue files and flag files on the same server as the game server and webserver.

??????????