[Release] In System Trader OXP 1.40!

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

Moderators: winston, another_commander

User avatar
Dr.Tripsa
Dangerous
Dangerous
Posts: 84
Joined: Mon Apr 30, 2012 9:33 pm
Location: In your cargo bay, eating your chips.

Re: [Release] In System Trader OXP 1.30!

Post by Dr.Tripsa »

Ok folks, I am now officially happy with the In System Trader!

We now have an optional bit of equipment:
The Autonomous Market Watch Unit, or A.M.W. Unit
Listing at 500 cr. at all good TL9+ Shipyards

Brought to you by Tripsa Tel-com.

The Unit will inform you when a commodity's amount or price has changed in the local system Market!

see OP for details!
No, I'm not a Trumble... that's a speciest and offensive remark!
~munch~
What?.... I'm hungry.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] In System Trader OXP 1.30!

Post by spara »

Ok. Tested this quite a bit tonight. Got to the point where rats got seriously itchy. I was a bit amused that my Commander with 18 kills under belt and flying an Adder required 10 pirates to stop from making some in-system trading :D. Maybe some scaling of the number of foes would be in order? Anyway, I had no trouble injecting my way through and off I was to a nearby Kiota station to get some radioactives (BlOomberg and extra stations makes a nice moneymaking machine :wink:). When I got back, police had done it's job and there were tons of cargo canisters to loot. Docked, sold my cargo, fueled and off I go to get more radioactives and there's 10 new pirates waiting again! Injected through... and so on :(. I think this pirate part of this oxp needs some serious work to make it usable.

I really like the changing markets part (including the equipment). The friends part and the comms messages give some nice color as long as they don't get too repetitive and frequent (it happens easily, if the texts are too few and too 'special' and always trigger at the same point). The pirate part in my opinion does not work as visioned. Some randomization / scaling would be in order. And something needs to be done about that furball triggering every time I launch, it does not feel right. Ambush somewhere else? Maybe some special pirates?

Hope this helps to develop this oxp further, I see great potential in it. :D
User avatar
Dr.Tripsa
Dangerous
Dangerous
Posts: 84
Joined: Mon Apr 30, 2012 9:33 pm
Location: In your cargo bay, eating your chips.

Re: [Release] In System Trader OXP 1.30!

Post by Dr.Tripsa »

spara wrote:
Ok. Tested this quite a bit tonight. Got to the point where rats got seriously itchy. I was a bit amused that my Commander with 18 kills under belt and flying an Adder required 10 pirates to stop from making some in-system trading :D. Maybe some scaling of the number of foes would be in order? Anyway, I had no trouble injecting my way through and off I was to a nearby Kiota station to get some radioactives (BlOomberg and extra stations makes a nice moneymaking machine :wink:). When I got back, police had done it's job and there were tons of cargo canisters to loot. Docked, sold my cargo, fueled and off I go to get more radioactives and there's 10 new pirates waiting again! Injected through... and so on :(. I think this pirate part of this oxp needs some serious work to make it usable.

I really like the changing markets part (including the equipment). The friends part and the comms messages give some nice color as long as they don't get too repetitive and frequent (it happens easily, if the texts are too few and too 'special' and always trigger at the same point). The pirate part in my opinion does not work as visioned. Some randomization / scaling would be in order. And something needs to be done about that furball triggering every time I launch, it does not feel right. Ambush somewhere else? Maybe some special pirates?

Hope this helps to develop this oxp further, I see great potential in it. :D
I blame you for my lack of a social life, Spara. Just kidding!

1.35 has changed the way the pirates work, you get them less often and now instead of furballing the station they harass the spacelanes. This will effectively increase the wait time for Market changes as well as make those trips to other stations in the space lanes that much more hazardous.

I've also reduced the chances of a Station greeting and made the greetings a bit more random in nature.

Fixed as well is a bug that could change prices on you WHILE docked.
No, I'm not a Trumble... that's a speciest and offensive remark!
~munch~
What?.... I'm hungry.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] In System Trader OXP 1.30!

Post by spara »

Dr.Tripsa wrote:
I blame you for my lack of a social life, Spara. Just kidding!
What? You still have some? :lol:
Dr.Tripsa wrote:
Fixed as well is a bug that could change prices on you WHILE docked.
I can see that you have gone through some effort to prevent the prices from changing while docked, but can't really see the reason for it. Except maybe some caution not to break other oxps. If you let the prices change while not in the market screen, it probably should not cause any trouble. It would make sense that the prices might change while fueling or doing something that passes the time.

Looking forward to test the latest version later today. Keep up the good work.
User avatar
Dr.Tripsa
Dangerous
Dangerous
Posts: 84
Joined: Mon Apr 30, 2012 9:33 pm
Location: In your cargo bay, eating your chips.

Re: [Release] In System Trader OXP 1.30!

Post by Dr.Tripsa »

spara wrote:
]I can see that you have gone through some effort to prevent the prices from changing while docked, but can't really see the reason for it. Except maybe some caution not to break other oxps. If you let the prices change while not in the market screen, it probably should not cause any trouble. It would make sense that the prices might change while fueling or doing something that passes the time.

Looking forward to test the latest version later today. Keep up the good work.
That's exactly it actually, Want to keep this OXP 'friendly' to other OXPs, that and I want to avoid at all costs any changes which might have a player thinking they will pay one price while quite another gets deducted.

I could have it check for the Screen yes, but what if a change happened 'just as' the screen changed...
This actually happened to me when testing , Furs jumped about 20CR / TC , costing me much more than what was on the screen.

better IMHO to lock in a price set once docked until undocked.
No, I'm not a Trumble... that's a speciest and offensive remark!
~munch~
What?.... I'm hungry.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] In System Trader OXP 1.30!

Post by spara »

Dr.Tripsa wrote:
spara wrote:
]I can see that you have gone through some effort to prevent the prices from changing while docked, but can't really see the reason for it. Except maybe some caution not to break other oxps. If you let the prices change while not in the market screen, it probably should not cause any trouble. It would make sense that the prices might change while fueling or doing something that passes the time.

