pioneerspacesim/pioneer — pull request #2753 by impaktor (2014-02-12 11:27:03+00:00)
Title: News event Commodity

# NEWS EVENTS

## What is a NewsEventCommodity?

The effect is a BBS message informing of some news happening in the region, affecting some commodity in some system, e.g. "Drought in system {system}" which will set Grain stock to 0, and multiply Grain price by some factor. Another example is a system flooded with drugs, reducing price of Narcotics, and flooding the stock exchange, (provided Narcotics are legal in the system).

I see my self doing more of these NewsEvents in the future which is why I call this one `NewsEventCommodity`, since other news events would not affect the commodity market (could be a race or competition, or scavenger hunt, etc), but that's for another day.

## How it works:

It creates a *news event* for some system, max 20-50 ly radius from the players current position when arriving from hyperspace. The news will expire at some time dependent on the distance to the system (of the event) from where the player was when it was spawned, plus some randomness. Each news will get one post on every BBS, wherever the player goes, except for the system affected by the event which will be silent.

A news post will be timestamped with some random timepoint from when the player was in hyperspace. If the event took place in, say, Confederate faction, it will say that the news is from "The Confederate Chronicle" etc.

I decided against the news message explicitly stating which commodity is affected, since then it will be far too unnatural, scripted, and boring. This way the player will have to think for themselves and try their luck in speculating the market.

When you land in the system with one (or more) active news events, you will see some generic grateful message in you HUD/Comms, if you borough the cargo in need (provided it hasn't expired). If the system has an abundance of a commodity (like drugs flooding the market) no message is show.

## How often will there be a NewsEvent?

My thinking was that News should be comparatively rare, and I've caped the maximum to 3 news items at any given time, though I think the probability for just the one should be low enough so that the cap is never reached. For testing I played around with this a bit. I also think there should be a news drought for 12 months when you start a new game. Point is, once you get into the habit of delivering packages, and you think you've seen all the game has to offer, this will (have some chance to) pop up, as a nice surprise.

However, there are a lot of flavours so it could be made not-so-rare, and the boost in market price just lowered a bit instead to compensate.

## Testing and reviewing

The first commit e4564a1 has all the debug printouts, each line starting with one, or several dashes. In this commit there will be one news created each time the player hyperjump (i.e. `probability = 1`), but capped to 3.

I think getting the flavours for each news right is very important since this will be a lot to translate, so these should not change once merged. I know there are probably grammar and spelling mistakes (I've red these so many times I'm now blind to any mistakes). I'm very pleased with some of the flavors but some/many could be improved perhaps?

65af912 is just a cleanup, with probability set as I suggested above.

## Further details

A new sevent has some probability of being created every time the player enters a system (I wanted the probability of spawning a newsevent to be independent of number of stations in the system).

Removed as news expires when player lands on a station.

### Handling of illegal goods

The script cant deal with black market prices. All flavours have the same chance of being picked. If the flavour is regarding slaves, for instance, it will randomly go through all systems available at the selected distance until it finds a system where slaves are legal, or until we run out of systems to try. If the latter, if will try another flavour (two more times) and repeat.

I've found it will usually find some system where any commodity i legal, except slaves, which are only legal in Red faction systems, which is why I gave an extra boost in price for a slaves event.

### What it doesn't do (yet)

There are a few things not implemented:

1. These news events might go on the Station View Lobby, instead of the BBS. I don't know exactly how to place messages on the Lobby, but I suppose it would be nice if they had a headline as now, and when clicked pop up the more detailed news report. @nozmajner had some ideas [here](http://pioneerspacesim.net/forum/viewtopic.php?p=1621#p1621)

2. If 1. is implemented, I think it should be fair to have a news message in the lobby informing that the event is over. "Conflict in system X has returned to normal, peace treaty signed, ", "first harvest in system X after drought", "police in system X regains control over drug-lords" etc.

3. If 2. is implemented the message in the system affected should/could be different from other systems. It will probably not be unusual to arrive too late to a system. Then the message should be the same as in 2., but in a version not mentioning "in system X", or just a few generic "all things returned to normal" messages.

4. I started by over-thinking the news items at first, like: should a mining colony have drought? etc. The simple solution is in place: everything is system wide. Let's just say something happened somewhere which has caused the system stock to reach an equilibrium of 0 or , depending on if demand is extra high or extra low.

5. It does not take into account what the system exports or imports in the usual sense.

6. Perhaps a player could get too rich if they got lucky with the expiration time of the news. Then this date could be halved each time the player landed, but I don't think that's an issue with current settings.

7. Another thing is having multiple commodities affected by one event. Drought causing grain shortage will also makes fruit and veg expensive? I think this would be over-thinking the issue. Which is why I left it out for now.

I'd like to implement 1-3 above, but I thought it best to stop for now, to see if this is something that can be merged into the game.