"caves 3d" (explore caves, avoid harmful things, find the exit)

Started by RemiD, February 18, 2018, 00:13:08

Previous topic - Next topic

RemiD

Quote
You can still use multiple floors. A*star will work the same. A floor change is just another "step".
try it, always easy in theory...

In my case it would have been more complicated because i want each area (cave) to have a different height depending on the "largeness" of the area, so all levels would not have had a uniform height...

But i have chosen a simpler approach : the areas will have a different height depending on their "largeness", however there will be only one level.
And to go to another level, you have to use an "entryexit" (to go from one level to another level)

Derron

For path finding the "height" of a cavern should be of less importance. Just think of yourself drawing a map of the cavern system - does it include all the different heights or do you try to "abstract" it into floors?
Same is done when doing the pathfinding.

And A*Star contains some kind of "weighting" - so you could add "height changes" in the calculations too. At least I would try to do so.


bye
Ron

RemiD

I was not talking about the pathfinding, but about the generation of the caves, with different heights and passages to down or to up, and of course it is possible to generate such caves, but i don't want to complicate things at the moment...

RemiD

Today i have coded a procedure to identify the outlines (pixels) of the shape of an area, from the exterior to the interior, the idea is to create a kind of heightsmap for each area so that different areas will have differents reliefs / heights. (on the ceiling)

Not sure if this will look good once applied to the surface of each mesh, but the procedure works well :
the shape :

the different outlines :

each outline corresponds to a height, starting at 3units at the exterior, and i think that i will add 0.1unit for each outline (from exterior to interior)

It should be easy enough to identify each vertex inside each cell (corresponding to a pixel)

anyway !

RemiD

today i have added the "outlines heights" (to add some "depth" on the ceiling of areas) and irregularities to the floors walls ceilings depending on the vertices normals.





This looks natural enough for my taste...


Next : i will try to add "statics" like stalagtites, stalagmites, columns, rocks, crystals, and then lightsources...

iWasAdam

looks really nice.
Here's a different approach for you to think about.
Taking the 'general' map from above I created a grid map:

where green is a corridor, ochre is low and orange is heigh.

All you need is a set of pre-defined 'cave' meshes for the walls and ceilings, the ground 'could' be a different mesh entirely.
You don't have to do any 3d collision you just use the grid...

Don't like the caves, then just change the mesh's for something nicer like a castle...
You haven't changed the game code one line, apart from importing different meshes...

Enemies, dressing, bonus, etc. Just add a layer to the grid with the references you want...

iWasAdam

I'm going to give you some reference pics and things to think on:
fallout and Skyrim - possibly one of best 3d rpg there is. let look at how skyrim is put together.
1. there are two parts: The open world (we're no looking at that)
2. Closed spaces, caves, etc (were going to look at how they do it)
Here's a closed cave system in skyrim:


Here's a view of how it is put together:


Here's a full overview of a 'map'


And here's a top down and 3d view:


Everything is predefined to a grid, brought in to the mapping system. and then placed and aligned, then with dressing added sent to testing.

Nothing is 'createmesh' it is all imports... all neatly accessible and all very fast to create and test and debug. You just start with a basic box, add a deform = instant cave, now texture.

RemiD

About collision detection and repositionning, i could use a similar system that what you suggest : the map / areas are divided in cells, and the smallest area is 3x3cells, so i could allow movement only on the cells which are floor + ceiling (not floor + wall + ceiling) and floor + passage + ceiling.


About using premade sections, i know about this approach (i used to create mods for Morrowind, similar to Skyrim and Fallout 3), but i wanted to create something where each area being completely different than the others, and my current system works rather well. (even if it is limited)


About examples for the graphics, i have found these :
assetstore.unity.com/packages/3d/environments/dungeons/low-poly-caves-93612
assetstore.unity.com/packages/3d/environments/dungeons/low-poly-crystal-caves-81340
assetstore.unity.com/packages/3d/environments/dungeons/underworld-mobile-cave-environment-11144
assetstore.unity.com/packages/3d/environments/dungeons/underworld-cave-environment-10875

and also the movies "the descent 1", "the descent 2", "the cave"


however i will try to keep it simple to manage to finish it !

iWasAdam

ok, heres a practical version:


5x10 grid, deformed and textured, vertexes moved to form a half arch, combine and flip and merge

It took 5 minutes to do this. and I can go back and re-edit the mesh mad it smoother use a different texture and fit it to a grid, etc.

No-one is criticising your methods, just attempting to bring you from the dark side and into the light. it really will make your life soo much simpler...  :D

RemiD

this is a possible approach, i know, but your environments will look very similar since you always use the same parts. (this was the case in Morrowind, in Oblivion, in Fallout 3)

now that my procedures are coded, i just have to draw the 2d map in an image editor, (one different color for each area), to draw the passages between each area (2pixels for each passage), to draw the entryexits (1 pixel for each entryexit), then save the image, then put the files in the Maps directory, then push the compile button, and the program identifies, then builds, the areas, the fwcs, the passages, the entryexits, the surfaces, then save them. And if the files already exist, it loads them...
So this is quicker than assembling parts on a grid ;)

Rooster

@ iWasAdam
Thats really cool seeing how the stuff works under the hood, thanks for posting that. :)

Also it's neat to see the different ways that you guy's going about solving the same problem.

RemiD

@Adam>>also, something that i have not mentionned, is that i have no desire / motivation to create maps / environments manually... That's also why i prefer the "procedural generation" (i still make premade meshes / textures in a modeling tool / image editor, but i don't want to position / oriente them myself in a map editor !)

But apparently you have created all the maps in your previous game, manually, so maybe you like that, each his own preferences...

RemiD

first experiment with lighting shading, using vertices lighting shading with the command LightMesh() (i have put a code example in the codes archives)





This looks nice imo, but not the lighting shading that i want, it is too bright, this is because the default vertices lighting shading of directx 7 lights and of lightmesh, in Blitz3d, has lights which have a infinite range... (lights have an infinite range in reality, but there are some particles in the air which make their intensity decrease with distance, that's what i will try to code, so that there will be lighting shading around lightsources, but also dark areas)

RemiD

Today i have added crystals (as lightsources), and stalagtites stalagmites.



I have not coded the vertices lighting shading procedures yet, so it is still too "bright" for the ambiance that i want, but nice nonetheless...

STEVIE G

Quote from: RemiD on March 04, 2018, 16:56:40
Today i have added crystals (as lightsources), and stalagtites stalagmites.



I have not coded the vertices lighting shading procedures yet, so it is still too "bright" for the ambiance that i want, but nice nonetheless...

Looks excellent.  It would look better if the stalagmites and tights were better merged with the floor / ceiling - might just be the normals though. 

Have you considered un-welding the triangles to get a nice flat shaded look, I have a simple function here if you want to give it a try?