Looking forward to test the latest version later today. Keep up the good work.
That's exactly it actually, Want to keep this OXP 'friendly' to other OXPs, that and I want to avoid at all costs any changes which might have a player thinking they will pay one price while quite another gets deducted.

I could have it check for the Screen yes, but what if a change happened 'just as' the screen changed...
This actually happened to me when testing , Furs jumped about 20CR / TC , costing me much more than what was on the screen.

better IMHO to lock in a price set once docked until undocked.
Fair enough. Better play it safe. I have now tested this newest version for a bit and it feels much better. Markets feel more alive and I get occasional messages from friends (did not know I had any :D). Haven't encountered any pirates (except ds ones) yet though.
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"

Re: [Release] In System Trader OXP 1.30!

Post by Diziet Sma »

spara wrote:
I get occasional messages from friends (did not know I had any :D).
Those would be Facebook-type "friends" then.. you know, the kind that wouldn't actually bother to attend your funeral.. :wink: :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
User avatar
Dr.Tripsa
Dangerous
Dangerous
Posts: 84
Joined: Mon Apr 30, 2012 9:33 pm
Location: In your cargo bay, eating your chips.

Re: [Release] In System Trader OXP 1.40!

Post by Dr.Tripsa »

Well after much testing and revision I'd like to submit In System Trader for inclusion in the wiki OXPList,
Classified: mechanics OXP

-Overview-

In System Trader 1.4
By Dr.Tripsa 2013
Licence: CC BY 3.0
Requires Oolite version 1.77

-Description-

Introduces a "living market" to systems with rewards and risks for in system trading.

Periodically individual Commodities are "refreshed" at the Main Station and other stations using the system market. The prices and amounts available are intentionally in the normal range for any given system economy. The rate of refresh depends heavily on the number of traders in system at the time. More active traders means a faster refresh and vice-versa. In keeping the spirit of the game, black market goods such as Narcotics, Firearms and Slaves are not refreshed.

