An attempt to create a first person adventure game engine

Game development specific discussions.
BasicCoder2
Posts: 3738
Joined: Jan 01, 2009 7:03
Location: Australia

Re: An attempt to create a first person adventure game engine

Postby BasicCoder2 » Feb 08, 2021 19:31

Possible actions to take need to be displayed not just the arrow key commands.
Even a key that pops up a help menu would be useful that lists the commands you can type in like "look around", "pick up key" or "open door" at least until or if you write a routine to translate sentences into commands by looking for key words.
The more intuitive the user input the more enjoyable it would be to play.
Last edited by BasicCoder2 on Feb 09, 2021 7:33, edited 1 time in total.
ron77
Posts: 194
Joined: Feb 21, 2019 19:24
Location: Israel
Contact:

Re: An attempt to create a first person adventure game engine

Postby ron77 » Feb 09, 2021 7:29

hello everyone...

here is a link to the project repo on github: https://github.com/ronblue/fb_adventure_game

ron77
angros47
Posts: 1872
Joined: Jun 21, 2005 19:04

Re: An attempt to create a first person adventure game engine

Postby angros47 » Feb 09, 2021 18:13

That kind of graphic style reminds me of the "Deep Sleep" saga, for some reason.

Thinking of that, I decided to make this simple graphic effect to simulate a flashlight in a dark room:

Code: Select all

screenres 800, 600, 32, 2
screenset 1,0

dim room as any ptr


room=imagecreate(800,600)
bload "05-4.bmp",room


'Generates an alpha mask

dim alphachannel as any ptr=imagecreate (200,200,0)
for x as integer=-100 to 100
   for y as integer=-100 to 100
      pset alphachannel,(x+100,y+100), rgba(0,0,0,(x*x+y*y)/79)
   next
next


dim as integer x,y
do until multikey(1)
   getmouse x,y
   dim as integer x1=iif(x<100,0,x-100)
   dim as integer y1=iif(y<100,0,y-100)
   dim as integer x2=x+99
   dim as integer y2=y+99
   cls
   put (x1,y1), room, (x1,y1)-(x2,y2),pset
   put (x1,y1), alphachannel, alpha
   flip
   sleep 1
loop


Try it. If you want to use it in your adventure, feel free to do it.
ron77
Posts: 194
Joined: Feb 21, 2019 19:24
Location: Israel
Contact:

Re: An attempt to create a first person adventure game engine

Postby ron77 » Feb 09, 2021 18:46

thanks @angros47

:)
mrToad
Posts: 429
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: An attempt to create a first person adventure game engine

Postby mrToad » Feb 10, 2021 3:28

Hi ron77, I didn't imagine you would put such an old project to such good use! I'm glad you're working with it so diligently. Nice job so far. :)

I held back from giving ron77 the game engine code I had already written. The reason, it's from 2014 or earlier, needed a lot of revision, besides that I didn't write it very well, not enough to recommend as an example to learn from. Since he admitted limited ability in coding, starting fresh is better than revising old code. It's already proving to be a great learning experience for him.

Still, I have the general idea of how the engine should work, and some of the code is good. If I can later, I will help by posting some code, or useful coding ideas.

My graphics are rough! The first thing they need is better colors. All the images are too dark. And I would personally add more detail to the art. But, better to save polishing for later, and just focus on the engine for now.

The music and sound effects were composed / recorded by me, but as I mentioned, you are free to use all of this in any way you want. It's your project now. If you want to give me a mention of credit somewhere, that's great, but I'm happy to let it go to someone who can make use of it, or at the very least learn from working on it.
Last edited by mrToad on Feb 10, 2021 16:13, edited 1 time in total.
BasicCoder2
Posts: 3738
Joined: Jan 01, 2009 7:03
Location: Australia

Re: An attempt to create a first person adventure game engine

Postby BasicCoder2 » Feb 10, 2021 5:43

Tried to figure out the layout.
Image
ron77
Posts: 194
Joined: Feb 21, 2019 19:24
Location: Israel
Contact:

Re: An attempt to create a first person adventure game engine

Postby ron77 » Feb 10, 2021 10:42

hello @mrToad and @BasicCoder2... thank you so much for your help and contribution to the project...

indeed all art graphics and sound are by mrToad and all the credit goes to him for without him and his beautiful graphics and sound / music files this game engine would not be as lovely as it is now...

