Max Gunner: An 8-bit Retro FPS in Blitz3D


Tweet blitz3d rated
(Posted 6 months ago) ned366

Hi All,

I created a retro, Wolfenstein3D-style, game in Blitz3D. You can check in out on Itch.io

Itch.io Page

https://maxgunner.itch.io/max-gunner

Promo Video

Max Gunner: An 8-bit Retro FPS in Blitz3D

(Posted 6 months ago) RonTek commented:

Welcome to the forums ned366!

Thanks for sharing Max Gunner! This looks awesome!!

I would presume that these are all built-in 3D functions with 3D Sprites and not the other way around with raytracing.

btw, I have added one of your screenshots so it will have a thumbnail in the Gallery section.

cheers!

(Posted 6 months ago) ned366 commented:

@RonTek Yeah it renders in 3D. But I am working on a way to fake the retro 2.5D distortion. Good Times.

Graphics3D 800, 600, 0, 2

Const KEY_W = 17
Const KEY_A = 30
Const KEY_S = 31
Const KEY_D = 32

;CAMERA
Global cam = CreateCamera()
CameraViewport cam,0,0,800,600
PositionEntity cam, 0 ,1, 0
CameraZoom cam, 0.25
CameraRange cam, 0.1, 64

;LIGHT
AmbientLight 200,200,200

;PLANE
Global plane = CreatePlane()
PositionEntity plane, 0,0,0
EntityTexture plane, CreateRandTexture(64,64,20,200,50)


;CUBE
Global cube = CreateCube()
PositionEntity cube, 0, 1, 5
EntityTexture cube, CreateRandTexture(64,64,180,70,30)

;SUB-SCREEN BUFFER
Global ScreenImage = CreateImage(200,150)
Global ScreenBuffer = ImageBuffer(ScreenImage)
Global g_StartY = 225


Function CreateRandTexture(Width,Height,Red,Green,Blue)
    Local Texture = CreateTexture(Width,Height,0)
    Local Buffer = TextureBuffer(Texture)
    Local X
    Local Y
    Local RandFactor 
    SetBuffer(Buffer)
    Color(Red,Green,Blue)
    Rect(0,0,Width,Height,1)
    For X = 0 To Width-1
        For Y = 0 To Height-1
            If Rand(0,100) > 5 Then
                RandFactor = Rand(-10,10)
                Color(Red + RandFactor , Green + RandFactor , Blue + RandFactor )
                Plot(X,Y)
            EndIf
        Next
    Next
    SetBuffer(BackBuffer())
    Return Texture
End Function


Function RenderToScreenBuffer()
    Local x
    Local y
    Local dx
    Local dy
    Local argb
    SetBuffer(BackBuffer())
    RenderWorld()
    LockBuffer(BackBuffer())
    LockBuffer(ScreenBuffer)
    For x = 300 To 500
        For y = g_StartY To (g_StartY +150) 
            argb = ReadPixelFast(x,y)
            WritePixel(x-300,y-g_StartY ,argb,ScreenBuffer)
        Next
    Next
    For x = 0 To 199
        For y = 0 To 149
            argb = ReadPixelFast(x,y,ScreenBuffer)
            For dx = 0 To 3 
                For dy = 0 To 3
                    WritePixelFast((x*4)+dx,(y*4)+dy,argb,BackBuffer())
                Next
            Next
        Next
    Next
    UnlockBuffer(ScreenBuffer)
    UnlockBuffer(BackBuffer())
End Function


Function Main()

    Local XMovement#
    Local ZMovement#

    MoveMouse(400,300)
    HidePointer()

    While Not KeyHit(1)

        TurnEntity(cam, 0, -MouseXSpeed()/6.16,0)
        g_StartY = 125 + ((Float(MouseY())/600)*200)
        XMovement = 0.2 * (KeyDown(KEY_D)-KeyDown(KEY_A))
        ZMovement = 0.2 * (KeyDown(KEY_W)-KeyDown(KEY_S))
        MoveEntity(cam, XMovement,0,ZMovement)
        MoveMouse(400,MouseY())
        RenderToScreenBuffer()
        UpdateWorld()
        Color(20,40,120)
        Rect(0,0,800,18)
        Color(255,255,255)
        Text 2, 2, "W,A,S,D, and mouse to move"
        Flip()
    Wend

End Function

Main()
(Posted 6 months ago) RonTek commented:

Awesome I am also quite interested in 2.5D or mode 7 and trying to work on some stuff.

btw, there are some 2.5D techniques posted here, particular in Blitzmax section and will post more when I get a chance.

Reply To Topic (minimum 10 characters)

Please log in to reply