Introduces an In System Reputation.

Trade at various stations in system, be that cargo trade, passenger trade (such as in In System Taxi) or otherwise will slowly increase the players reputation in the system resulting in better parcel contracts from friends of friends. Additionally a well known player will be greeted periodically by the systems traffic control (on entering Station Aegis). A players reputation proceeds them in other systems as well, at least for a while. In the Ooniverse friendships can be short lived and absence makes the heart forget...

A reputation can be a bad thing as well, as the player becomes more well known so will their trade habits and routes. Opportunist pirates, or just a random trader the player may have rubbed the wrong way, may lay in wait along a players common routes in system to collect booty... or exact revenge for a perceived slight.

Introduces a new equipment.

The Tripsa Tel-com Autonomous Market Watch Unit, or AMW for short, will alert the player when a Commodity undergoes a change in the system. It will identify the commodity and direct the player to check the Market Datascreen (f8). This device is also movable between craft.
Price: 500cr
Availability: TL 9+ systems shipyards

-Compatibility-

Extensions which change or add Commodities, such as New Cargoes, will see only the base commodity types refreshed by this OXP.

Other OXPs which modify system markets, such as BlOomberg Markets will probably conflict with this OXP.

-Discussion-

The main BB thread is here - > https://bb.oolite.space/viewtopic.php?f=4&t=13702

-Download-

Available here : http://dl.dropbox.com/u/9855374/In_Syst ... .4.oxp.zip

(others wishing to mirror may do so and those mirrors may be listed here as well)
No, I'm not a Trumble... that's a speciest and offensive remark!
~munch~
What?.... I'm hungry.
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:

Re: [Release] In System Trader OXP 1.40!

Post by Commander McLane »

You can PM maik for getting a Wiki account and create/edit the relevant pages yourself.
User avatar
Dr.Tripsa
Dangerous
Dangerous
Posts: 84
Joined: Mon Apr 30, 2012 9:33 pm
Location: In your cargo bay, eating your chips.

Re: [Release] In System Trader OXP 1.40!

Post by Dr.Tripsa »

Thank you Commander McLane, I wasn't aware of the procedure to do it :)
No, I'm not a Trumble... that's a speciest and offensive remark!
~munch~
What?.... I'm hungry.
User avatar
Neal
Average
Average
Posts: 15
Joined: Thu Nov 12, 2015 5:44 pm

Re: [Release] In System Trader OXP 1.40!

Post by Neal »

I'm pretty new to this, but here is the code that I've modified to make this work with 1.82. Anyone familiar with the market properties, I'd be glad of any comments or corrections. I didn't come up with a way to bring in both peak_import and peak_export. I created a multiplier based on peak_import.
example: price_economic = .5 and quantity_economic of .5
- Best Import will have price multiplier of 1.5 and quantity multiplier of 0.5
- Worst Import will have price multiplier of 0.5 and quantity multiplier of 1.5
- economy in the middle would have a price multipler of 1.125 and quantity multipler of .875
there are 8 possible choices ranging from -1 to 1 to multiply the price_economic and quantity_economic values by depending on distance from peak_import economy.

My assumption here is that a economy that is peak import will be the worst export.

Code: Select all

