Author Topic: GX - A QB64 Game Engine  (Read 7113 times)

0 Members and 1 Guest are viewing this topic.

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
GX - A QB64 Game Engine
« on: December 14, 2021, 01:28:12 pm »
Hi All, I wanted to share a project I've been working on for a bit.  I know there are several folks here with a lot of gaming experience and I would love some feedback.

In the process of working on several 2d game projects I was noticing that I was needing to write a lot of game "plumbing" for each project.  I wanted to see if it would be possible to create a generic game API and engine for QB64 that could support a number of different types of 2D games (platformers, top down, isometric strategy, etc.).  GX is the result of this effort so far.

The goal here is to create a flexible, event-based game engine. Based on your game requirements you can use as much or as little of it as you need, but the engine will take care of the main tasks of managing the game loop and screen buffering for the display.  The current alpha version has support for:
  • Scene (viewport) management
  • Entity (sprite) management
  • Tiled map creation and management - Including a world/map editor (built with Inform)
  • Bitmap font support
  • Basic collision detection
  • Basic physics/gravity
  • Device input management
  • Keyboard, mouse, and game controller
  • Interactive debugging

I've made an effort to document the project here:
https://github.com/boxgaming/gx/wiki

There are several samples included in the project and even a tutorial here:
https://github.com/boxgaming/gx/wiki/Tutorial

You can download the pre-release here:
https://github.com/boxgaming/gx/releases

I'm still in the process of documenting the API, so not all of the calls are there yet, but there is a good start.  I've tried to make the style similar to the QB64 wiki.

Additionally, I'm working on a export to web feature that I will be committing in subsequent updates that will convert a GX-based QB64 game into a canvas-based javascript game that can run in the browser.  It's not quite ready for primetime yet but I've included a screenshot of where I've converted one of the sample projects.

I would appreciate any and all feedback.

- dbox
web-screenshot.png
* web-screenshot.png (Filesize: 519.9 KB, Dimensions: 1385x868, Views: 334)

FellippeHeitor

  • Guest
Re: GX - A QB64 Game Engine
« Reply #1 on: December 14, 2021, 01:41:04 pm »
Whoa! I need to give this a more careful look, but from skimming (and looking at the screenshot): whoa!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #2 on: December 14, 2021, 02:12:49 pm »
Hey dbox - this looks promising and I like how professional the whole thing comes off. Maybe my question will be evident from the documentation - but for the sake of anyone else with this question who is equally as lazy as I -

Where in relaton to my qb64 directory should the GX folder live, once unzipped? Next-to, inside-of, the qb64 directory? I got physics.bas to run (or at least go to run-time without error) but the other demos don't like where the folder lives. Any tips? (I downloaded from Releases.)
You're not done when it works, you're done when it's right.

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #3 on: December 14, 2021, 02:24:03 pm »
Hey @STxAxTIC, it really shouldn't matter where in relation to the QB64 you unzip the gx folder.  However, since each sample has assets that are referenced by relative paths the exe needs to be in the project folder.  Do you by chance not use the option to generate the Exe in the source folder?

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #4 on: December 14, 2021, 02:26:53 pm »
Oh yup, that did it - I didnt check that option, runs brilliantly now.
You're not done when it works, you're done when it's right.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: GX - A QB64 Game Engine
« Reply #5 on: December 14, 2021, 03:56:27 pm »
I am usually not one for game things and I don't really know how to make games myself but I saw the keyword "API". I love API. I will look over your code when I'm feeling better and see what I can do with it.
Shuwatch!

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #6 on: December 15, 2021, 12:11:57 pm »
In addition to just general feedback, if you've had a chance to run the samples I'd love to hear how the performance was for you.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #7 on: December 17, 2021, 02:35:11 am »
I run QB64 with Linux Mint 20.4 and ran your samples. Horse was very smooth with no lag whatsoever. Collision and overworld also performed very well. Although I am not a fan of overworld-type games, I thought the layout, movement and graphics were very nice. The only thing missing was invading aliens and the ability to blow them away... Moo Ha Ha...

Overall: I think you have done a great job and will be looking forward to further updates. Well done!

J
Logic is the beginning of wisdom.

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #8 on: December 20, 2021, 05:34:27 pm »
Hi all!  I just published a new release of GX (0.3.0-alpha) with some fun new content!

This release has the first working version of the export to web feature.  At present it can convert 3 of the sample applications (overworld, horse, and collision) to a working web version (screenshot attached).  If you're interested to see it in action grab the latest release here:

https://github.com/boxgaming/gx/releases

To try it out:
  • Open a command line window and cd to the gx/tools directory.
  • Build the tools with the build.bat or build.sh depending on what OS you are on.
  • Run the gx2web converter (ex: ./gx2web ../samples/overworld/overworld.bas).  The resulting web assets will be placed into an output folder in the dist directory.

You can test out the results by running the included lightweight webserver (thanks @luke !) and opening a new browser window to the output location (ex: http://localhost:8080/dist/overworld/index.html).


I've also added the Christmas-themed platformer game that I submitted for the holiday season code sampler to the samples.  You can also get it standalone here: 

https://www.qb64.org/forum/index.php?topic=4454.msg139230#msg139230
gx2web.png
* gx2web.png (Filesize: 80.62 KB, Dimensions: 1118x729, Views: 216)
« Last Edit: December 21, 2021, 01:25:58 am by dbox »

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #9 on: December 22, 2021, 11:37:21 pm »
Fun GX project update... the export to web feature of GX is now able to port a pretty functioning game that I was able to upload to itch.io:

https://boxgm.itch.io/sleighless

As I shared with the folks that were on Discord earlier, this was converted from QB64 source code (santa.bas) with no manual updates to the resulting html/js!

This code is up on the github repository and will be included in the next release.

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #10 on: December 30, 2021, 06:40:33 pm »
Hi All!  Here's another GX project update.  Had some discussions on Discord around whether the GX QB64-to-JS could be used for vanilla QB64 programs in addition to those that use the game engine API.  So I put together a POC using @FillippeHeitor 's laser tree animation as a test case:

https://qb64forum.alephc.xyz/index.php?topic=4454.msg139043#msg139043

The results are posted up on itch.io:

https://boxgm.itch.io/qb2js

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: GX - A QB64 Game Engine
« Reply #11 on: January 08, 2022, 05:58:36 pm »
Hello All,

There's a new release of GX available.  You can find it here:

https://github.com/boxgaming/gx/releases/tag/v0.4.0-alpha

This release has been focused on updates to the Publish to Web feature that allows you to convert your GX (as well as some vanilla QB64) programs to a web-native version (html/js).  The number of supported keywords has expanded as well as adding support for multi-dimensional arrays.  Thanks to everyone on Discord who has tested the prototypes and given me great suggestions on QB64 sample programs to convert and feedback on the work to date.

You can read more about it the feature here:
https://github.com/boxgaming/gx/wiki/Publish-to-Web
https://github.com/boxgaming/gx/wiki/Supported-Keywords

Another exiting feature included in this release is the web development mode.  Once your game has been converted to the web version you can make tweaks to it and test it out right in the browser (screenshot attached).

Let me know if you get a chance to check it out!
gx2web-02.png
* gx2web-02.png (Filesize: 132.39 KB, Dimensions: 1658x882, Views: 209)