Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [MODDING] WorldGen API  (Read 557 times)

GavJ

  • Bay Watcher
    • View Profile
[MODDING] WorldGen API
« on: July 22, 2014, 11:54:06 pm »

This is very similar to the classic, longstanding suggestion of a graphics interface API. But for worldgen.

1) Publish the list of data fields that tiles have when first generated. However many types of tiles there are (world tiles, embark tiles, creature sized tiles, and maybe adventure travel tiles?). For example, maybe a fortress size tile contains fields for "Material, shape (ramps, etc.), liquids, boulder or not, ..." etc. These could totally change whenever you feel like it or need to add or remove game features, no big deal / shouldn't constrain development choices.

2) Whenever a tile needs to be generated, have an option for querying a third party plugin application for whatever values it needs to fill in, instead of hard coded DF functions. Or the option to just use the vanilla functions.  In other words, the API sends out basically just "request for tile at XYZ coordinates and type/scale of tile" and gets back [struct or array or whatever of all the needed values] then proceeds as normal.




This sort of thing already exists, which is why I know Toady is at least somewhat cool with it -- in the form of the custom world painter (advanced world gend --> "e" --> "p" from the main menu). However, that only allows third party custom maps at the world tile level of scale.

Basically I'm asking for the same functionality, but at every scale at which world gen is done (not world history! just world gen of natural terrain and tiles). Including embark level and actual individual fortress tile level, optionally. Which would require a program API unlike the world painter, since it would need to generate info on the fly.

In terms of messy collateral issues, I can't think of very many. The API might have to have the option of deferring to the third party app for questions of which resources are available in an embark (the preview of "shallow metals" "flux" etc.). And it might have to have some help in deciding which resources the parent civilization has available for trade at embark. That's all I can think of though.



This might be horribly unrealistic and impossible (if tile generation is hopelessly sprawled out around the code) OR it might be a cakewalk (if tile generation is already a neatly isolated function). I have no idea. Just putting it out there as a long shot idea. But one that would be EPICally powerful if possible.

This would allow you to do everything on the following list:
* Make third party apps that can do arbitrarily complicated custom, more realistic geology simulations without interfering with game play or development (think PerfectWorld, but on crack -- this is my main personal motivation)
* Make apps for translating and importing worlds from other games, or shapes from 3D rendering programs, etc.
* Simple things like just "perfectly flatland" embarks, or perhaps "pre-landscaped embark" for people who want to make certain types of megaprojects that would be otherwise impossible (for example, due to the inability to build natural stone walls).
* Easier !!science!! and debugging by being able to easily make custom-tailored laboratory maps to easily test things (like walls of every ore and material, and prebuilt minecart ramps, and little convenient temperature/biome mini zones, etc. etc.)
* Make fantasy-type world gen algorithms that aren't supposed to be realistic at all, but do things like making procedural random floating island worlds (well not entirely floating to avoid cave-ins, but you know... pillar worlds), and awesome stuff like that.
« Last Edit: July 22, 2014, 11:57:42 pm by GavJ »
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.

GavJ

  • Bay Watcher
    • View Profile
Re: [MODDING] WorldGen API
« Reply #1 on: July 23, 2014, 12:50:18 am »

Example concept cutaways of geologies that might be possible custom with an API. First, a couple of realistic ones.

Plutonic igneous intrusive (e.g. granite, with fractional crystallization of andesite, perhaps below), that has pushed up the country rock and then later on, after cooling, was covered with sedimentary layers (red is supposed to be like hematite or whatever, and green gems):


Fancier igneous intrusions filling in between strata in sills, with the top portion eventually breaking through into an extrusive volcano with a cone, which has since cooled and weathered. Perhaps the orange here is diorite, for instance, with some tuff around the old caldera:


An example of a more fantasy-ish, or possibly realistic geology, with a fault line that was then bent crazily (possibly violent plate collisions) and has since filled in with water:


An example of super high-fantasy made up geology rules being used in a custom procedural engine to do bizarre stuff:


Remember, all it's doing is asking for a set of numbers, given a coordinate -- that could be supplied as a result of a procedural algorithm, but it doesn't have to be. For more complicated concepts that are too difficult to make procedural, it could just be reading off of a pre-determined custom hand made map, for example. The system supports both approaches (and any others)
« Last Edit: July 23, 2014, 05:20:56 am by GavJ »
Logged
Cauliflower Labs – Geologically realistic world generator devblog

Dwarf fortress in 50 words: You start with seven alcoholic, manic-depressive dwarves. You build a fortress in the wilderness where EVERYTHING tries to kill you, including your own dwarves. Usually, your chief imports are immigrants, beer, and optimism. Your chief exports are misery, limestone violins, forest fires, elf tallow soap, and carved kitten bone.