var ChoiceName = CommNames[i];
var ChoiceCom = CommList[i];
var workingStation = system.mainStation;
// Create a multiplier based on commodities price_random property
var pmax = 1 + Number(workingStation.market[ChoiceCom].price_random);
var pmin = 1 - Number(workingStation.market[ChoiceCom].price_random);
var prand = Math.random() * (pmax - pmin) + pmin;
// Create a multiplier based on commodities quantity_random property
var qmax = 1 + Number(workingStation.market[ChoiceCom].quantity_random);
var qmin = 1 - Number(workingStation.market[ChoiceCom].quantity_random);
var qrand = Math.random() * (qmax - qmin) + qmin;
// Create a multiplier based on the commodities price_economic  and quantity_economic properties
//   - This also takes into account the peak_import property
var ecomult = [-1,-.75,-.5,-.25,.25,.5,.75,1];
var imp =  (7 - Math.abs(system.economy - Number(workingStation.market[ChoiceCom].peak_import)));  // 0 - 7 (7 = best import economy)
var peco =  1 + (workingStation.market[ChoiceCom].price_economic * ecomult[imp]);
var qeco = 1 - (Number(workingStation.market[ChoiceCom].quantity_economic) * ecomult[imp]);
// Compute new price
var myprice = Math.floor((Number(workingStation.market[ChoiceCom].price_average)) * peco * prand);
// Set new price
workingStation.setMarketPrice(ChoiceCom,myprice);
// Compute new quantity
var myqty = workingStation.market[ChoiceCom].quantity_average * qeco * qrand;
// Set new quantity
workingStation.setMarketQuantity(ChoiceCom, myqty);
Neal.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: [Release] In System Trader OXP 1.40!

Post by ocz »

I have picked up Neal's idea to bring In System Trader OXP up to date. I'm nearly finished, only some testing, license questions and trying to get in touch with Dr.Tripsa are left.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: [Release] In System Trader OXP 1.40!

Post by ocz »

JSON makes trouble. JSON.stringify works. JSON.parse doesn't. I saved the following missionVariable in the savegame:

Code: Select all

<key>mission_IN_SYSTEM_TRADER_REP</key>
<string>{"Lave":{"reputation":1,"parcelRepCounter":1,"departure":180058019114.25272},"Reorte":{"reputation":0,"parcelRepCounter":0,"departure":180058088877.65167},"Quator":{"reputation":0,"parcelRepCounter":0,"departure":180058125770.58093},"Ra":{"reputation":1,"parcelRepCounter":1,"departure":180058129472.5497},"Relaes":{"reputation":3,"parcelRepCounter":3,"departure":180058171775.23315},"Zasoer":{"reputation":2,"parcelRepCounter":2,"departure":180058188773.99908}}</string>
For better readability:

Code: Select all

<key>mission_IN_SYSTEM_TRADER_REP</key>
<string>
{
	"Lave":{
		"reputation":1,
		"parcelRepCounter":1,
		"departure":180058019114.25272
	},
	"Reorte":{
		"reputation":0,
		"parcelRepCounter":0,
		"departure":180058088877.65167
	},
	"Quator":{
		"reputation":0,
		"parcelRepCounter":0,
		"departure":180058125770.58093
	},
	"Ra":{
		"reputation":1,
		"parcelRepCounter":1,
		"departure":180058129472.5497
	},
	"Relaes":{
		"reputation":3,
		"parcelRepCounter":3,
		"departure":180058171775.23315
	},
	"Zasoer":{
		"reputation":2,
		"parcelRepCounter":2,
		"departure":180058188773.99908
	}
}</string>
But the following algorithm:

Code: Select all

	var s = "";
	for (var a in this.IN_SYSTEM_TRADER_REP) {
		s += "''" + a + "'' :\n";
		for (var b in a) {
			s +=" ''" + b + "'' : " + a.b + "\n";
		}
	}
	log(s);
yields this output:
''Lave'' :
''0'' : undefined
''1'' : undefined
''2'' : undefined
''3'' : undefined
''getOneToken'' : undefined
''substituteEscapeCodes'' : undefined
''Reorte'' :
''0'' : undefined
''1'' : undefined
''2'' : undefined
''3'' : undefined
''4'' : undefined
''5'' : undefined
''getOneToken'' : undefined
''substituteEscapeCodes'' : undefined
''Quator'' :
''0'' : undefined
''1'' : undefined
''2'' : undefined
''3'' : undefined
''4'' : undefined
''5'' : undefined
''getOneToken'' : undefined
''substituteEscapeCodes'' : undefined
''Ra'' :
''0'' : undefined
''1'' : undefined
''getOneToken'' : undefined
''substituteEscapeCodes'' : undefined
''Relaes'' :
''0'' : undefined
''1'' : undefined
''2'' : undefined
''3'' : undefined
''4'' : undefined
''5'' : undefined
''getOneToken'' : undefined
''substituteEscapeCodes'' : undefined
''Zasoer'' :
''0'' : undefined
''1'' : undefined
''2'' : undefined
''3'' : undefined
''4'' : undefined
''5'' : undefined
''getOneToken'' : undefined
''substituteEscapeCodes'' : undefined
Anyone any idea why? I already searched for a JSON bug or troubleshooting that contains something looking like this. Didn't find anything but I continue to look.

