Skip to content

Latest commit

 

History

History
81 lines (52 loc) · 2.71 KB

README.md

File metadata and controls

81 lines (52 loc) · 2.71 KB

grid

godot-grid

A gdscript library to make working with rectangular grids easier.

When to use it:

  • You need access to every sprite in the grid and plan to manipulate them by code.
  • You want to generate the grid of sprites from code.

When not to use it:

  • You don't need to access the tiles from code.
  • You want to make the grid from the editor by hand. Use tilemaps for that.

Preview

Make patterns:

Easily work with Columns, Rows and Diagonals:

Clusters and Collision:

Tutorial (to see all Features)

Applications

It's supposed to be useful when you have some sort of rectangular grid based system in your game.

  • tetris
  • chess
  • grid based puzzles
  • grid based combat
  • ...

Performance

Since every Tile is a Node (with potential children), you will get lags from 10k Nodes upwards depending on the machine.

So this library is intended for comparativly small Grids.

Some features just use static information and thus are quite fast (the look up tables).

But others generate Arrays depending on the input and can become quite sluggish, with growing dimensions of the grid. See 'Access relative to a Tile' Chapter in the Tutorial

Other Performance Tips:

  • make sure to only put PackedScenes in Grid.tiles, because putting Nodes requires the use of Nodes.duplicate() which is slow
  • removing a lot of nodes with XScene.remove_scene(), tends to be slow, simply because freeing nodes or detaching them from the tree is expensive

Installation

Made with Godot version 3.4.2.stable.official.45eaa2daf

This plugin depends on XScene You have to install it aswell.

This repo is in a Godot Plugin format.

You can:

  • Download the .zip of this repo and unpack it into your project, currently XScene is included in the .zip

For more details, read the godot docs on installing Plugins

Don't forget to enable it in your project settings!

Future Feature Ideas

  • support for hex grid
  • support for triangular grid
  • support for isometric grid
  • you can open an issue if you're missing a feature

Attributions

Menu icons created by Kiranshastry - Flaticon