November 17, 2019, 11:07:03 AM

Author Topic: 3d maze project...  (Read 762 times)

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1011
3d maze project...
« on: October 08, 2019, 09:47:45 PM »
hi,

as i mentionned, i got my coding / modeling / drawing mojo back, ( the cold temperatures of the cold season helped me a lot :)) )

i plan to keep it simple ( except for the lighting / shading, you know me :-[ )

it will be a 3d maze, with simple graphics (low tris shapes + color texture + lightmap texture)

for now the world / map structure is :
cells
 statics
 lightsources
 items
 bots
 player

the gameplay will be a mix of exploration, orientation (to remember your path, where you came from) using crays of colors,  stealth (to avoid being detetect by bots or escaping bots), collecting valuables, and the stealth will be using shadows and a cape (to blend in the environment)...

first test :
2d map :


3d map with 3d cells :


let's see how far i can go this time...  ;D
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 bsisko

  • Jr. Member
  • **
  • Posts: 64
Re: 3d maze project...
« Reply #1 on: October 08, 2019, 10:12:36 PM »
Interesting.  What engine are you planning to use?  I too have a maze game planned based on the ZX81 classic 3D Monster Maze.
Prepare to be assimilated !  Resistance is futile!

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1011
Re: 3d maze project...
« Reply #2 on: October 08, 2019, 10:25:01 PM »
Quote
What engine are you planning to use?
Blitz3d, i have a good understanding of it, and i only plan to use lighting shading on texels (for static entities), and either on texels (if it is fast enough) or on vertices (for turning moving entities)
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: 1011
Re: 3d maze project...
« Reply #3 on: October 09, 2019, 10:14:18 PM »
today, i have coded a procedure to identify the "kind" of cell depending on its neighbours (if there are or not others cells at front, at back, at left, at right)
and then i debugged using textures :


now i can draw a map quickly on a 100*100 image (each pixel represents a 3x3unit cell), and the procedure will automatically determine the kind of cell, and then i can use this info to know how to assemble premade parts (like floor, walls, ceiling, statics, lightsources...)

and also i plan to use this info to automatically create nodes and links for pathfinding...

oups ! it works :

quite ugly colors, but it is for debugging ! here we see the colors tex in light red (for floor), light green (for wall), light blue (for ceiling) (uv coordset0 layer0 texel size 0.01), the texels in many colors are for the lightmap (uv coordset1 layer1 texel size 0.1)

time to go sleep...
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: 1011
Re: 3d maze project...
« Reply #4 on: October 10, 2019, 08:32:07 PM »
today i did some calculations and experiments to see if what i plan to do is possible (to not have a too big map/files size, to not take too much sram, too not take too much vram, to render the scene fast enough) and in theory it should work... :D

as mentionned previously, each cell will be made of statics (floor, walls, ceiling, tileparts, brickparts, beamparts, reinforcing columns / planks, roots, rocks... ), and at first i wanted to merge all statics of each cell into one mesh, one surface, one color texture, one lightmap texture, this would have been more optimized, of course, but also more complicated to do...

so i just did a quick test, to have up to 10 separate meshes / surfaces (with each a shared color texture and its own lightmap texture)
and as long as all entities are hidden, the render time is 2-3millis instead of 1milli (with the merging approach)
so for now i keep this (not optimized) approach...


about the texels, at first i planned to calculate, for each texel, of each static, of each cell, its 2d/3d properties, and prestore these values, but i realized that it will make the files size too big..

about the lighting / shading (lightmapping), at first i planned to do it when loading a map, but i realized that it would take too much time... (for up to 1000 cells !)

so the ideas i have now are :

for the texels properties : calculate the properties of each texel of each premade static, and never rotate a static, only position it in a cell, so that the texel texture position stays the same, the texel world position is easy to calculate, the texel normal stays the same...

for the lighting / shading, i will only calculate it for a few cells around the cell where player is, during the loading, and each mainloop, during a few millis, calculate the lighting / shading in the others farer cells, around player (i can do that because i know to which others cell a cell is connected...)

time to go sleep :'(
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: 1011
Re: 3d maze project...
« Reply #5 on: October 12, 2019, 08:11:37 PM »
ok, after some tests, i can copy premade parts and position/rotate them in a cell as i want and i have managed to use the precalculated texel properties (3d world positions, 3d world normals) of the premade part (with position at 0x0y0z, and rotation of 0pitch,0yaw,0roll) to then calculate the texel properties of a positionned/rotated part...

this will allow me to build cells with more variations, but also to not have to recalculate the properties of each texel of each new positionned/rotated part.

now the remaining problem that i see, is that since i use lighting/shading on texels (lightmapping), each part needs to have its own lightmap texture, and for now i don't want to merge the parts of each cell in one surface one texture, so there will be several separate parts (=several surfaces) childs of each cell, which may takes more time to render.

i plan to counter this by using low tris shapes and some notvisible cells / occlusion culling...
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 Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2198
Re: 3d maze project...
« Reply #6 on: October 13, 2019, 06:44:09 AM »
This looks pretty interesting and quite intriguing. Cool idea on how you are approaching it :)
Until the next time...

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1011
Re: 3d maze project...
« Reply #7 on: October 13, 2019, 08:35:46 AM »
Yeah, how i approach lightmapping has never been done before (to my awareness) (copying / assembling premade uvmapped / textured parts, instead of uvmapping / texturing a whole map)
this is similar to modular modeling... (building a map with premade modular parts)