Edit: From the looks of it, JSON doesn't like nested objects. I'm still researching it.

Edit2: In the end, it looks like JSON does work the way it should. My algorithm seems to somehow create the error.

Edit3: Strings....*shakes his head*...strings.
''0'' : undefined
''1'' : undefined
''2'' : undefined
''3'' : undefined
''4'' : undefined
''5'' : undefined
are values of the string ''Zasoer''
for (var b in a) works off every position of the string (name) of a instead of the objects behind it...Give me back those precious hours of my life!

This works out far better:

Code: Select all

var s = ""; 
for (var a in this.IN_SYSTEM_TRADER_REP) {
	s += "''" + a + "'' :\n";
	for (var b in this.IN_SYSTEM_TRADER_REP[a]) {
		s +=" ''" + b + "'' : " + this.IN_SYSTEM_TRADER_REP[a][b] + "\n";
	}
}
Last edited by ocz on Tue Feb 09, 2016 12:19 am, edited 1 time in total.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: [Release] In System Trader OXP 1.40!

Post by ocz »

Here it is, for testing purpose, but it should be done so far:In_System_Trader_1.5.oxz

Please leave comments.

Edit: Sorry, I'm late for the specifications, but I'm pretty occupied right now, therefore I have no time to post a thorough report of changes. Here's the version log of 1.5 though:

1.5 2015/02/08
  • OXP hijacked by ocz (at least for version 1.5)
  • License changes form "cc by 3.0" to "cc by-nc-sa 4.0"
  • Fixed for new commodity markets since oolite ver. 1.81 (pre 1.81 backward compatibility is broken now. Can be restored if demanded in https://bb.oolite.space/viewtopic.php?f=4&t=13702 )
  • Deepened reputation system by saving reputation per system and recalculating it when returning in dependence on absence time.
  • Bonus increase in parcel reputation now is also bound to the systems.
  • Commodity cycling happens for all stations in the system on base of their own market properties. (Same commodity, same time.)
  • Fixed ambush pirate fleets attack behaviour. Before they stayed inactive, now they should attack.
  • The ambush pirate fleets now appear somewhere in front of the player, at the edge of the scanner range.
  • The ambush pirate fleets sizes are now also dependant on the worth of the player's ship. A Transporter shouldn't have to face 16 ships.
  • New version log as object. (I know I'm being a kid here, but I wanted to test this new idea.)
Last edited by ocz on Fri Feb 12, 2016 9:40 pm, edited 1 time in total.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] In System Trader OXP 1.40!

Post by phkb »

ocz wrote:
Anyone any idea why?
I suspect it's because you need to run JSON.stringify on the sub-elements of the dictionary. JSON doesn't recurse down an object tree.

So, instead of just this:

Code: Select all

	missionVariables.IN_SYSTEM_TRADER_REP = JSON.stringify(this.IN_SYSTEM_TRADER_REP);
Do this:

Code: Select all

    var hold = {};
    for (var a in this.IN_SYSTEM_TRADER_REP) {
        hold[a] = JSON.stringify(this.IN_SYSTEM_TRADER_REP[a]);
    }
    missionVariables.IN_SYSTEM_TRADER_REP_store = JSON.stringify(hold);
Then in the startUpComplete routine, to restore your data do something like this:

Code: Select all

    var hold = JSON.parse(missionVariables.IN_SYSTEM_TRADER_REP_store);
    for (var a in hold) {
        this.IN_SYSTEM_TRADER_REP[a] = JSON.parse(hold[a]);
    }
    
Very untested code, though!
Post Reply