0 votes

Hi everyone,

I'm building a game that is procedurally generated. The world is separated into biomes and each biome has their own rooms.

Each biome constructs its graph which contains the room structure:

Then the biome chooses the right rooms from the prefabs I've made or just construct one according to a "basic prefab".

I was wondering how I could implement this factory system in Godot.
My inital thought was to preload every room prefabs and then construct a dictionnary according to their properties but once I've preloaded them I can't read their properties they aren't instantiated.

Would it cause problem at a large scale to instantiate them, read their properties and then destroy them ?

Or have you any other idea on how to implement it ?

Godot version latest
in Engine by (23 points)

1 Answer

0 votes

Have you tried the solution you yourself suggested? I don't think it should be a big problem, surely most weight is in actually loading the scenes, not instantiating them.

Another way to accomplish this would be having the properties written in another scene or file altogether, but this might be messier, less manageable way to do it if aforementioned system works well enough.

by (1,096 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.