Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
RememberMe14725322dDo you have discrete "rooms" with connections in between (so basically a graph of rooms with edges being connections) or is an "open connected space" the basic building block? I remember having to do a lot of sketchy code because I used a graph of rooms and visibility across rooms was a pain.
-
Demolishun34478322d@RememberMe its an open space. I think the engine has a bunch of occlusion code to reduce draw calls. If that is not enough I may have to create a chunk system and pause the processing of entities of objects outside a certain range. The grid I have shown it just a small area that is 32 * 32. I eventually want each "level" to be 128 * 128 or even 256 * 256. So I may have to implement a chunk system.
-
Hazarth9455322dMy recommendation would be to not bother with occlusion until you actually need it. Godot can handle tens of thousands of draw calls at 60FPS even without any optimization code. Game Dev is not dissimilar to software engineering, It's often emphasized to first build the game and not over-optimize early. I mean you can if its fun for you, but your overall progress is gonna be slower. Especially since you don't know if what you're making is even fun in the first place. It's better to first build a prototype/demo and then expand it from there, optimizing as needed
-
RememberMe14725322d@Hazarth this.
@Demolishun instead of occlusion culling, might actually be faster to batch draw the whole thing, even redundant parts, for such a (graphically) simple thing. As long as you avoid synchronization with the CPU for every draw call and the scene fits in GPU caches (avoids lots of data movement), you'll be very fast and power efficient. Few large chunks of (even redundant) work are usually much much better than many small chunks of work, and the less you involve the CPU the better usually.
Idk if Godot gives you that much control tho. -
Demolishun34478321dIntersection checking to make sure rooms don't overlap. I place larger rooms first and smaller rooms next. If a room fails to place after 10 random tries it is ignored. Next up is connecting rooms. I forced 1 square spacing between rooms. I used an AABB object to calculate the intersections.
-
KDSBest775321dLook into wavefunction collapse.
Or maybe check for the starting room in all directions if a room is accessible via a streight line connect them and save a list to not double connect rooms. Then recursive do that for all rooms.
I honestly would place one room then search all rooms pick one randomly check if I can add a connection thingy add it and generate a connected room. Pick random room and repeat. -
Demolishun34478321d@KDSBest yeah, I have been working in my head something similar. I do need to look at that wave function collapse. I keep hearing about it then forgetting.
One thing I need to do is have a nonlinear function define the random distribution of room types. Larger rooms should be genned less often. Been trying to think in my head how that would work. -
Demolishun34478321d@KDSBest
I started looking at the wave function collapse wikipedia page. Didn't understand anything. Looked around and realized I was in the wrong neighborhood. I didn't feel safe and thought I was going to get mugged by people with slide rulers and protractors. The fabric of reality started to oscillate.
Then I looked at the wave function collapse algorithm for CS. Ah, much better. Very interesting how you can assign rules. Found some implementations including a generic library for Godot.
I want the concepts of rooms though rather than cells. So I will see if that can be done. The reason I want rooms is because I want to predefine room types and interconnect them. This way I can have rooms like and altar room, a pool room, a fortress room, etc. But being able to randomize these rooms will be very useful. So not all fortress rooms look the same. -
KDSBest775321d@Demolishun I would suggest you make it configurable for each room "how the odds are" then you can change it. Maybe you want a big room full of npcs that has a 100% spawn chance or so. Wouldn't tightly couple that to room size.
That's just me tho.
Related Rants
Working on random room code in Godot. I am placing 1m * 1m scenes (meshes). Right now its just a square block. I need to work on occlusion of rooms. Then connecting rooms. I am going to try a 3d, but made of 3d tiles inside areas. Still trying to decide on what to use for outside terrain. I did find a terrain library that allows for digging holes in the terrain. This is where I will have players build a base and dig underground.
I am thinking a really casual game that you can crank the difficulty if you want. A relaxed rpgish game with some rts flavor to it. If someone wants to just chill they can turn off the rts side. Allow for multiple bases for resource gathering. Maybe do some automation of resource gathering using slaves...err...minions. Gonna stay single player for this iteration. I don't really want to spend time working on net code for this.
For now I just gen random rooms:
rant
random
game