August 22, 2019, 12:50:46 AM

Author Topic: "caves 3d" (explore caves, avoid harmful things, find the exit)  (Read 4552 times)

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #15 on: February 24, 2018, 07:28:37 PM »
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)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Derron

  • Hero Member
  • *****
  • Posts: 2334
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #16 on: February 24, 2018, 07:42:12 PM »
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

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #17 on: February 24, 2018, 08:05:08 PM »
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...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #18 on: February 25, 2018, 04:08:00 PM »
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 !
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
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...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1181
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #20 on: March 02, 2018, 11:12:43 AM »
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...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1181
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #21 on: March 02, 2018, 11:33:31 AM »
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.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #22 on: March 02, 2018, 12:30:55 PM »
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 !
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1181
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #23 on: March 02, 2018, 12:31:32 PM »
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

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #24 on: March 02, 2018, 12:35:50 PM »
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 ;)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Rooster

  • Sr. Member
  • ****
  • Posts: 358
  • I don't know what this does...
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #25 on: March 02, 2018, 05:08:45 PM »
@ 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.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #26 on: March 02, 2018, 05:35:02 PM »
@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...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #27 on: March 03, 2018, 01:28:21 PM »
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)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline RemiD

  • Hero Member
  • *****
  • Posts: 825
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #28 on: March 04, 2018, 04:56:40 PM »
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...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline STEVIE G

  • Sr. Member
  • ****
  • Posts: 295
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #29 on: March 04, 2018, 05:18:57 PM »
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?