market_news.ini
==============
Since I was actually done earlier than expected with the market news tutorial, I'll post it today. This is the last INI file added by the FL Real Economy addon. The INI files from the previous posts allowed us to control various things around the economy, but they leave a little bit of a bad taste: They are predictable. Math is predictable. So this file will take care of that
The file I'm talking about is market_news.ini, it allows us to make the market unpredictable in many ways. But its role is: Support changing the settings provided by markets.ini at almost random points in time. To say it in clear: This file allows you to modify supply, demand, sale or production defined in markets.ini for certain periods of time for a base or the entire universe.
Not only can you affect those settings, but you can tell the player what happend: An event displayed in the News in any FL base. So what could you do with it? You could define an event, which tells the player that Liberty increased the patrols to scan for smugglers and cought a dozen cardamine carrying traders. The outcome could be that the supply of cardamine on bases in Liberty space is lower.
The other news could be that in order to contain the cardamine trade Liberty resorted to give out cardamine freely to those with addiction problems: The result could be a drop in demand and a drop in sales on bases selling cardamine. Its all up to you how creative you'll be with the events here.
Bad news: In order to display the actual news to the player you'll need to create a custom resource DLL with the ids_name and ids_info entries for the news. This is not included in the mod.
News Info Section
=================
So lets start with the first section in market_news.ini: The NewsInfo section. It looks like this:
[NewsInfo
category=ids_name
headline=ids_name
text=ids_name
It simply declares a category, headline and text, which FL Real Economy will use to display market news in. Say what? We'll the problem is: You can't simply add new news at runtime - The solution I'm working on replaces an existing news topic. To do this you need to define one full news entry in news.ini - The actual ids_name/ids_info used there have to exist. You should provide something like 'In a normal day of trading no unusual events happened.'. The category and headline should make sense generally speaking, as they are reused for every event specified below. In addition to this you need to add this news entry to all bases you want market news to appear in.
I have not yet figured out how to add an arbitrary number of news entries to the news screen, once I solve that this Hack won't be needed anymore - But currently we don't have any other option.
The fields:
category
----------
This is the category id of the market news item. This *MUST* be the same as specified in news.ini. FL Real Econ will not replace the category text. It is the same for *all* market news.
headline
----------
This is the headline id of the market news item. This *MUST* be the same as specified in news.ini. FL Real Econ will not replace the headline text. It is the same for *all* market news.
text
-----
This is the text id of the news item, FL Real Econ will replace. This *MUST* be the same as specified in news.ini.
FL Real Economy will provide proper market news *ONLY* for bases, which have a news entry, which matches the above three ids.
Ok now we've seen how FL Real Econ replaces an existing entry, but what does that mean for me? We'll the ids_info entries for new news look a little bit different.
Market News IDS_INFO format
===========================
You basically leave out the following things from a standard ids_info:
<?xml version="1.0"?>
<RDL>
<PUSH />
<POP />
</RDL>
FL Real Econ will take care to provide this stuff automatically for market news. Why is it doing this? Because multiple events can happen at the same time and they will both be included in the same news entry.
So your market news ids_info should look like this:
<TEXT>
My news text.
</TEXT>
<PARA/>
You can use all other attributes and tags - just make sure you leave out the root tag and that you add a <PARA/> element last.
We've now seen the way the news are displayed and how you can add custom news for the market. But how do you tell the market about events? Here comes the next section: MarketEvent.
Market Events
=============
Lets first look at the entire section:
[MarketEvent
headline = ids_name
text = ids_info
type = fixed,time,duration/periodic,start-time,periodlength,duration/random,probability,duration
affects = base,good,delay,[supply/demand/production/sale,[function
Ok now this does look simple, doesn't it? Yep, here are the details:
headline
----------
When I told you your market event didn't have its own headline - well I lied. It does have a headline, but it isn't display as the headline, but inserted by FL real econ into the text. This entry specifies the ids_name of the headline for this event.
text
------
This specifies the ids_info entry for the event. Make sure that it is in the right format (See above.)
type
-----
This specifies the type of the event, e.g. when it will appear. The options here are:
- fixed events - Occurs at a specific point in time and never again.
- periodic events - Occurs regularly for specific duration.
- random events - These occur randomly.
The format to declare them should be obvious from the above Section, however one note: For periodic events the periodlength specifies the time, which passes between the last time the event happend and the next time it will happen. All times can be expressed as floating point values and can span durations less than a day.
affects
--------
This line tells FL Real Econ, what is affected by the event. For example you could have an event, which affects the demand on one base and the supply in another base - a chain reaction if you will.
The format of the affects line is as follows:
affects=A,B,C,D,E*
A = nickname of the affected base.
B = The nickname of a good
C = Delay in *full* days (integer) from the start of the event to when the affects line will take effect.
D = A choice of one of these strings: supply, demand, sale, production.
E = A new function for the affected base in the affected case.
E.g. the following line:
affects=Li01_01_base,commodity_cardamine,0,demand,linear,10000,100000,10
causes the demand for cardmine on Manhattan to rise from an initial value of 10000 to 100000 over the next 10 days. The example doesn't really make sense, as the demand would all of the sudden drop from 100000 to the configured value in markets.ini after the ten days have passed. To get a nicer curve, which gets higher and then drops slowly back to the original use the periodic function and make the event duration (declared in the type field) half the length of the period length. That gives you a nice rise and fall before continuing with the normal markets.ini settings. (Look at the example below for this.)
So what can you do with all of these settings, we'll I'll give you an example:
[MarketEvent
headline = ids_name ; Cardamine addiction increased in Manhattan
text = ids_info ; Due to an unusual rock & roll event on Planet Manhattan experts said that the demand for cardmine is increased.
type = periodic,166,365,10
affects = Li01_01_base,commodity_cardamine,0,demand,periodic,10000,90000,20
affects = Li01_01_base,commodity_cardamine,1,supply,periodic,8000,58000,18
affects = Li01_12_base,commodity_cardamine,1,sale,periodic,50000,50000,20
Wow. What will this do:
We have a rock festival
on Manhattan once a year. (It is in mid-june to be exact.
) And of course all those folks are going to listen to music, drink a lot and of course consume cardamine.
Here's what it will affect:
1. The demand of cardamine will rise along a nice sine curve over 5 days on Manhattan.
2. The supply of cardamine will rise, but not as much over 4 days. The rise is delayed by one day.
3. The sale of cardamine on buffalo will rise from 50000 to 100000 over 4 days. The sale is delayed by one day.
And after these 5 days are over everything drops back to normal levels. A predictable, but unpredictable event
You see it and if you are fast enough your profits will be huge.
The number of things you can do with this is only limited by your imagination.
That's it for today. I may post another entry to explain the formulas used for price calculation or other stuff you'd like to see. I do not have any plans on filling the next two entries yet. Ask questions and you'll get answers or may be even an additional entry in the tutorial.
grover
Edited by - grover on 1/26/2006 2:15:41 AM
Edited by - grover on 1/26/2006 2:28:05 AM