The Deep Blue

This is the place to request new mods or give ideas about what could be done.
Post Reply
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 880
Joined: Sun Mar 20, 2016 2:51 am
Contact:

The Deep Blue

Post by Impatient »

Hi everyone!

I created this thread to discuss and develop an idea of mine and explore avenues to implement it as a mod.

The general idea for The Deep Blue is to add a depth/elevation value to factorio water tiles, thus adding a small new dimension and the necessity to deal with it, to a map.

The general idea consists the following:
  • Water depth
  • Indication of water depth
  • Deep fill
  • Vertical fill block and trickle down effect
And follow up ideas like:
  • Deep sea pylons
The parts are discribed thoroughly in the idea documentation. Partly the idea has been discussed here and here before this thread was created (but all information is available here as well).

This is the introductory post. There are separate posts for project documentation and idea documentation. I am in the process of writing them now.

To keep things sorted I distinguish between this project and the idea itself. The scope of the project is to develop the idea, to eventually implement proof of concept and final mods and to document everything. My workstyle is iterative, where each iteration produces a result, touching from one to all aspects of the project. So I will document the idea and the project and its iterations. I also will try to keep questions about code in the modding help subforum, as I think it is the place they should be, to be reusable by other modders, indepently from this project.

(Btw: The name "The Deep Blue" is a reference to Luc Bessons 1988 cult movie The Big Blue. I am a huge fan of it.)
Last edited by Impatient on Tue Jul 09, 2019 12:50 am, edited 19 times in total.

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 880
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Project documentation

Post by Impatient »

Iteration X - Setting up the project thread and write first documentation
Last edited by Impatient on Sun May 12, 2019 12:51 am, edited 1 time in total.

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 880
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Idea documentation

Post by Impatient »

Work in progress

vY
Main:
  • Water depth
    Add an elevation value to water tiles.

    - Use the chunk generation logic (CGL)
    currently pursued
    When the CGL creates a chunk, it creates a height map based on the seed and a noise expression first, from which it derives where to use what kind of water tileset (deepwater vs water) and where to put the shoreline, land tiles and cliffs (which are disconnected heightlines). The heightmap the CGL creates, is the best source for good water tile elevation values. They should have a smooth gradient. Unluckily, as per my knowledge, the noise expressions the CGL uses to create height maps are pretty encapsulated and values from the heightmap can not be stored for later use after the chunk was created.
    Thanks to eradicator for mentioning that an accessible elevation value existed in previous versions of factorio. I filed a modding API request to regain access to it, if such a value still exists.

    Great tutorial on custom noise expressions used in the CGL

    A big thank you goes to pleegwat for contributing the idea of "defining a bunch of tile types for different water depths". I had a look at the code of vanillas base mod before, to find out how the CGL knows where to use different graphics for water (deepwater, water). The tile types are defined in tiles.lua like so:
    Tile type definiton for deepwater
    It looks like an abitrary number of water tile types can be defined (either using their own or shared graphics, leading to a visual represenation of elevation or not). For deepwater, in the line of the autoplace property, a paramater (-2) is used to create it. Looking up the function make_water_autoplace_settings used on wubes github factorio-data repository, lead me to believe this parameter tells the CGL up to which elevation to use a certain tile type for water. This is exciting, because everything added together, for me it seems to be the link that was missing between the CGLs heightmap and a water tiles elevation value that can be used after the chunk was generated. One could define tile types deepwater-1, deepwater-2, ... deepwater-n, set them up in a way, that they are used for specific elevations by the CGL and the names, which indicate the elevation, will be available after chunk generation, via the LuaTilePrototype attached to a tile.

    - Implement some logic that adds elevation values after chunk generation
    currently not pursued
    The question here is, what elevation values to assign to water tiles?
    -- Random ones? Depth 1 next to depth 100? That is ugly.
    -- Implement some sophisticated logic, that creates a smooth seabed based on the shoreline? What to do then if the water tile is next or near to an uncharted chunk?
    -- Immitate the CGL and try to create the same heightmap? I did not examine, if the vanilla noise expression and its parameters are in the base mod or in the core engine. In any case this sounds like a complicated thing to try.

    Thanks to eduran for the pointer to the on_chunk_generated event, a place where the logic could hook in.
    _
  • Indication of water depth
    Some sort of (preferable visual) indication of the water depth.
    - Different graphics tilesets for water of different elevation values
    currently pursued
    This also is based on pleegwats idea of "defining a bunch of tile types for different water depths". This way, the game world, the minimap and the map themselfs would indicate water depth. Different graphics (ranging from turquois to deep blue as base colors) can be created and attached to tile types used for certain depths. Different tile types do not have to but can have different graphics. If groups of tile types share the same set of graphics, this set of graphics would represent a range of depths.

    - Tool/shortcut that outputs the water depth as text when clicking on a water tile with it
    currently not pursued
    Further details

    - Map overlay
    currently not pursued
    Custom map overlays are currently not supported by the modding API. This would require an addition to the modding API for custom map overlays. This would require writing a modding API request.
    _
  • Deep fill
    Filling in a water tile requires an amount of landfill items proportional to its depth.

    This requires to react to the landfill events (on_player_built_tile and on_robot_built_tile). If the elevation of the water tile is too low, the landfill is reversed but the elevation is increased, raising the seabed to the surface step by step.

    eradicator hinted at me that this also requires to handle landfill ghosts. If the landfill item was dropped on a ghost and the landfill was reversed a new landfill ghost has to be created. Unluckily the _built_tile events do not state if there was a ghost before or not. So currently this is a missing piece to the puzzle.
    _
  • Vertical fill block and trickle down effect
    Tiles can not be filled in vertically. For a water tile to be raised to depth z, all adjacent tiles have to be at least of depth z+1. This effectively will require an underwater hill, with linear slopes to all sides for a tile to be raised above water level.

    When trying to fill a water tile, the vertical fill block is enforced automatically. If a tile is raised to depth z and not all adjacent tiles are of depth z+1, then one of these tiles is filled instead, also triggering the same logic recursively. This will lead to a trickle-down effect. Like when you fill in water and the filler material rolls/slides downhill under water, until it comes to a rest.

    Further details
    _
Follow ups:
  • Deep sea pylons
    ... made from concrete and steel, allowing for water tiles to be filled in vertically. Including tile graphics for a pylon top surface.
Last edited by Impatient on Sun May 12, 2019 6:16 am, edited 7 times in total.

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 880
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Deep water

Post by Impatient »

reserved for unforseen things

Post Reply

Return to “Ideas and Requests For Mods”