Skip to content

A simple wall or fence plugin for Godot 4.x

License

Notifications You must be signed in to change notification settings

mikael-ros/picket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


A simple fence plugin for Godot Engine 4.x. Makes the building of fences easy, and dynamic.

GIF of painting a P in Picket

Buy Me a Coffee at ko-fi.com

🤔 Why?

I created this plugin for use in a small game project I'm working on. I wanted to have a simple and flexible solution for drawing fences that auto-connect, and could not find any simple solutions. Such solutions may exist, but Google (as usual these days) failed me, so I decided to implement it myself. If anything, I learnt something from it :)

⚙️ Installation

💚 Easy

This will be the easiest method, if you don't mind updating manually

  1. Download the latest release
  2. Open or extract the .zip
  3. Copy folder to the /addons/ folder of your Godot project

Caution

Make sure to preserve parent directory. Path should be /addons/Picket, or similar

  1. In the Godot Editor, click Project -> Project Settings -> Plugins -> Click the Enable tick next to the Picket plugin

🧠 Advanced, but flexible

Warning

I cannot guarantee the below working as expected, I have only recently began utilizing this methodology during development of this addon, I utilized a slightly advanced function within git, submodules. The benefit of this, I believe, is that you can simply git submodule update --remote to fetch upstream changes.

  1. In your project directory, git init, if you do not already have a git repository
  2. Create the /addons/Picket/ directory
  3. Execute git submodule add [email protected]:mikael-ros/picket.git /addons/Picket
  4. In the Godot Editor, click "Project" -> "Project Settings" -> "Plugins" -> Click the Enable tick next to the Picket plugin

🛠️ Usage

Picket drawn in Picket

🖼️ Texture

Note

This plugin has only been developed with 1:1 aspect ratio in mind. Other ratios may work, but are not officially supported

This plugin uses two separate textures; one for your fence, and one for the posts.

Post texture

Post should be centered in the middle of it's texture, but can be of any size you like.

Example post texture

Fence texture

Should be centered vertically, and should take up the width of the texture.

Example fence texture

⚡ Minimal setup

  1. Add the Picket node to your scene

    Adding Picket to scene

  2. Add a TileSet in the properties of Picket

    Adding tile set

  3. In the "Tile Set" tab, add the two textures. Ideally, fence first, post second

    note: if textures are not in that order, change the indices in the Texture positions tab of Picket.

    Adding tile set textures

  4. In the "Tile Map" tab, paint tiles as you normally would

    Painting fence

📂 Using the demo

Load demo.tscn into a Godot project where you have installed and enabled Picket.

✨ Advanced features

⚓ Anchors

You can adjust the position at which the fences intersect. This shifts the position, and can be useful if you want to have padding.

How anchors affect the intersection

Tip

If you still want to adjust the position manually, use the Origin positions. Any adjustment of the normal Position vector will be overwritten otherwise.

📍 Offset

You can adjust where in the tile the posts are placed. The addon will dynamically fill in posts where absent, so spacing is consistent.

Offset adjustment

🔁 Rotation

You can rotate the fence direction by first enabling Positioning -> Direction interpretation -> Direction interpretation mode

Rotations

Additionally, you can enable "unsupported" rotation (eg. rotation that is 90 degrees or 270 degrees) by ticking the corresponding box. These are regarded as "unsupported" because they look weird, but may be useful in certain situations.

🔂 Explicit rotation mode

This is the only supported rotation mode at the moment. Fence is rotated by using the controls in the Tile Map editor.

Note

At the moment, there is no preview for rotation, as this is difficult to implement.

🧩 Current limitations and feature suggestions

Currently, tile shapes are not supported beyond "Square". Non-uniform fences aren't supported yet either, so fences can only be straight.

If you desire certain functionality within this plugin, or encounter a bug, feel free to add an issue and I will get around to it when time allows - or you can contribute it yourself, see the contribution guidelines

💾 Short technical description

This plugin reads the tile map data, and paints five child TileMapLayers. Two for the fences - one for vertical connections and one for horizontal connections - and three for the posts (vertical, horizontal, and stationary).

The cursor exists on another temporary layer, which only exists in the editor. While this could just have been a sprite, the idea is to permit future preview implementations.

While the amount of layers may seem excessive, this is necessary for offsets and anchors to work. If you'd like, you're welcome to contribute a better solution :)

For more technical details, read the code contained in this repository.