and i thank also BasicCoder2 and @MrSwiss and @Sero for the help they given me with the code on this project... after all said and done i'v learned a lot from the experience...

ron77 :)
mrToad
Posts: 429
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: An attempt to create a first person adventure game engine

Postby mrToad » Feb 10, 2021 17:48

Hi ron77, thanks for the mention, but I didn't mean credit on the forum. :) I mean only a small mention of credit within the finished game.

I found a development picture that shows this project actually started in 2008 lol. I was using cardboard boxes to try to help imagine a perspective for the game scenes.

Image

@BasicCoder2, wow that's just about correct, as far as I can understand my original plan anyway. I think it's surprising you took the time to figure that out... nice job :) It is quite confusing with the images just being numbers. I'll post a little of the code that corresponds to those numbers. (Beware of Integers, when you save/load your map to file it will be different data sizes between 32 and 64bit OS.)

Code: Select all

#Define north 1
#Define east 2
#Define south 3
#Define west 4

Type map_attr         '' Old stuff: Integers, don't use. :)
    As Integer open_n      '' NSEW directions open for movement?
    As Integer open_e
    As Integer open_s
    As Integer open_w
    As Integer img_n      '' Image IDs corresponding to filenames.
    As Integer img_e      '' Each map location has 4 images of course.
    As Integer img_s
    As Integer img_w
    As Integer floor      '' Floor type, used for walking sounds (grass, wood, etc)
End Type

Type pc_attr
    As Integer x, y, z      '' Player x/y position on map, and z = level/story of map.
    As Integer d         '' Direction player is facing, and used to load correct scene image of course.
End Type

Dim Shared map(1 To 10, 1 To 10, -2 To 2) As map_attr   '' 10 x 10 map with 5 levels... rather strange map idea I had.
Dim Shared pc As pc_attr


'' Later on, something like this:
Sub pc_move(d As Integer)

    Dim As Integer flag_nocango = false
    Dim As Integer gox, goy

    If d = north Then
        If map(pc.x,pc.y,pc.z).open_n = true Then
            goy = -1
        Else
            flag_nocango = true
        End If           
    ElseIf d = east Then
        If map(pc.x,pc.y,pc.z).open_e = true Then
            gox = 1
        Else
            flag_nocango = true
        End If
    ElseIf d = south Then
        If map(pc.x,pc.y,pc.z).open_s = true Then
            goy = 1
        Else
            flag_nocango = true
        End If
    ElseIf d = west Then
        If map(pc.x,pc.y,pc.z).open_w = true Then
            gox = -1
        Else
            flag_nocango = true
        End If
    End If
   
    If flag_nocango Then
        Locate 9,30: Print "Can't go that way."
    Else
        Randomize Timer
        sfxRND = (Rnd * 2) + 1
        If map(pc.x,pc.y,pc.z).floor = 0 Then        '' Old sound functions that don't work now.
            If sfxRND = 1 Then sfxPlay sfx_step_1
            If sfxRND = 2 Then sfxPlay sfx_step_2
            If sfxRND = 3 Then sfxPlay sfx_step_3
        ElseIf map(pc.x,pc.y,pc.z).floor = 1 Then
            If sfxRND = 1 Then sfxPlay sfx_step_brush_1
            If sfxRND = 2 Then sfxPlay sfx_step_brush_2
            If sfxRND = 3 Then sfxPlay sfx_step_brush_3
        End If
        pc.x += gox
        pc.y += goy
        load_view (format(pc.x,"0#") & "_" & format(pc.y,"0#") & "_" & pc.d & ".png")
        refresh
    End If
End Sub
That's the only parts of code that have any value I guess... It's all pretty ugly, but maybe it can spawn some idea for you :)
Last edited by mrToad on Feb 10, 2021 18:50, edited 1 time in total.
BasicCoder2
Posts: 3738
Joined: Jan 01, 2009 7:03
Location: Australia

Re: An attempt to create a first person adventure game engine

Postby BasicCoder2 » Feb 10, 2021 18:03

@mrToad
Using cardboard boxes to try to help imagine a perspective for the game scenes was a clever idea :)
The work involved in drawing all those images is enormous and a sticking point for expanding such retro methods by giving such a game a graphics output vs just text compared with say raycasting or better still using a 3d game engine.

Return to “Game Dev”

Who is online

Users browsing this forum: No registered users and 1 guest