Log In  

Cart #mot_wolf3d-3 | 2021-01-29 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
30

This isn't really a game - unless you consider it a short "Walking simulator" - it's more of a tech demo.

The engine is a basic Wolfenstein-3D like 3D engine. It has floor and ceiling textures and render reasonably sized and complex rooms at 60 frames-per-second, in a 128x96 viewport.

  • Arrow keys = move
  • X = toggle map mode

If anyone feels like something out of it, it's fairly easy to get started with (details below).


Levels are built using the map editor, using the sprites on page 1.

The bottom left sprites are walls, except the left-most one which positions a door.
The next row up is for placing objects.
The numbered circles are for placing triggers that trigger code when the player reaches them.
The gray arrows at the top are for setting the player start position and direction.

You can use the top left 124x32 tiles of the map area.

Wall textures (and door texture) are sprite tabs 2 and 3.

You can define up to 8 (including the door).

Objects are sprite tab 4.

They are always 16x16 pixels. You can define up to 16.

Objects must be defined in the "otyp" array (code tab 1):

otyp={
-- y    h   w  solid flat
 { .33,.4, .5, true},
 {-.36,.25,.25,false},
 {   0, 1, .3, true},
 { .5,.45, .7, false,true},
 {.375,.5, .7, true},
 { -.3,.4, .3, false},
 { .3,.35, .4, true},
 { .5,.45, .8, false,true},
 { .1, .8, .4, true},
 { .2, .6, .6, true}    
}
  • y = y position (-0.5 = ceiling, 0.5 = floor)
  • h = height
  • w = width
  • solid = true if object will obstruct player's movement
  • flat = true to flatten object to floor/ceiling

Floor and ceiling textures are defined at the very right of the map.

Floor and ceiling "plane types" must also be defined in code tab 1:

-- plane types
--       tex  scale height xvel yvel
pl_tile ={ 0, 0.5   }
pl_panel={ 1, 0.5   }
pl_dirt ={ 2, 0.125 }
pl_stone={ 3, 0.25  }
pl_sky  ={ 4, 7,    10,    .007,.003}
  • tex = Which "texture" to use. 0 = topmost.
  • scale = Texture scale factor.
  • height = Optional. Set the plane height, e.g. for sky textures. Otherwise defaults to floor/ceiling height.
  • xvel,yvel = Optional. Creates moving planes.

You then select the floor and ceiling planes by setting the "floor" and "roof" variables.

floor={ typ=pl_dirt,  x=0,y=0 }
roof ={ typ=pl_sky,   x=0,y=0 }

P#86903 2021-01-29 07:19 ( Edited 2021-01-29 23:26)

impressed by rasterization precision 👍 - I know some wall rendering code that might need a pixel clean up 😜

minor perf comment:

local i=x-flr(x)
-- can be replaced by :
local i=x%1 -- 2x faster
P#86905 2021-01-29 07:37 ( Edited 2021-01-29 07:50)
:: Mot

@freds72 thanks. %1 feels obvious now you've mentioned it :-), much cleaner.

Regarding the walls, I think sspr just truncates the y and height params before using them. Which means the bottom pixel can jump up and down a bit as they cross integer boundaries.
Calculating the top and bottom, explicitly truncating/rounding them, then subtracting to get the height keeps it a lot more stable.

P#86909 2021-01-29 08:28

distance based dimming of colors would also sell the 3d world better.

P#86911 2021-01-29 08:52
:: Mot

Might have a play with it.
It depends how expensive the pal(table, 0) command is.

P#86913 2021-01-29 10:49
:: Mot

I tried adding some black fog.

P#86916 2021-01-29 12:24

ah yes - need a richer ground texture.
Otherwise you got this strong cut off :/

P#86917 2021-01-29 13:12

I'm just sitting here reading your comments and I'm just very confused. (I dunno anything about making a Pico 8 game.)

P#86931 2021-01-29 16:13

Same here @jerry, I just think its neat, reminds me of poom

P#86940 2021-01-29 18:34
:: Mot
1

Making a decent looking noisy ground texture is a bit beyond my pixel art capabilities unfortunately.
I've changed it to exponential fog with a better palette sequence.

At least the hard edge is a bit further away (?)

P#86952 2021-01-29 23:33

seems to work ok

P#86958 2021-01-30 06:12

I love the map. To me this is like Castle Wolfenstein with a 3D view.

P#87323 2021-02-07 03:55 ( Edited 2021-02-07 03:57)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-05-03 21:24:09 | 0.025s | Q:32