forked from mirrors/0ad
dc18d94030
Split the gamesetup in two: the 'GameAttributes' part into gamesettings/
and the GUI/Presentation part in gamesetup/. This makes it easier to
separate the presentation from the data.
The immediate benefit is that campaigns & autostart scripts don't need
to load the gamesetup folder at all. This also makes it much easier for
any modder that would want to to change the GameSetup itself.
Each 'game attribute' is given a unique class extending GameSetting
(with a few exceptions), in charge of:
- 'Serializing' to the JSON-compatible 'InitAttributes' format, which is
used for persisted settings, network synchronization, map script
settings, hotloading.
- Deserializing from the same format.
- Watching for settings it depends on (such that e.g. unexploring the
map also unreveals it).
The GUI controls remain in charge of presenting the state accurately,
however they now directly subscribe to changes of the GameSettings for
update. The updating logic in general has been lightened on the GUI
side, making it more straightforward to know when something will update,
and reducing un-necessary computations (in theory - in practice, I
believe the gamesetup was already fairly good about this).
The 'Controller' class of the gamesetup have also been lightened, since
more responsibility now lies with GameSettings. In particular, this
include code to actually launch a game.
In general the GameSettings class is permissive - the GUI gamesetup has
tighter restriction for what the player can/cannot modify. This is
intended to give flexibility for campaign maps, which may want to change
arbitrary settings.
Further work would be useful, non-exhaustively:
- the setting of default values remains messy. They currently exist
somethings in GameSettings, sometimes in the GUI gamesetup, and in the
simulation itself (in case attributes are not set).
- the availability and 'lockedness' of settings remains a
work-in-progress.
- some attributes, like disabled technologies, should probably be
removed and triggers used instead.
- the Handling of AI and player-specific data could be improved.
- settings Persistence should follow its own path - not all settings are
worth persisting.
- GAIA settings are added simulation-side but not in the GUI, which is
confusing.
Thanks langbart & Freagarach for testing.
Follows the gamesetup rewrite in 34138a7764.
Refs #3049
Differential Revision: https://code.wildfiregames.com/D3243
This was SVN commit r25077.
99 lines
2.8 KiB
JSON
99 lines
2.8 KiB
JSON
{
|
|
"settings" : {
|
|
"Name" : "Unknown",
|
|
"Script" : "unknown.js",
|
|
"Description" : "The unknown.",
|
|
"Preview" : "unknown.png",
|
|
"SupportedBiomes": "generic/",
|
|
"CircularMap" : true,
|
|
"Landscapes": [
|
|
{
|
|
"Id": "random_land",
|
|
"Name": "Random Land",
|
|
"Description": "Choose a random land landscape",
|
|
"Items": [
|
|
{
|
|
"Id": "Continent",
|
|
"Name": "Continent",
|
|
"Description": "All players starts on a continent surrounded by water.",
|
|
"Preview": "unknown_continent.png"
|
|
},
|
|
{
|
|
"Id": "Isthmus",
|
|
"Name": "Isthmus",
|
|
"Description": "Two Mediterranean land masses connected by a narrow spit of land, called an 'Isthmus'.",
|
|
"Preview": "unknown_isthmus.png"
|
|
},
|
|
{
|
|
"Id": "CentralRiver",
|
|
"Name": "Central River",
|
|
"Description": "A small central river.",
|
|
"Preview": "unknown_central_river.png"
|
|
},
|
|
{
|
|
"Id": "EdgeSeas",
|
|
"Name": "Edge Seas",
|
|
"Description": "Players are aligned on a strip of land with seas bordering on one or both sides that may hold islands.",
|
|
"Preview": "unknown_edge_seas.png"
|
|
},
|
|
{
|
|
"Id": "Gulf",
|
|
"Name": "Gulf",
|
|
"Description": "Land shaped like a concrescent moon around a central lake.",
|
|
"Preview": "unknown_gulf.png"
|
|
},
|
|
{
|
|
"Id": "Lakes",
|
|
"Name": "Lakes",
|
|
"Description": "Mainland style with some small random lakes.",
|
|
"Preview": "unknown_lakes.png"
|
|
},
|
|
{
|
|
"Id": "Passes",
|
|
"Name": "Passes",
|
|
"Description": "A large hill encompasses the map and leaves players only a small passage to the two neighboring players.",
|
|
"Preview": "unknown_passes.png"
|
|
},
|
|
{
|
|
"Id": "Lowlands",
|
|
"Name": "Lowlands",
|
|
"Description": "The land is enclosed by a hill that leaves a small area per player connected to the large central place.",
|
|
"Preview": "unknown_lowlands.png"
|
|
},
|
|
{
|
|
"Id": "Mainland",
|
|
"Name": "Mainland",
|
|
"Description": "A typical map without any water.",
|
|
"Preview": "unknown_mainland.png"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"Id": "random_naval",
|
|
"Name": "Random Naval",
|
|
"Description": "Choose a random naval landscape",
|
|
"Items": [
|
|
{
|
|
"Id": "CentralSea",
|
|
"Name": "Naval: Central Sea",
|
|
"Description": "A huge sea is dividing the map into two halves.",
|
|
"Preview": "unknown_central_sea.png"
|
|
},
|
|
{
|
|
"Id": "Archipelago",
|
|
"Name": "Naval: Archipelago",
|
|
"Description": "Players are scattered across island chains and disconnected islands.",
|
|
"Preview": "unknown_archipelago.png"
|
|
},
|
|
{
|
|
"Id": "RiversAndLake",
|
|
"Name": "Naval: Lake and rivers",
|
|
"Description": "A central lake with rivers possibly separating neighboring players.",
|
|
"Preview": "unknown_rivers_and_lake.png"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|