Skip to content

waterstopper/2DHouseGen-Godot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

2DHouseGen-Godot

(Last update: May 2021) Generator of 2D houses for Godot v3.3.3 (might work with Godot 3.4)

https://waters-top.itch.io/2d-house-generator - web version to generate houses without forking the repository

Features

Generate:

  1. a suburb house

s1

  1. a high house

h1

  1. a city

c1

About house generation

  • Each room in a house is accessible via stairs by 2x1 player (he won't hit his head on the ceiling) Very rarely it is not true (only in the extreme cases, see below)
  • Each room has its own type. Furniture spawns according to that type.

Suburb house generation algorithm

Not describing high house algorithm because it is very simple: stack floors on ech other and make sre that rooms have different widths This description should give some cues about what is happening. Comments are hints too. All random operations have customizable bounds, like room width or number of rooms/floors

  1. Create 1st floor(choose random width for rooms and choose random amount of rooms), add doors between all rooms and on the sides of the floor
  2. Create i-th floor which is not wider than previous
  3. Connect i-th floor to the previous by stairs. If impossible, connect with a ladder
  4. Add doors between rooms on i-th floor
  5. Repeat 2-3 for all floors from 2 to n
  6. Merge rooms together into 2x2 big room between 1st and 2nd floor or into 2x1 room in i-th and i-1-th floor.
  7. Add windows for each side room except 1st floor with respect to big rooms merged on a previous step (these rooms might have larger windows)

Code

Code has comments, it is possible to figure out what it does.

  • Each structure class has stateDump function for debugging
  • Create functions have params (e.g. number of houses in a city)
  • There is a Player class, he can open doors
  • Platforms are on the different Tilemap because of the ladders
  • Room specific furniture's can be tweaked in Furniture.gd dictionaries
  • All tilemap resources can be changed and will work perfectly with custom ones (if you provide the right names for the tiles or create your own dictionaries)

Examples

More suburb houses:

s2

s3

High house with a staircase in the middle:

h2

Suburban town:

c2

The "Pyramid" (suburb house with 50 floors and 50 rooms on 1st floor)

p1

Close-up (case when floors are not accessible because of room merging):

p2

About

Generator of 2D houses for Godot v3.3.3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published