NodotProject / nodot

A node composition library for Godot 4
https://nodotproject.github.io/nodot/
MIT License
332 stars 12 forks source link

Realtime tileset editor for building tile based worlds #154

Open MirceaKitsune opened 11 months ago

MirceaKitsune commented 11 months ago

Most of my work in Godot so far have been experimenting with random terrain and tileset based maze generators. As I'm hoping Nodot will allow using Godot as a no-code engine at least for common aspects, I'd like to suggest a node for generating and editing 3D grids of tilesets in realtime, which would make it easy to create many different styles of games without having to script the whole world editing system from scratch.

The node would allow defining a list of scenes representing tiles for various world items, such as terrain pieces for various slopes or road segments or houses and walls. The cell size is fixed and an universal setting to the node, so if you go for 64m each tile scene must be 64 x 64 x 64... if mixed sizes could be allowed (eg: 16x, 32x, 64x) that would be even more awesome but beyond the at least basic system I'm hoping for.

Some tiles can be standalone, meaning they don't change shape based on their neighbors and can be placed as they are in one of 4 rotations on the Y axis (0 / 90 / 180 / 270)... others should be possible to define as a set of edges and corners, allowing you to paint a space with a certain type of structure which then dresses the gaps against surrounding tiles with the appropriate wall scene at the right rotation (eg: if +x and +z are full but -z and -z are empty use "house_wall_corner_inner" at 90 for that tile). The system should be designed to allow defining direct junctions too for things like roads and pipes so they form continuous connections (eg: a road is set at this position, the same road exists to its left / right / bottom but not top, use the T shaped road segment at 180 to connect the 3). Terrains with varying degrees of slopes should be allowed the same way, with terraforming consisting of changing the terrain tile at a location to make it and its neighbors use different slope scenes that seamlessly connect... this might get complicated as other items like houses would need to respect terrain height and come on top of the ground at any placement in 2D space, while for roads they'd need to use matching sloped segments so they go up and down with the diagonal terrain surface. My plan was to allow designing custom underground dungeons and even the rooms of home interiors this way, it would depend on how flexible the tile and junction definition system can be made.

The node should allow some form of noise based generation for default setups, thus when you start a new game you get a random terrain with a few default tiles like trees scattered. The most important aspect though would be a realtime editing mode, where you select a given structure / material from a menu then click on the ground to change the tile there to a different structure or terraform the ground to a different height, a transparent figure of the mesh appearing to show how it will look like at that position / rotation. Ideally items could be linked to other requirements such as a money system, which only allows placing certain nodes if you have enough cash or giving you money back for removing existing ones... such parts might be too game specific and would further add to its complexity but things like this should be easy to setup with other node based components you define in the game.

I'm suggesting this as a feature for Nodot as it's a system many kinds of games use: From a RTS like Age of Empires, to a city building game like Simcity or Tycoon, to an interactive town builder like Animal Crossing, tower defense, even an in-game level designer for an urban FPS where you place buildings and tunnels and decorations to create a layout. I know it would likely be difficult to support all use cases in one package like I'm imagining, but in my opinion it would be a huge leap forward if we could have something like this out of the box and available as mere nodes with no scripting required. I was thinking of writing such a system myself a while ago, but it might be too much for my current skills and having it built by someone with experience into a package like Nodot would benefit a lot more developers. Thank you and I hope this can be considered in some form!

krazyjakee commented 11 months ago

This is a great write up, thanks!

If you were to slowly progress a prototype, I have no doubt we could find opportunities for general use nodes to add to nodot.