Skip to content

Commit

Permalink
Merge pull request #48 from deadlykam/features
Browse files Browse the repository at this point in the history
Features
  • Loading branch information
deadlykam authored Jan 23, 2025
2 parents a021522 + a22ea93 commit 0c2b88b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ A godot tool that creates a grid world using different type of algorithms.
Godot version **v4.3.stable.mono.official [77dcf97d8]** and above should work. Previous Godot 4 versions should work but those have not been tested.
***
## Stable Build
[Stable-v1.0.1](https://github.com/deadlykam/Duniya_Skapare/tree/Stable-v1.0.1) is the latest stable build of the project. The compressed file for this project can also be found there. If development is going to be done on this project then it is adviced to branch off of any _Stable_ branches because they will **NOT** be changed or updated except for README.md. Any other branches are subjected to change including the main branch.
[Stable-v1.0.2](https://github.com/deadlykam/Duniya_Skapare/tree/Stable-v1.0.2) is the latest stable build of the project. The compressed file for this project can also be found there. If development is going to be done on this project then it is adviced to branch off of any _Stable_ branches because they will **NOT** be changed or updated except for README.md. Any other branches are subjected to change including the main branch.
***
## Installation
1. First download the latest [Duniya_Skapare-v1.0.1.zip](https://github.com/deadlykam/Duniya_Skapare/releases/tag/v1.0.1) from the latest Stable build.
1. First download the latest [Duniya_Skapare-v1.0.2.zip](https://github.com/deadlykam/Duniya_Skapare/releases/tag/v1.0.2) from the latest Stable build.
2. Once downloaded extract/unzip the file.
3. Enter the folder and copy the folder named **kamran_wali**.
4. Now paste the folder in the **addons** folder of your Godot project. If your Godot project does not have the **addons** folder then just create it in the root folder, **res://**, and paste the copied folder there.
Expand Down Expand Up @@ -58,7 +58,9 @@ See [Wave Function Collapse Tool](https://github.com/deadlykam/Duniya_Skapare/wi
| *Fig 4a: Simple WFC - Animation* | *Fig 4b: Tile Sets* |
***
## Updates
Updated the project for Godot 4.3, **v4.3.stable.mono.official [77dcf97d8]**. From code perspective had to change 2 lines because in Godot 4.3 you can no longer give a type return to an overridden method that has no type. So had to change some methods in child scripts and remove their return types. Everything else is working fine. Also if you are following the tutorial then it is recommended to use Godot 4.1 and plugin [Stable-v1.0.0](https://github.com/deadlykam/Duniya_Skapare/releases/tag/v1.0.0). But if you want to use Godot 4.3 then you can do so as well but must use the plugin [Stable-v1.0.1](https://github.com/deadlykam/Duniya_Skapare/tree/Stable-v1.0.1) instead.
1. Added tile custom co-ordinate while generating tiles feature. This means you can now give the starting tile co-ordinates for the x and y axis tiles and the logic will use that starting value to set the co-ordinate for the rest of the tiles. This is helpful if you know where to place your tiles in the game co-ordinate. If no values are given then the default co-ordinate will be used which is 0.
2. Added a flag that checks if the grid should be setup automatically during application start. This is to give more control to the user.
3. Added tile index. This way it will help the user to sync the tile's with other array.
## Duniya Skapare Meaning
The meaning of _Duniya Skapare_ is _World Creator_. [Duniya](https://en.wikipedia.org/wiki/Dunya#:~:text=%22Dunya%22%20is%20an%20Arabic%20word,%2C%20this%20world%20here%20below%22.) means _World_ in Arabic/Bengali. [Skapare](https://dictionary.cambridge.org/dictionary/swedish-english/skapare) means _Creator_ in Swedish. As I speak the mentioned languages I thought about merging them to give a unique name.
***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="DS Wave Function Collapse"
description="This is the plugin for using Duniya Skapare's wave function collapse settings."
author="Kamran Wali"
version="1.0.0"
version="1.0.2"
script="ds_wave_function_collapse_plugin.gd"
16 changes: 15 additions & 1 deletion addons/kamran_wali/duniya_skapare/scripts/grids/ds_base_grid.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ class_name DS_BaseGrid
extends Node

@export_category("Grid")
## The grid size in x axis.
@export var _grid_x:= 3:
set(grid_x):
if _grid_x != grid_x:
_grid_x = grid_x if grid_x >= 1 else 1

## The grid size in y axis.
@export var _grid_y:= 3:
set(grid_y):
if _grid_y != grid_y:
Expand All @@ -28,9 +30,15 @@ extends Node
var _grid_z = 0
#endregion

## This flag checks if the grid should be setup when the game starts.
## True means the grid will be setup at game start. False means the grid
## will NOT be setup when the game starts and the setup() method MUST be
## called through other scripts.
@export var _is_start_setup:= true

var _tiles: Array[DS_Tile]

func _ready() -> void: setup()
func _ready() -> void: if _is_start_setup: setup()

## This method gets the x-axis size of the grid.
func get_grid_size_x() -> int: return _grid_x
Expand Down Expand Up @@ -82,6 +90,12 @@ func has_tile_coord_x_y_z(x:int, y:int, z:int) -> bool: return has_tile_coord_x_
## This method sets up the grid.
func setup() -> void: pass

## This method sets the custom co-ordinates for the tiles from which
## the tiles co-ordinates will start. Default is 0.
## Example: If -1 is given for x and the grid size is 3x3 then the
## co-ordinates for x will be -1, 0 and 1.
func set_custom_coords(x:int, y:int, z:int) -> void: pass

## This method resets the grid.
func reset() -> void: pass

Expand Down
19 changes: 18 additions & 1 deletion addons/kamran_wali/duniya_skapare/scripts/grids/ds_grid_rect.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
@tool
extends DS_BaseGrid

@export_category("Custom Co-ordinate Properties")
## The custom and starting co-ordinate for x axis.
@export var _custom_coord_x:= 0

## The custom and starting co-ordinate for y axis.
@export var _custom_coord_y:= 0

var _custom_coord_z:= 0
var _index:= -1
var _counter_x:= -1
var _counter_y:= -1
Expand Down Expand Up @@ -260,7 +268,11 @@ func setup() -> void:
else null
)

get_tile(_index).set_coord(_counter_x, _counter_y, _counter_z) # Setting the coordinate of the tile
# Setting the coordinate of the tile
get_tile(_index).set_coord(_counter_x + _custom_coord_x,
_counter_y + _custom_coord_y,
_counter_z + _custom_coord_z)
get_tile(_index).set_index(_index) # Setting the index of the tile

_index += 1
_counter_x += 1
Expand All @@ -269,6 +281,11 @@ func setup() -> void:

_counter_z += 1

func set_custom_coords(x:int, y:int, z:int) -> void:
_custom_coord_x = x
_custom_coord_y = y
_custom_coord_z = z

func reset() -> void:
_counter_z = 0 # Acts as index for all the tiles in grid
while _counter_z < get_grid_size(): # Loop for resetting all the tiles
Expand Down
8 changes: 8 additions & 0 deletions addons/kamran_wali/duniya_skapare/scripts/grids/ds_tile.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var _is_fixed_actual:= false # This the actual fixed flag which means it can be
var _x:= 0 # X Coordinate
var _y:= 0 # Y Coordinate
var _z:= 0 # Z Coordinate
var _index:= -1

func _init() -> void: _data_edges.resize(6)

Expand All @@ -33,6 +34,13 @@ func reset_hard() -> void:
reset()
_is_fixed = false

## This method sets the index of the tile, it is recommended NOT to set the
## index of the tile manually or by the user.
func set_index(index:int) -> void: _index = index

## This method gets the index of the tile.
func get_index() -> int: return _index

## This method sets if the tile is fixed or NOT once
## a tile type is given.
func set_is_fixed(is_fix:bool) -> void:
Expand Down
2 changes: 1 addition & 1 deletion addons/kamran_wali/duniya_skapare/settings/version.tres
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

[resource]
script = ExtResource("1_qi1uw")
_value = "Version - v1.0.0"
_value = "Version - v1.0.2"

0 comments on commit 0c2b88b

Please sign in to comment.