Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: THE WAREHOUSE - thinBASIC game project

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Cool THE WAREHOUSE - thinBASIC game project

    I have an idea for a game project - THE WAREHOUSE.

    You as a player wake up in a mysterious warehouse and you need to find a way out.

    Goals of the project
    1/ Create a fun little game I would like to publish once finished as binary for free on itch.io
    - this should allow us to promote thinBASIC a bit

    2/ Explore more in depth what it takes to have game with multiple possible inputs
    - how to ballance gameplay to be fun with both keyboard and mouse or XBox controller

    3/ Identify spaces for improvement in TBGL, other modules and maybe even in the core language itself
    - I expect to run into issues here and take it as a journey to discover what could we enhance

    4/ Try to share more the whole process as I think with my GitHub adventures I completely escaped the community in the last years
    - while I consider GitHub to be the goto solution for development, forum is simply more fun

    You will always find the latest version and change log in this first post.

    Please note the first post will never contain spoilers for the game, but further posts down the thread will have big spoiler potentail.
    If you want to just enjoy the game, stick to this post, if you want to learn a bit along the way, please do not hesitate to follow the development.

    Status of the project
    In development, there is nothing to really play yet, but you are welcome to try current versions

    Change log
    Version 0.1 - Provides title screen to "game" transition. You can try to walk with XBox controller or Mouse and Keyboard in a huge empty environment
    Version 0.2 - Populates warehouse with crates and allows jumping around


    Petr
    Attached Files Attached Files
    Last edited by Petr Schreiber; 29-07-2024 at 16:59.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Version 0.1 - technical breakdown

    Version 0.1 is very basic, and not entertaining yet, but features few core elements.

    Title screen
    The game starts with title screen, which seems basic, but implements the mechanics mentioned further - displaying key descriptions from controller config (not just hardwired values into string prompt).

    Note that the displayed character for A button on XBOX controller is custom, and part of the font in the area which would be otherwise not used. So I "steal" characters with ASCII codes 252 - 255 for XBox buttons.

    The animation is done in rudimental way of randomly picked camera angles, which are interpolated in linear way.

    The whole aesthetic of the game will be closer to 2000's titles, riding on the retrowave which I enjoy a lot in games currently.

    State transition mechanics
    I would like to offer a regular structure to the game, that is some title screen, main menu, game itself and maybe some other states.

    To achieve this, there is a concept of State, which has always the same interface:
    - Initialize
    - DrawFrame
    - ProcessInput
    - Deinitialize

    All these functions take always as input StateContext, which allows to pin custom data for each state and process input in generic way.

    Standard interface allows standard handling - so no crazy "IFs" for menu, game, ... everything handled in the same way and structure.

    Control bindings
    I try to play with unified interface allowing controls via keyboard, mouse and XBox controller for now.

    It is an interesting exercise in understanding how XBox controller works on low level, and how to make the code easy to read on the high level.

    For now the control keys are hardwired in controller.tbasicu, but already stored in a structure which will in time allow hopefully a proper user control binding.


    Petr
    Last edited by Petr Schreiber; 13-07-2024 at 12:44.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111
    Good Idea with this Game petr

    I am using only Keyboard Keys to move in 3d Scene a,s,d,w. Mouse coordinates would be good how to know where your Position is.

    And perhaps a primitive Objekt AS reference. In Center If Scene or a XYZ Axis Line Cross. I have No more Idea If tbgl entities.. sorry.. I have only for me included a simple Pyramide for Testing ..

    Good luck and have fun with this Game, Bye Frank
    Attached Images Attached Images
    Last edited by Lionheart008; 14-07-2024 at 04:27.
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  4. #4
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111
    Good sunday afternoon petr, in

    Perhaps you can Insert a voxel in your Warehouse they shouldnt get out of the grid borderline..

    And Keyboard movements you can add to Up down left right arrows with more Speed

    And Draw perhaps some wals für a Labyrinth..

    I am No more familiär with tbgl entity Setup.. sorry but send you Here a little example for this voxel you must only Adept in your warehouse.tbasic

      '=============================================================================
      '=                            TBGL Sample Script                             =
      '=                               Moving in 3D                                =
      '=                                                                           =
      '=                           Petr Schreiber, 2007                            =
      '=============================================================================
    
      '---Load needed modules
      Uses "TBGL"
      uses "MATH" ' DegToRad Function
    
      #INCLUDE "%APP_INCLUDEPATH%\thinbasic_gl.inc"   ' glColor3f
      
      Dim hWnd As Dword
      
      '---Creates OpenGL window and returns handle
      hWnd = TBGL_CreateWindowex("Moving in 3D, entity optimized - press ESC to quit", 640, 480, 32, %TBGL_WS_WINDOWED )
      '---Shows TBGL window
      TBGL_ShowWindow
    
      ' -- First we will create world as place to contain entities
      %MY_WORLD = 1
      tbgl_SceneCreate(%MY_WORLD) 
      
      ' -- Our world will have two entities 
      %ENT_CAMERA   = 1
      %ENT_GRIDLIST_1 = 2
      %ENT_GRIDLIST_2 = 3
      %ENT_GRIDLIST_3 = 4
      %ENT_GRIDLIST_4 = 5
      
      ' .. Camera
      tbgl_EntityCreateCamera( %MY_WORLD, %ENT_CAMERA)
      tbgl_EntitySetPos      ( %MY_WORLD, %ENT_CAMERA, 0.0, 0.1, 0.0 )
      
      ' .. Grid below
      tbgl_EntityCreateDLSlot( %MY_WORLD, %ENT_GRIDLIST_1, 0, CreateGridAsDList(1, -2, 20) )
      ' .. Grid above
      tbgl_EntityCreateDLSlot( %MY_WORLD, %ENT_GRIDLIST_2, 0, CreateGridAsDList(2, 2, 20) )
    
      ' .. Grid below ' 90 degrees
      tbgl_EntityCreateDLSlot( %MY_WORLD, %ENT_GRIDLIST_3, 0, CreateGridAsDList2(3, -2, 20) )
      ' .. Grid above '90 degrees
      tbgl_EntityCreateDLSlot( %MY_WORLD, %ENT_GRIDLIST_4, 0, CreateGridAsDList2(4, 2, 20) )
    
    ' Declare Variables here
      dim w as single
      dim x, y, z as integer
      dim scene, cubeSize as integer
      dim distance as single
      dim angle(2) as single
    
      ' Initialize Variables here
      distance = 80
      cubeSize = 20
    
      'Create Lists here
      %CUBE = 1
      %SCENE = 2
    
      tbgl_newlist %CUBE
        buildCube()
      tbgl_endlist
    
      tbgl_newlist %SCENE
        createScene()
      tbgl_endlist
    
    
      dim FrameRate as double
      dim Sheeps as long
      
      '---Resets key status before checking
      TBGL_ResetKeyState()
    
      '---Main script loop
      WHILE TBGL_IsWindow(hWnd)
    
        tbgl_translate 0.0, 0.0, -distance
        tbgl_rotate angle(1), 1.0, 0.0, 0.0
        tbgl_rotate angle(2), 0.0, 1.0, 0.0
        
        tbgl_CallList %SCENE
        keyboardControl()
        
          
        '---Script will run on different PCs so we must assure
        '---constant speed of movement by scaling movements relative to frame rate
        FrameRate = TBGL_getFrameRate
        
        '---Prepares clear frame
        TBGL_ClearFrame
    
          tbgl_SceneRender(%MY_WORLD)
    
        TBGL_DrawFrame                    ' Swaps the buffers - displays rendered image
    
        if TBGL_GetwindowKeyState( hWnd, %VK_UP)     then tbgl_EntityPush(%MY_WORLD, %ENT_CAMERA, 0, 0,  5/FrameRate)     ' 5 meters/second
        if TBGL_GetwindowKeyState( hWnd, %VK_DOWN)   then tbgl_EntityPush(%MY_WORLD, %ENT_CAMERA, 0, 0, -5/FrameRate)
    
        if TBGL_GetwindowKeyState( hWnd, %VK_PGUP)   then tbgl_EntityPush(%MY_WORLD, %ENT_CAMERA, 0,  5/FrameRate, 0 )
        if TBGL_GetwindowKeyState( hWnd, %VK_PGDN)   then tbgl_EntityPush(%MY_WORLD, %ENT_CAMERA, 0, -5/FrameRate, 0 )
    
        if TBGL_GetwindowKeyState( hWnd, %VK_LEFT)   then tbgl_EntityTurn(%MY_WORLD, %ENT_CAMERA, 0,  60/FrameRate, 0)
        if TBGL_GetwindowKeyState( hWnd, %VK_RIGHT)  then tbgl_EntityTurn(%MY_WORLD, %ENT_CAMERA, 0, -60/FrameRate, 0)    ' 60°/second
    
        if TBGL_GetwindowKeyState( hWnd, %VK_ESCAPE) then EXIT WHILE
        doevents
        
      WEND
    
      '---Closes OpenGL window
      TBGL_DestroyWindow
    
    function buildCube() as long
        TBGL_Box 1,1,1    
      end function
    
      function createScene() as long
    
        for z = -cubeSize to cubeSize
          for y = -cubeSize to cubeSize
            for x = -cubeSize to cubeSize
              
              w = sqr(x*x + y*y + z*z)
              
              if w < 20 and w > 18.75 then
                tbgl_pushmatrix
                  tbgl_translate x, y, z
                  glcolor3f cos(degtorad(x*7)), cos(degtorad(y*7)), cos(degtorad(z*7))
                  tbgl_CallList %CUBE
                tbgl_popmatrix
              endif
              
            next
          next
        next
        
      end function
    
    
    '-------------- GRID PLANES ------------------- //
      function CreateGridAsDList(optional lList as long, lPos as long, lSize as long) as long  ' Returns to which display list we save
        local i, j as long
        local lList1 as long
        
        if lList = 0 then lList = 1
        tbgl_NewList lList
          '---Let's build a grid
          tbgl_Rotate 90,0,0,1
          TBGL_BeginPoly %GL_LINES          ' Starts polygon definition based on 2 vertex lines
            TBGL_Color 0,255,0              ' Defines color
    
            For i = -lSize To lSize
              For j = -lSize To lSize
                TBGL_Vertex -lSize, lPos,   j     ' Adds vertex
                TBGL_Vertex  lSize, lPos,   j     ' Adds vertex
    
                TBGL_Vertex  i,  lPos, -lSize     ' Adds vertex
                TBGL_Vertex  i,  lPos,  lSize     ' Adds vertex
    
              Next
            Next
        
        TBGL_EndPoly   
        tbgl_EndList 
        
        function = lList
      end sub
      
      function CreateGridAsDList2(optional lList1 as long, lPos as long, lSize as long) as long  ' Returns to which display list we save
        local i, j as long
        'local lList1 as long
        
        if lList1 = 0 then lList1 = 1
        tbgl_NewList lList1
           
           tbgl_Rotate 0,0,0,1 
            TBGL_BeginPoly %GL_LINES          ' Starts polygon definition based on 2 vertex lines
            TBGL_Color 0,255,0              ' Defines color
    
            For i = -lSize To lSize
              For j = -lSize To lSize
                TBGL_Vertex -lSize, lPos,   j     ' Adds vertex
                TBGL_Vertex  lSize, lPos,   j     ' Adds vertex
    
                TBGL_Vertex  i,  lPos, -lSize     ' Adds vertex'
                TBGL_Vertex  i,  lPos,  lSize     ' Adds vertex
    
              Next
            Next
     
          TBGL_EndPoly   
        tbgl_EndList 
        
        function = lList1
      end sub
      
    function keyboardControl() as long
    
        if tbgl_getWindowkeystate( hWnd, %VK_RIGHT) then angle(2) += 1
        if tbgl_getWindowkeystate( hWnd, %VK_LEFT) then angle(2) -= 1
        if tbgl_getWindowkeystate( hWnd, %VK_UP) then angle(1) -= 1
        if tbgl_getWindowkeystate( hWnd, %VK_DOWN) then angle(1) += 1
        
        if tbgl_getWindowkeystate( hWnd, %VK_PGDN) then distance += 1
        if tbgl_getWindowkeystate( hWnd, %VK_PGUP) then distance -= 1
    
      end function
    
    Attached Images Attached Images
    Last edited by Lionheart008; 14-07-2024 at 15:50.
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Thank you, Frank! Nice to see your pyramid warehouse mod

    I am now thinking about the warehouse visuals and then I will start to populate it with crates.

    Crates will be a core gameplay element. Each crate will contain nothing or special "powerup" and will be destroyable.

    I am now working on this part, will share once I have next step or its part ready


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Cool Version 0.2 - populating the warehouse

    I would like to share updated version.

    Populated warehouse
    The warehouse is now populated by columns of crates of the same type.

    The algorithm basically generates columns of different sizes on fixed grid.

    Collision detection
    There is a rudimentary collision detection implemented for the boxes, so you should not be able to walk into one and you should be able to hop on the boxes.

    Few quirks and bugs still there, some reminiscent of Tomb Raider corner bug

    Jumping
    SPACE / A key on XBox controller now allow framerate invariant jumping.


    I hope you will have fun exploring the warehouse
    Attached Files Attached Files
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10
    Petr, I'm astonished about the quality and organization of the source code
    Really something to have a look by any thinBasic developer, me first.

    And also a great example to be used to improve thinAir capability to scan source code and included files.


    I've tested with a cabled XBOX Controller and is working just fine.

    To have more fun ...
    I've increased some parameter in order to have more speed, I like it quicker.
    Also changes some data to have bigger and higher map

    Really great potential for a nice 3D platform game or other kind of scripts.

    Thanks a lot for this present.
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  8. #8
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348
    Hi Petr,

    on the title screen I get a framerate between 200 and 300. Difficult to say. After pressing ENTER, it drops to 40-45, sometimes 30.

    This is on a Radeon 4800U integrated GFX chip with 8 GB assigned to it.

  9. #9
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Dear Eros,

    thank you very much!

    Can you share the altered parameters? I did not optimize them in any way yet...

    Dear Mike,

    great to see you here! And for the helpful feedback, I will try to replicate during weekend. Thanks!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  10. #10
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348
    Hi Petr,

    ya since I have more time on my hands and was looking for a different dev environment, I wanted to see how TB and you guys are doing.
    Was looking at some of your Bonus examples for TBGL and forgot that you can uses shaders. Awesome!

    Combined with the speed of Oxygen, you can create some impressive apps with TB. If my bundle bug is solved, I could see using it more often.
    Adding to that, Windows Defender doesn't complain about bundles I create. Not sure how Virus Scanners would act on them these days as I don't use one.

    Take care
    Michael

Page 1 of 2 12 LastLast

Similar Threads

  1. poll for a game with common work project
    By Lionheart008 in forum Polls
    Replies: 11
    Last Post: 24-04-2012, 09:49
  2. Warehouse 3D: sources
    By Simone in forum Project: 3D Warehouse
    Replies: 2
    Last Post: 28-01-2009, 10:03
  3. Warehouse 3d: new project forum
    By ErosOlmi in forum Project: 3D Warehouse
    Replies: 0
    Last Post: 27-01-2009, 18:39
  4. critics :) thinStudio game project
    By Lionheart008 in forum Media
    Replies: 8
    Last Post: 22-10-2008, 23:44
  5. Warehouse 3D: project description
    By ErosOlmi in forum Project: 3D Warehouse
    Replies: 7
    Last Post: 11-10-2008, 00:06

Members who have read this thread: 13

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •