SyntaxBomb - Indie Coders

General Category => Worklogs => Topic started by: RemiD on October 08, 2019, 09:47:45 PM

Title: 3d maze project...
Post by: RemiD 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 :
(http://rd-stuff.fr/screenie-3dmaze-map-2dpixels-20191008-2231)

3d map with 3d cells :
(http://rd-stuff.fr/screenie-3dmaze-map-3dcells-20191008-2231.png)

let's see how far i can go this time...  ;D
Title: Re: 3d maze project...
Post by: bsisko 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.
Title: Re: 3d maze project...
Post by: RemiD 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)
Title: Re: 3d maze project...
Post by: RemiD 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 :
(http://rd-stuff.fr/screenie-3dmaze-debugging-cells-kinds-with-textures-20191009-2255.png)

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 :
(http://rd-stuff.fr/screenie-maze3d-FWCs-test-20191008-2310.png)
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...
Title: Re: 3d maze project...
Post by: RemiD 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 :'(
Title: Re: 3d maze project...
Post by: RemiD 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...
Title: Re: 3d maze project...
Post by: Qube on October 13, 2019, 06:44:09 AM
This looks pretty interesting and quite intriguing. Cool idea on how you are approaching it :)
Title: Re: 3d maze project...
Post by: RemiD 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...)
Title: Re: 3d maze project...
Post by: Xerra 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.
Title: Re: 3d maze project...
Post by: Pfaber11 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 . 
Title: Re: 3d maze project...
Post by: RemiD 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) :
(http://rd-stuff.fr/screenie-maze3d-fwcs-ctextures-test-20191013-1116.png)
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) :
(http://rd-stuff.fr/screenie-maze3d-fwcs-ctextures-test-20191013-1157.png)
still not ideal, but we can see much better the outlines of 2d shapes, even far away...
Title: Re: 3d maze project...
Post by: RemiD 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 :
(http://rd-stuff.fr/screenie-3dmaze-texels-lighting-shading-20191014-2250.png)
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!!!)
Title: Re: 3d maze project...
Post by: RemiD 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.
(http://rd-stuff.fr/screenie-maze3d-determine-which-cells-to-consider-for-ls-20191015-1823.png)
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...
Title: Re: 3d maze project...
Post by: Steve Elliott 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.
Title: Re: 3d maze project...
Post by: RemiD 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...
Title: Re: 3d maze project...
Post by: 3DzForMe on October 16, 2019, 05:16:14 AM
Quote
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!!!)

Oh my RemiD - awesome work - looks like you may have an entry for the next compo just in time! Beautiful work heralding B3D, hell yeah! ;D ;D ;D
Title: Re: 3d maze project...
Post by: Naughty Alien on October 16, 2019, 02:47:47 PM
..looks very nice..maze concepts somehow never gets old for me..now you 'infected' me with it and i may just start doing one of my own.. :)
Title: Re: 3d maze project...
Post by: RemiD on October 16, 2019, 05:34:18 PM
what happened is that i have played a game that i like in september/october (thief the dark project), and since i have learned to make video games, you know how it is, you look at the game you play with developper eyes, and so i noticed a few things that i could mod/improve, but then i opened a map modeler (3d world studio) and i realized how much time/energy it takes to make maps by hand. (especially concerning the scaling of shapes, and the spliting in different parts, and the combination of the exported meshes with your engine for collisiondetection/pathfinding/culling)

then i gave up for a while, and noticed a few posts here about mazes, and this inspired me to use this kind of environment because it is easy to build with procedures (with premade parts)

(http://rd-stuff.fr/screenie-3dmaze-texels-lighting-shading-20191016-2148.png)
 8)
i am amazed how a simple (low tris) scene can look good (imo) with fake lighting shading on diffuse textures and lightmapping (not as nice as normal mapping + per pixel lighting, i admit it...)

well these experiments of lighting shading on texels taught me something : now i understand why some games are so heavy (in octets/bytes) to download, the lightmaps can take so much space if the texel size is small (especially if used with normal maps!)

