-
Notifications
You must be signed in to change notification settings - Fork 2
DS_BaseGen
Inherits: Node
Inherited By: ds_wfc_gen
Base class for all the stage generator objects.
DS_BaseGen is the parent/base class for all the stage generator scripts in the tool/plugin Duniya Skapare. This script has been desinged in a way that every current or new stage generator algorithm scripts will need to extend from DS_BaseGen. That way it will be easier to keep the generators organized and having common parent. This will also help in making sure that the generator scripts can be just dragged and dropped into other scripts that will use the generator script and it will work no matter the algorithm type, SOLID principles. Well that is the idea for now.
Type | Name | Default Value |
---|---|---|
bool | _is_start_setup | true |
DS_BaseGrid | _grid | |
DS_TileInfo[] | _start_tiles | |
int | _counter_warning | -1 |
int | _counter | -1 |
Return Type | Name |
---|---|
bool | _is_gen() |
DS_BaseGrid | get_grid() |
void | set_grid() |
int | get_tile_index( int tile) |
DS_TileInfo[] | get_start_tiles() |
void | add_start_tile(DS_TileInfo) |
bool | is_tile_height_z( int height) |
bool | is_tile_height( DS_Tile tile ) |
int | get_start_index() |
int[] | get_tile_free_edges( DS_Tile tile ) |
void | expand_grid( int dir ) |
void | add_tile( DS_Tile tile ) |
void | add_tile_index( int int ) |
bool | is_start_setup() |
bool | is_gen_success() |
int | get_process_loop() |
void | setup() |
void | reset() |
float | get_run_time() |
bool | is_gen_process() |
untyped | get_data() |
untyped | get_tile_names() |
float | get_percentage_loaded_normal() |
void | print_debug_info() |
bool _is_start_setup = true
A flag for enabling/disabling setup call for the generator. If true then the generator will start the setup process at start up. If false then the generator will NOT start the setup process at start up and will require to call the setup() method manually.
DS_BaseGrid _grid
A grid needed for generating the stage. The grid MUST BE a child node of the DS_BaseGen node.
DS_TileInfo[] _start_tiles
A set of tiles in the grid that will be pre-defined before any algorithm can process the tiles.
int _counter_warning = -1
A counter needed for finding any errors and throwing a warning. INTERNAL USAGE ONLY!
int _counter = -1
A counter needed for INTERNAL LOOPS ONLY!
bool _is_gen ()
This method is ONLY used for duck typing check and is ONLY used for checking if the script is a generator script.
NOTE: This method MUST NOT be overridden.
DS_BaseGrid get_grid ()
This method returns the grid being used by the script. If no grid has been set then null is returned.
This method loops through all the children Nodes to find the grid.
This method gets the index of the given tile. It finds the index of the given tile by looping through all the tiles in the _grid.
DS_TileInfo[] get_start_tiles ()
This method returns an array of all the tiles that have been pre-defined which is the _start_tiles property.
void add_start_tile (DS_TileInfo tile)
This method adds a pre-defined tile to the _start_tiles array.
This method checks if the given height value is within the height range or NOT.
This method checks if the given tile's height is within the height range or NOT.
This method returns the index of the first tile. The first tile is usually the tile that will be processed first by the algorithm.
This method gets all the free edges of the given tile. This means that the neighbour of the given tile's edge has NOT been processed yet.
This method expands the grid in the given direction. This basically turns the stage into a never ending stage or continuous stage. The range of the direction is from 0 to 5. UP = 0 NORTH = 1 EAST = 2 BOTTOM = 3 SOUTH = 4 WEST = 5
Giving any of the direction numbers will expand the grid.
NOTE: UP and BOTTOM may give weird results as they are still work in progress and requires further testing.
This method adds new tile/s to the given tile edges' The given tile MUST have at least one free spot to add the new tile otherwise it will NOT. This method also turns the stage into a never ending stage or a continuous stage.
NOTE: A free spot in the edge can be a neighbour NOT set yet or a null neighbour.
void add_tile_index (int tile)
This method adds new tile/s to the given indexth tile edges'. The given tile MUST have at least one free spot to add the new tile otherwise it will NOT. This method also turns the stage into a never ending stage or a continuous stage.
NOTE: A free spot in the edge can be a neighbour NOT set yet or a null neighbour.
This method checks if the start setup has been enabled or disabled which is the flag _is_start_setup.
This method checks if the generator was successful in generating a grid stage or NOT. True means was successful, false otherwise.
This method gets the number of process loop value. The process loop is the number of loops required by the algorithm to complete generating the stage.
void setup () virtual
This method sets up the generator and MUST be overridden. Basically this method starts the algorithm process.
void reset() virtual
This method resets the generator to it's default state.
NOTE: All the data in the grid will be resetted which means that any process done by the method setup() will be resetted.
This method gets the complete process time from start to finish of the generator.
This method checks if the generator is processing or NOT. True means processing, false otherwise.
Untyped get_data () virtual
This method gets the data file being used by the algorithm
NOTE: The reason for this method being untyped is because different scripts may use different data file.
Untyped get_tile_names () virtual
This method gets the name of the tiles.
NOTE: The reason for this method being untyped is because different scripts may use different data file that contains the tile names.
This method gets the stage loaded normal value which is the percentage loaded value. Range is from 0.0 to 1.0.
void print_debug_info () virtual
This method prints the debug for the generator.
TOOLS
CLASS REFERENCE
- Generators
-
- Wave Function Collapse
- Grids
- Tiles