i am rather a noob at making color textures, so i think that i will just search on the web for examples and try to reproduce a similar style... (i plan to use a base color + a lighting color + a shading color)

where do you guys find your color (diffuse/albedo) textures ?

apparently the difference between diffuse textures and albedo textures, is that a diffuse texture contains base colors + some (fake) lighting/shading (because they were used at the time before normal maps), whereas a albedo texture contains only base colors (and the lighting/shading is added using a normal map + a normal shader) correct ?

after reading a little about normal maps and how normal mapping work, i had the idea to code a similar thing for lightmapping the texels but in a static manner (without using a shader), and i think it is doable, but it will probably be too slow for real time texels lighting/shading like i am trying to do (because to add such details i will have to use a texel size of 0.01u instead of 0.1u, so 10 times more texels...)
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 Xerra

  • Hero Member
  • *****
  • Posts: 753
    • Retro Evolved
Re: 3d maze project...
« Reply #8 on: October 13, 2019, 09:19:57 AM »
You just gotta put a stalking monster in there to make it a proper game. I always wanted to make a game like 3d Monster Maze but never had an idea how to do it properly.

Online Pfaber11

  • Sr. Member
  • ****
  • Posts: 446
    • FABERSGAMES
Re: 3d maze project...
« Reply #9 on: October 13, 2019, 09:46:12 AM »
It's looking good . 3D monster maze for the zx81 was the first game I bought for a computer . Loved it . 
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1011
Re: 3d maze project...
« Reply #10 on: October 13, 2019, 10:01:28 AM »
it is looking ugly right now, you will see after i have added nice (hand drawn) diffuse textures and others parts and texels lighting shading 8)


1st experiment with my own diffuse textures (outline of each 2d shape is 1texel) :

each "material" (example : tile, brick, plank) has one base color, then 4 colors for (fake) lighting shading which gives an impression of relief.

however the problem we can see here is that if the texel size (or detail drawn) is too small, the outline of each shape drawn on the texture is not visible on the far away textures, the solution to this, i think, is simply to draw outlines which use more texels... i am going try that...

2nd experiment with my own diffuse textures (outline of each 2d shape is 3texel) :

still not ideal, but we can see much better the outlines of 2d shapes, even far away...
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: 1011
Re: 3d maze project...
« Reply #11 on: October 14, 2019, 09:59:35 PM »
today i had to rewrite some procedures so that they will be compatible with the map/entities structure...

and i have (surprisingly) managed to make the lightmapping work well :

yes you can see the texels of the lightmap (size 0.1u) and yes there is a staircase effect, but to keep it simple, i will keep it like that (also i like this old school graphics style)
 8)

however, if the lighting shading would be calculated considering a kind of normal map representing the reliefs on the floor, wall, ceiling, this would greatly improve the look, i admit it...

(it is way easier to use lighting shading on vertices + stencil shadows!!!)
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: 1011
Re: 3d maze project...
« Reply #12 on: October 15, 2019, 05:47:58 PM »
today i have coded a procedure which determines which cells to consider next for calculating the lighting shading on texels.

in blue, the cell where player is
in the different shades of grey, the cells connected to the cell where player is, the nearer, the whiter, the farer, the blacker (new english words lol)
in yellow, the nearest not lighted/shaded cell chosen to calculate the lighting shading.

each cell is only lighted shaded once...
but why not prepare that on my side and save lightmaps you may ask ?
well let's do some calculations :

if i would prepare/save the lightmaps on my side :
up to 1000 cells in a map
up to 5 sides (for floor + ceiling + walls) per cell = 30*30*5 = 4500
up to 5 statics (column, vase, box, statue, chest) per cell = 30*60*5 = 9000
total texels per cell = 13500
total texels per map = 13500000
required disk space = 60mb or more (since textures must be "power of 2")
quite heavy in octets/bytes
and this is only for one map...

if i would precalculate all the lightmaps during loading of the map :
around 250millis to lightmap a cell
for 1000cells = eround 250secs
quite slow...

hence my current approach :
during loading i plan to precalculate the lightmaps for the 40 nearest cells around player (total around 10secs), and while in game, use around 20millis per mainloop to calculate the lighting shading in the nearest not lighted/shaded cell.
so a cell would be lighted/shaded each 1sec, without disrupting the gameplay ( in theory  ;D )
this should work...
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 Steve Elliott

  • Hero Member
  • *****
  • Posts: 2098
  • elgol developer
Re: 3d maze project...
« Reply #13 on: October 15, 2019, 05:52:42 PM »
Nice atmospheric lighting in that scene, and the old skool shadows add some character.  As if this is a nicely lit scene, but hang on, there's some old skool shadows going on?!  Gameplay-wise you could imagine a mix of styles here - retro and a bit more modern.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1011
Re: 3d maze project...
« Reply #14 on: October 15, 2019, 06:22:29 PM »
well i started this project after having (re)played thief the dark project, and i plan to reproduce the graphics style and the visibility/hide in the shadows system, and maybe the sound system...

but in a maze-like environment, generated with premade parts, because i have difficulties to model big maps by hand...
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