#1 2016-05-08 01:07:49

yayo
Member

Procedural maps

Hi all! I'm totally new to Tesseract. I have to say that I'm impressed by the tech (I knew cube and sauerbraten, but this is way better), it's kinda sad that this isn't getting more attention.

I would like to know if someone can give me some light regarding procedural map generation in tesseract. Editing on the game itself is awesome, but I'd like to create maps procedurally. I have several ideas and I'd like to know which one is easier to implement (I checked a bit the code but there's a lot to grasp and I'd like to know your opinions before going deep to the code).

Note: my goal would be to have something like this.

1. Voxel manipulation: just start with a map full of voxels and carve around rooms/corridors (like old school ascii roguelikes). I saw already some hints at manipulating the map from code somewhere here, so it should be a matter of just... carving out voxels. But the results will look quite poor probably + potential issues with spawning points, mapmodels, etc. Not the best solution, and I'd like to avoid it.

2. "Prefab rooms" the "stupid" way: create a bunch of several "rooms" (corridors, T junctions, regular rooms, you name it) inside the same map. Put walls in between each room and portals where doors should be. After loading the map, set dynamically the destination of each portal/door, so when you cross portals you are effectively inside another room and fake a "new" procedural map each time you play. The cons of this are that... well, it's a bit stupid and I don't like the idea of portals magically teleporting you everywhere from one room to the next (where a door should be :D ). Also: assuming that one map could contain several times the exact same type of room in different "positions", it should trick the portal destinations to fake where you really are and keep track of your position in some "virtual world", composed by the "real" map... rooms. It's ugly and also I'm not sure this description is clear enough :)

3. "Prefab rooms" the "sub-map" way: like above, create in the editor a bunch of rooms, but instead of all rooms in one map, make just a single room in each one. Save them with proper names (room4x2, corridor1x3, whatever). Then when the game starts, pick up rooms following some logic generation rules and instead of having some weird portal manipulation, just load the new scenes as a "subscene" (in other words: append the contents of this new room to the current level, just offseting the position of the thing to where the new "blocks" should go). It would be awesome to be able to rotate the entire rooms too to minimize the amount of "prefab rooms" needed. Example: I have a central room and there should be a corridor to the left. Just load the proper corridor map dynamically, but appending all of its contents offseting their position to the left, where it should be. Obviously all of these prefab rooms should match (size, door positions, height, etc), but this way it could easily create a nice looking procedural map.

The problem with this implementation (the best from my point of view), is that it requires quite a lot of messing up with the code. From what I saw in load_world (worldio.cpp), new maps loaded override "worldroot" (and also there is the entire "load in progress" UI stuff and so on). So there should be a way to append new scenes, handle the loading of the new stuff and offseting the contents nicely (and handle the resources to not reload all assets everytime a new sub-map is appended). Maybe it is not as much work as I think?

Sorry for the huge wall of text, I will be happy to get any feedback on this.

Thanks for your time!

Offline

#2 2016-05-09 12:35:23

RaZgRiZ
Moderator

Re: Procedural maps

Regarding rooms and such, tesseract offers the option of geometry prefabs, so they don't even need to be saved inside the map itself to be loaded. The only problems would be that they do not save textures or entities and they are not map specific. Also, putting them on specific points is not something cubescript could hope to do any time soon.

It is however possible to generate geometry. There have been some "tools" since the sauerbraten golden age where they could generate shapes of all kinds at variable sizes and manipulate all cube corners in all the weird ways they can be pushed to create almost flawless replicas. It also allowed for early geometry prefabs that could be recreated with textures, materials and all the jazz, kinda like saving a whole map. There were also some more conventional generation tools for mazes and such.

I'm afraid i don't know of any more details however :P

Offline

#3 2016-05-10 11:37:13

ImNotQ009
Moderator

Re: Procedural maps

I've been working on a procedural generation system at some point that used a slightly modified prefab system. Prefabs as they are DO save texture slots, but you'll need to make sure that you have the same texture config everytime you use those.
Anyway, it's perfectly doable if not fairly easy.

Offline

#4 2016-05-10 21:56:45

yayo
Member

Re: Procedural maps

RaZgRiZ, ImNotQ009: thanks for your answers! I will check more the prefabs now and see what I can do :D

Offline

#5 2016-05-11 08:41:53

chasester
Member

Re: Procedural maps

It would be easier to create the room at random as well instead of storing prefabs. Because cube isnt a polygon based engine (like what your model is using) It would be easier to create the rooms using a pattern system (say a block 6x6x4) then adding things like trim and etc at random, using code and or a hmp (height map) tool. Rather then creating rooms to copy an past (mostly due to the fact that rooms would have to be exactly on the right angles (0 90 180 270).

Normally how you handle dungeon creation in a block system like tesseract is to create random boxes (random sizes with variable heights). Then connect the blocks, and remove the blocks that don't connect well. Then just simply detail your rooms and add nuances in the hallways, spawn monsters etc.

chasester

Offline

#6 2016-05-30 12:48:51

NeoXploD
Member

Re: Procedural maps

hi yayo
I like your idea
The simplest of the meter in place, is to use the obr
cube backup that you can take in other card volonter
I know if there is on tesseract
but I used her in hexahedron

Offline

#7 2016-05-30 14:42:49

NeoXploD
Member

Offline

Board footer