• 0

    posted a message on Custom liquids with advanced physics

    I'm looking to put together a large project based around multiple colored liquids that actually flow.


    I know that this has been attempted before with poor performance with the finite liquid mod and similar. I think I have a solution to the performance issues but am unable to attempt it myself due to my abysmal programing skills outside basic scripting. The idea is to reduce the system resources needed by:

    1. Slowing the spread speed similar to lava so checks are made less frequently
    2. Calculating by column rather than by individual block so less checks have to be made

    Here's some pseudo code as an example:

    # Information tracked by each block
    # Information tracked by column
    Base={height of lowest block}
    Peak={height of highest block}
    Max={max peak value (Peak+consecutive air blocks above)
    # Calculations by block
    If no ColumnID OR IsBase=True
       Check below block for custom liquid
       If liquid below
          ColumnID={ColumnID of below block}
          ColumnID={lowest unassigned ColumnID}
    If ColumnID has changed AND above block is custom liquid
       update above block ColumnID
    # Calculations by column
    If block update anywhere in column
       Wait {x seconds} #to prevent overload if large amounts of columns attempting to update
       Check for adjacent air blocks
       If air block from Base to Peak-1
          Move one liquid block to lowest air block and create new column
       If {Adjacent Peak}=/=(Peak+/-1)
          Average Peak with adjacent Peaks (where permitted by {Max} values) #spread out any remainders

     I think this would allow for the semi-realistic "fluid" I need without putting too much burden on the system.

    Any feedback and/or assistance would be greatly appreciated.

    Posted in: Minecraft
  • To post a comment, please or register a new account.