so albedo textures + normal maps + real time per pixel lighting shading is clearly the easiest way to add nice lighting shading (and shadows) to a scene (but i can't do that with blitz3d!)

for now, all seems good to continue with the approach i have taken, so i am going to continue like that...

but i am curious to try to light/shade the same scene with vertices colors + stencil shadows... maybe later
Title: Re: 3d maze project...
Post by: RemiD on October 19, 2019, 11:31:16 PM
first time you most likely see this effect in your life :
a per texel spotlight ! (the lighting/shading is on texels, it is like real time lightmapping, but for a spotlight)
(http://rd-stuff.fr/screenie-3dmaze-texels-lighting-shading-spotlight-20191019-2357.png)
too slow to be used in real time on my computer (around 60-70ms to calculate/color), but hey the programmer within you will appreciate the effort 8)
Title: Re: 3d maze project...
Post by: 3DzForMe on October 19, 2019, 11:34:02 PM
So Sweet ;) :D Great work as always RemiD
Title: Re: 3d maze project...
Post by: Qube on October 20, 2019, 06:34:38 AM
first time you most likely see this effect in your life :
a per texel spotlight ! (the lighting/shading is on texels, it is like real time lightmapping, but for a spotlight)
...
too slow to be used in real time on my computer (around 60-70ms to calculate/color), but hey the programmer within you will appreciate the effort 8)
That looks pretty funky, I like it :) - Is there no optimisations you can do to make it real time? :(
Title: Re: 3d maze project...
Post by: RemiD on October 20, 2019, 07:45:21 AM
Quote
Is there no optimisations you can do to make it real time?
i have already optimised a lot to prevent unecessary calculations, but even with a texel size of 0.1unit, in a simple scene like that (corridors), there are around 27000texels to light/shade each loop !!!

for the same simple scene (corridors), with subdivided meshes for a nice progressive lighting/shading on vertices, there would be only around 1180vertices to light/shade each loop, much faster!
and with stencil shadows this would look fabulous !

however i just had an idea on how to create a fake spotlight effect using 2 renders :
one of the scene fullbright with a "circle mask"
one of the scene pre lighted/shaded on texels
then display the circle (with fullbright render) on top of the normal render
this should work, and should be fast !
Title: Re: 3d maze project...
Post by: iWasAdam on October 20, 2019, 08:38:37 AM
Looking mighty fine :)
Title: Re: 3d maze project...
Post by: RemiD on October 21, 2019, 10:58:10 PM
i was a little frustrated with the time it takes to do real time lighting/shading on texels, so i did some experiments with lighting/shading on vertices (again), for a torch light effect, but this time i experimented with a screen mesh (rectangle mesh of the size of the viewport) and a screen texture on which i added a shading of circles from dark to light, and with proper blending, i managed to have this result :
(http://rd-stuff.fr/screenie-spotL+screenM+screenT-torchlight-effect-20191021-2342.png)
(this is supposed to be a torchlight effect)
quite nice for a combination of vertices lighting (dx7 light) + fake lighting (textureblend 2 entityblend 2)

so now, i can either continue with lighting/shading on texels, but i will have to optimize a lot and restrict the structure of the environment, or i can adapt what i have done to work with lighting/shading on vertices, and the environments will be easier to create and faster to light/shade. not sure yet...

what is sure is that the game will be around an ancient egypt theme...
Title: Re: 3d maze project...
Post by: Naughty Alien on October 22, 2019, 05:01:07 AM
..this is very very nice so far..just dont  overcomplicate it..it started nice and simple (im assuming its procedural)..
Title: Re: 3d maze project...
Post by: RemiD on October 24, 2019, 08:56:04 PM
Quote
just dont  overcomplicate it..it started nice and simple
yes good advice to always keep in mind, it is better to finish a simple game with essential graphics / gameplay elements and then make improvements/mods/addons, than to never finish anything because of always wanting to add better graphics / others graphics effects / others gameplay elements / optimizations...


so what i have decided, is to rewrite my todo list from scratch and focus on the essentials : a game in a 3d maze, and replace the lighting/shading on texels by lighting/shading on vertices (simpler, faster)
the gameplay will be simple :
explore the maze to collect treasures
avoid/fight enemies (mumies)
play with lights/shadows and with silence/sounds to remain stealthy or make a diversion
with the possibility to destroy lightsources or to create new ones, and to emitt sounds by throwing things around
and for the way to fight enemies, i am still thinking about it, not sure yet
the graphics will be low tris shapes and diffuse textures, simple graphics style with 1 color per material and 2-3 others colors for fake lighting/shading to add (fake) reliefs, and also nice lighting/shading (vertices colors) on subdivited shapes.


i can do all of this by myself, np, i just have to make some little progress each day !


( then, this gave me an idea for another game, if you want a clue, and you like ancient egypt stuff   youtube.com/watch?v=gnaxCjPdIW8   youtube.com/watch?v=rHDt0bWYxns )
Title: Re: 3d maze project...
Post by: RemiD on October 26, 2019, 11:17:41 PM
these past days, i am (trying to) model/UVmap/color shapes aroound the ancient egypt theme, and for simple shapes like tiles, bricks, slabs, columns, boxes, vases, chests, sarcophagus, autels, it is quite easy and fast.
but to model/UVmap/color a humanoid shape is difficult and time consuming... (especially the UVmapping, to have a approximately uniform texel size, not too distorted/sretched)

i use fragmotion for this, what i do is that i select a group of triangles which can be projected on flat 2d space, and then i unwrap (project) them, then i reposition (on the texture 2d space) some vertices of the projected group so that it has a similar outline than the 3d shape, and also i scale it to keep a (approximately) uniform texel size, then i try to 3dpaint on the 3d shape to check that some texels are not too distorted/stretched (in which case i would reposition some vertices on the texture 2d space)

(http://rd-stuff.fr/screenie-modeling-UVmapping-coloring-LDmummy-20191027-2059.png)

(the texel size is (approximately) 0.01u, humanoid shape is low details : 459vertices and 918triangles)
(i use 3-4 colors for each material : one for main color + others for fake lighting/shading...)
the result is quite primitive and ugly, but with the appropriate lighting/shading and a good ambiance, it may be enough to look convincing. and in any case, i don't want to spend endless hours on that, so i am going to continue like that.
Title: Re: 3d maze project...
Post by: RemiD on October 28, 2019, 10:07:57 PM
today, i have experimented more with 3d drawing : coloring with one color for each material + fake lighting with 1-2 lighter colors + fake shading with 1-2 darker colors
(http://rd-stuff.fr/screenie-experimenting-with-fake-lighting-shading-on-texture-20191028-2244.png)
clearly not recent AAA quality, but i am approaching playstation1 / saturn / nintendo64 / manga quality, and this is good enough for me.

now i need to improve how i draw the lighting/shading on the humanoid shape, corresponding to bones/muscles anatomy... still a lot to learn...

the good thing is that with this approach you don't need many colors to make your texture but there is still some fake reliefs due to the fake lighting / shading using lighter/darker colors.

this model is around 900tris but with nice texture with fake lighting/shading it looks quite good compared to the flat shaded version !
Title: Re: 3d maze project...
Post by: blinkok on October 28, 2019, 10:43:34 PM
That looks very good
I would make the shadows slightly smaller
When they cross over, the shading should be like when they cross over on the face. The one in the middle of the chest looks a bit odd
Maybe add shading to show the contours of the face and body: side of nose, under chin, chest area etc
Title: Re: 3d maze project...
Post by: RemiD on October 28, 2019, 11:01:30 PM
thanks

i know that some "crossings" do not look coherent, this is because i made the mistake to uvmap symetrically ;D so there is the same texture mirrored on each side of the bodypart (except for the face), so now i think that i will have to put horizontal "bandages" to cover these weird diagonal "crossings"
Title: Re: 3d maze project...
Post by: RemiD on November 08, 2019, 08:36:45 PM
in the past days, i have continued to  experiment modeling / unwrapping / uvmapping / 3d painting, more complex shapes like humanoids, and i have to admitt that this is quite difficult and time consuming (for me) to make something that looks good/convincing...

i have asked here and there, to graphists freelancers, to see what are their prices / licenses for a 3d humanoid model made in a certain way (to keep a similar graphics style than my others 3d models) but the answers are always vague and the prices quite high imo (for a vague license (=rights to use, modify, distribute for free or paid))...
some ready to use 3d models are well made (like those of 3DRT imo) but the graphics style does not fit with my graphics style... no easy solution here...


so i have decided to continue to code the procedures / systems for this game, in priority, and work on the graphics only after i make some progress with the codes...

so yesterday and today, i adapted some of my old codes about pathcalculation and pathfollowing using nodes and links (with my own implementation of AStar concepts), and, surprisingly, it works well :
(http://rd-stuff.fr/screenie-nodes-links-calculatepath-followpath-20191108-1925.png)
in medium grey, the nodes and links between nodes
in dark yellow, the start node
in medium yellow, the nodes of the path
in light yellow, the end node

here the nodes are positionned on a grid, but with this nodes+links system, they can be positionned on any arbitrary shapes, and some nodes can be enabled/disabled and some links can be enabled/disabled, at any time (for example if an obstacle is aded/removed, or changes position/orientation, or if a door closes/opens...)

it feels good to make some progress ! 8)
next step : ?
Title: Re: 3d maze project...
Post by: RemiD on November 18, 2019, 07:39:31 PM
still stuck at modeling unwrapping uvmapping 3dpainting the past days, i have tried several approaches to make 3 models in a way that it is easy to unwrap/uvmap/color

( a new woman appeared in my life :-* , which distracted me a lot from this (in a good way) ;D )

but i still plan to work on this until end of march, so...
SimplePortal 2.3.6 © 2008-2014, SimplePortal