May 26, 2018, 03:33:44 AM

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

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
"caves 3d" (explore caves, avoid harmful things, find the exit)
« on: February 18, 2018, 12:13:08 AM »
edit : same environment, new theme / gameplay based on the movie "the descent"

For the moment the map structure looks like that :
maps
 areas
  fwcs (floor wall ceiling parts, to make the inside of a cave)
  passages (to go from one area to another)
  entryexits (to go from one level to another)
  statics (columns, stalagtites, stalagmites, rocks)
  lightsources
  items
 turningmovings (traps, creatures, player)

First step : design a way to create a map quickly

I have chosen to create the map in an image editor on a 100w100h image, with 3 layers :
one layer for the areas, made of fwc parts, (each area is a cave)
one layer for the passages (to go from one area to another)
one layer for the entryexits (to go from one level to another)

Using an image editor, i have drawn quickly several shapes of areas connected one to another, each area of a different color.


Using Blitz3d, i have read the pixels of the image to create the areas made of fwcs, the passages, the entryexits


Using Fragmotion, i have modeled all the fwc parts without passages, with passages :



next step will be to replace the debug tiles by the appropriate fwcs parts and merge all fwcs of each area in one mesh one surface one texture...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 529
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #1 on: February 18, 2018, 10:09:25 AM »
One thing to have in your mind. THIS IS NOT 3D!

Have a look at how it constructed here:
http://lodev.org/cgtutor/raycasting.html

It shows you how the map and everything else is 2D. So maybe do it completely in 2d with just block graphics - get the sliding collision right, the firing, etc. all in a 2D map.

Then you can think about moving the view into 3D :)

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #2 on: February 18, 2018, 10:33:48 AM »
Quote
THIS IS NOT 3D!
ok! ok! i am just trying to make a similar game, i don't care about the underlying technology / method used !

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 529
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #3 on: February 18, 2018, 10:55:49 AM »
I think you're missing my point.

Take a look at the wolfenstein editor:


It's a simple 2D grid of cells.

Although you are using a sort of similar method of using bitmaps for the map. I think you will run into some really nasty problems in the long run.

If one of your colors is even slightly not expected it will be read in wrong!

Much better to start with a simple (say 5x5) internal grid, with walls/doors on one layer. Test out your movement system with this simple map and get the movement right, sliding collision, etc. You don't need any data coming from bitmaps, or anything, just a few lines of data.
0 = no contents
1 = wall
2 = red door closed
3 = red door open
4 = red key
5 = door closed
6 = door open
7 = enemy
8 = your start

if cell = 0 then move
if cell = 1 then stop its a wall
if cell > 1 check for other things

IT IS 2D, but really easy to get your head around, but incredibly hard to 'get right' - but nice and simple to draw onscreen top down.

Once 'everything' works then transfer the display from 2d to whatever 3d you are going to use. you have already got all the collisions sorted (in 2d), key, doors, etc.

... ;)

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #4 on: February 18, 2018, 11:08:24 AM »
Quote
Although you are using a sort of similar method of using bitmaps for the map. I think you will run into some really nasty problems in the long run.
If one of your colors is even slightly not expected it will be read in wrong!
I only use an image to quickly design / build the map, then i don't use it. the turns moves will be done in 3d, the collisions detection and repositionning will use linepicks and 3d pickables (low details meshes), the pathcalculation pathfollowing will use 3d nodes, the occlusion culling will use the passages from one area to others areas to determine which areas to display around the area where player is.

So no problem in sight... But i keep your advices in mind...

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #5 on: February 18, 2018, 03:34:32 PM »
this seems to work :

now i want to merge all fwcs of each area in one mesh one surface one texture (to improve the vertices lighting/shading, and to decrease the rendering time), and then add iregularities to the floors walls ceilings depending on the normal of each vertex...

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #6 on: February 18, 2018, 06:41:48 PM »
Ok i have managed to merge all fwcs parts of each area in one mesh one surface and to update the normals, and it seems to work as expected.


Also i will probably need to subdivide each fwc part a little more (each 0.5unit) so that the vertices lighting / shading will look better.

Next step : subdivide each fwc part, and then code a procedure to add irregularities to the floors walls ceilings

Offline Yue

  • Hero Member
  • *****
  • Posts: 579
    • YiHosting Your Hosting Free
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #7 on: February 18, 2018, 07:57:36 PM »
I have a phobia of holes... that image scares me.   :-X

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #8 on: February 18, 2018, 08:23:30 PM »
There is nothing to fear at the moment, but when i will add the others components and the creatures, a nice lighting/shading, it may become scary.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #9 on: February 20, 2018, 08:42:51 PM »
Today i have modeled new passages, and fixed an annoying bug in the code, and tested a way to identify the vertices which are near the passages (on the border between 2 areas)
Because each area has one mesh one surface one texture (made of several premade fwcs and passages), and i want to add irregularities to the floors walls ceilings of the area, but the vertices which are on the border between one area and another area must not move, or there will be holes in the mesh !

So what i did is to put a pivot at the center of the passage, and if some vertices of the surface of an area were within a specific range (distance), they will not be considered when adding irregularities to the floors walls ceilings...



Here you can see the result with debug markers...

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (similar to "catacombs 3d" on DOS)
« Reply #10 on: February 23, 2018, 08:25:27 AM »
Well, i have decided to follow Adam's recommendation and to (try to) create a video game similar to the movie "the descent",
I can always use the procedures i code for this game, for others games...

Let's see how far i can go !

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #11 on: February 24, 2018, 10:56:35 AM »
So, yesterday i tried to add a more complex structure to the caves, more diverse passages, and then i realize that it will be  more complicated to code the ai and the pathfinding, so i just simplified the structure... (not to end up with another never ending project !)

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 529
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #12 on: February 24, 2018, 11:27:08 AM »
I'm going to say (very quietly), think of this not as 3d, but a 2d grid.
AI and pathfinding on a 2d grid is much simpler to do than in pure 3d - where it's horribly complicated.

3d is HARD.
3d collision is VERY hard.
3d collision with strange shapes and forms is very VERY hard.
3d AI and Pathfinding is Uber HARD.

Mostly all of these are NOT done in 3d, but on a 2d map of some form to make thing easier to do. with 3d collision only for very specific things - and usually some form of custom (read bought in) engine.

Using Blitz or Max or Monkey1/2, you are going to find your own way, and there will be problems along the way.

Try with something simple like a 2d grid and work from there up....

Offline RemiD

  • Hero Member
  • *****
  • Posts: 585
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #13 on: February 24, 2018, 11:35:50 AM »
Quote
think of this not as 3d, but a 2d grid.
AI and pathfinding on a 2d grid is much simpler to do than in pure 3d - where it's horribly complicated.
i agree ! that's why i forgot about my previous idea to have passages to areas below and above (through the floor / ceiling), now i only have passages at front back left right (through walls)

The added complexity is not only for pathfinding, but also for collision detection and repositionning, and more animations to create, so for now i have decided to work only on the basic functionalities / components...

Offline Derron

  • Hero Member
  • *****
  • Posts: 961
Re: "caves 3d" (explore caves, avoid harmful things, find the exit)
« Reply #14 on: February 24, 2018, 11:44:15 AM »
You can still use multiple floors. A*star will work the same. A floor change is just another "step".


But you should see an organically shaped cavern as if you need to draw as a map on checkerboard paper. All the little dents can be ignored.


Bye
Ron