 |
|  |
 |
|
MrBaggins
|
|
Allowing "overloading" of various game data... city improvements, terrain improvements, units, wonders, pop, advances by government
Concept:
Allow for "overloaded" data files, for city improvements, units, terrain improvements, wonders and so on.
You'd optionally specify altered data for that specific whatever under that specific government.
You'd implement this by having some linked list or other data structure, with the extended data in. They get referenced by the original structure, and if there is appropriate data (for the "owners" government,) then its passed back.
Issue: We'd have to ensure that all data was referenced as it related to an owner (like a specific unit or TI,) and then subsequently to the DB, and not directly to a default db value.
Benefit: A lot of modding flexibility. It would be very simple to make costs different for a specific group of units and buildings, say, under a particular government type. You could do tech tree divergence... and a whole bunch of tricks, without SLIC. Would allow for more personality in governments in general.
|
|
|  |
 |
|
MrBaggins
|
|
Well.. I think that the better solution is to put them in the original file. E.G. for a City improvements... you'd still have just one buildings.txt
If you wished to change say, the effect of the Courthouse in a city under Monarchy (due to a brutal, though effective regime of punishment, for terms of this discussion) you might do the following:
This is the original, and would be kept in the file.
code:
IMPROVE_COURTHOUSE {
DefaultIcon ICON_IMPROVE_COURTHOUSE
Description DESCRIPTION_IMPROVE_COURTHOUSE
EnableAdvance ADVANCE_JURISPRUDENCE
ProductionCost 330
Upkeep 1
LowerCrime -0.1
}
This would be an addition to the file:
code:
IMPROVE_COURTHOUSE::GOVERNMENT_MONARCHY {
DefaultIcon ICON_IMPROVE_COURTHOUSE
Description DESCRIPTION_IMPROVE_COURTHOUSE
EnableAdvance ADVANCE_JURISPRUDENCE
ProductionCost 300
Upkeep 1
LowerCrime -0.3
HappyInc -1
}
Which would be parsed as an 'extention' to the building record, and referenced, where appropriate.
Notice I've added a happiness penalty, increased the crime reduction and lowered the production cost.
I'm suggesting that you'd only include these where you wished to change the behavior for a specific government. Nothing is mandatory.
|
|
|  |
 |
|
MrBaggins
|
|
Yep... we're limited to 64 buildings.... but thats because of the flag used to store them in the city record. Subtypes wouldn't be limited this way...
We're limited, because a uint64 is used to store the flags. We should develop a small extensible flag class, that uses a bit array, perhaps.
This would allow us to extend building.txt as we wished, and just serialize the class instead of the uint64.
As for my example, it will essentially use the exact same parser behavior, with a modification to notice and redirect the data for the different governments.
Also, I think we should include all the record of the data in the GovernmentEffect... thus you can remove effects (by their absence) and change, say the icon, description or advance, in the case of a building.
|
|
|  |
 |
|
MrBaggins
|
|
I just took a closer look at this. (the newdb stuff.) As I've recalled, there were no structs within structs which would be the issue with doing it the second way. Thats not to say it won't work that way, and indeed, it would be preferable to do so. I'll do a test to check.
I also noticed the ready prepared bitarray class, that we should use instead of a uint64, for buildings and wonders...
|
|
|  |
 |
|
MrBaggins
|
|
Update. What Martin has suggested isn't allowed by the parser at present... There seems to be a problem with having some array type dataclasses within a structure, in certain circumstances.
I'm working on the problem.
|
|
|  |
 |
|
MrBaggins
|
|
Only for required elements.
If you have a non-required element, you wouldn't know if its absence means it should be removed or unchanged.
Even so... its becoming increasingly clear from the stuff I've been looking at that its exponentially more difficult to alter the db parser in that manner.
The strategy that I think we should persue is...
* Generate a link list datatyperecord class member variable, and an array to hold the list of governments in the class def for the datatype
* Use an alternate custom token in the generated parser code, that checks for the token (I.E. a colon) specified for the modified specification, or the opening brace, rather than just the opening brace
* Use a custom token seperator (I.E. a comma) to seperate a list of the governments that the modified specification applies to.
* In parsing, follow the linked list, until the pointer to the governmentmodifier member object is null, then create a new object, populate the list of governments and parse the actual data into it.
* Overload the base accessor function to include an int (?) in addition to the regular arguments, for the index of the government that you wish to access data for.
* That accessor would find the data, then traverse the linked list looking for a matching government, and if it found it, replace the data as appropriate.
|
|
|  |
All times are GMT. The time now is 05:33. Apolyton Time is 00:33. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|