3d maze project...

Started by RemiD, October 08, 2019, 21:47:45

Previous topic - Next topic

RemiD

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

Amanda Dearheart

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!

RemiD

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)

RemiD

#3
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...

RemiD

#4
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 :'(

RemiD

#5
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...

Qube

This looks pretty interesting and quite intriguing. Cool idea on how you are approaching it :)
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

RemiD

#7
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...)

Xerra

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.
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/Gridrunner
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

Pfaber11

It's looking good . 3D monster maze for the zx81 was the first game I bought for a computer . Loved it . 
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

RemiD

#10
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...

RemiD

#11
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!!!)

RemiD

#12
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...

Steve Elliott

#13
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.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

RemiD

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...