Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: A-Maze Batz  (Read 10693 times)

0 Members and 1 Guest are viewing this topic.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
A-Maze Batz
« on: September 04, 2018, 08:44:20 pm »
A small casual game entry for the Game Maker's Toolkit Game Jam 2018.



Source code (Windows/Linux/Mac): GitHub
Precompiled (Windows): itch.io

You're helping Batz on his way through dark and deep caverns on the look for the one thing that really matters: Batsie. This must be true bat love in some way, although Batsie seems to leave our hero from time to time and he'll have to find her once again.

There's no real end: Once the last level has been beaten, the game will simply restart from the first one. You can even create your own levels and challenge your friends to find Batsie as fast as possible.

You can't really lose the game. There are no lives, there's no timer. Some kind of time attack mode was planned, but I was lacking time so far. In its current form, consider this a prototype and proof of concept.

Controls

The game controls are pretty straight forward:

  • Cursor Keys and W/A/S/D: Steer Batz through the dark caves.
  • Space: Use Batz's sonar to identify caverns, tunnels, and openings. Batsie will also answer your call, if she can hear you.

Compiling the Game from Source

If you're not running Windows, but still want to try the game (or you don't trust Windows executables  from strangers), you can download the full source code for the game  from GitHub and build it yourself. You'll need a working environment to compile and link C/C++ programs for this, including CMake and SFML.

This project originated in a game jam weekend in a total of less than 24 hours. This code isn't clean and it's clearly not built around best practices and optimization only. If you're curious, have a look, but always keep this in mind.

Modding and Level Editing

The game's levels are stored in a very simple and easy to edit way. Open the sub directory `assets/levels`, where you'll find one PNG image per level.

You can edit existing levels or create new ones, simply creating a new file following the existing numbering pattern. If the last level is `level5.png`, save your own level as `level6.png` to extend the game. There's no need to recompile or rebuild the game in order to test new levels.

There are a few tiny things to keep in mind here:

Your PNG file has to be saved as an 24-bit or 32-bit color PNG image. 8-bit PNGs are not supported.
Fully black parts (RGB: 0/0/0) are considered solid. You don't have to fill shapes. Even 1 pixel thin lines should count, although sonar pings might pass through thin diagonal lines.
Make sure that tunnels and choke points are at least 10-12 pixels wide.
Green pixels (RGB: 0/255/0) are potential starting positions. If there's more than one position available, the actual starting position will be picked at random.
Red pixels (RGB: 255/0/0) are potential goal positions, i.e. where Batsie may be found.
Blue pixels (RGB: 0/0/255) create random water drops that will be visible.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: A-Maze Batz
« Reply #1 on: September 05, 2018, 12:15:35 am »
I checked it out. It's a bit short... I like the png levels idea though. Doing this that way is convenient for people to edit them or even share them via image sharing websites.

Quote
or you don't trust Windows executables  from strangers
I hope I don't have a virus now. :P

Did some hearing based indie game inspire you (there are a few I know of but don't remember any names now)?

Now I'm checking out the code (more like wading thru Game::run, everything is in just that) to see how it's all done.

You could have used https://en.cppreference.com/w/cpp/error/runtime_error not your own Exception too.

I also see you const cast and set smooth false on Font's Texture, maybe it should be in the API (or maybe I missed why it's not or where it is).
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: A-Maze Batz
« Reply #2 on: September 05, 2018, 12:42:19 am »
I checked it out. It's a bit short...
Yep, but also worked like maybe 12 hours on it or so. And in the end I didn't really have the motivation for tons of levels, esp. risking the submission deadline just for that. ;)

Quote
or you don't trust Windows executables  from strangers
I hope I don't have a virus now. :P
Nope, but some malware distributor would say the same. :D

Did some hearing based indie game inspire you (there are a few I know of but don't remember any names now)?
Not really. I thought it would be neat to listen to actual accurate echoes, but that would have required far more time than available.

You could have used https://en.cppreference.com/w/cpp/error/runtime_error not your own Exception too.
Hm, yep.

I also see you const cast and set smooth false on Font's Texture, maybe it should be in the API (or maybe I missed why it's not or where it is).
It's been discussed somewhere, I just don't remember where it was.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: A-Maze Batz
« Reply #3 on: September 05, 2018, 01:42:58 am »
It just made me go a bit ??? ??? when there were only 4 levels since they are so easy to make and on level 2 or 3 I got (un)lucky spawn right next to the other bat.
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: A-Maze Batz
« Reply #4 on: September 06, 2018, 10:26:24 am »
Yeah, it's certainly not a complete game (yet), but I felt like it wouldn't be good to just throw in some more levels which would be almost identical either. Right now thinking about expanding it with more obstacles (enemies, waterfalls, or similar) and potentially some kind of built-in edtior with a chance for a mobile port.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: A-Maze Batz
« Reply #5 on: September 06, 2018, 08:45:49 pm »
For random levels you could (maybe) use https://nothings.org/gamedev/herringbone/ if you wanted.
Back to C++ gamedev with SFML in May 2023

achpile

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • Achpile's homepage
    • Email
Re: A-Maze Batz
« Reply #6 on: September 07, 2018, 06:35:59 pm »
Oh wow, that looks very nice!

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: A-Maze Batz
« Reply #7 on: September 09, 2018, 03:24:23 pm »
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: A-Maze Batz
« Reply #8 on: September 10, 2018, 10:11:56 am »
I just realized that Fullscreen flag shouldn't be or'd with any other flag.

https://github.com/SFML/SFML/blob/master/include/SFML/Window/WindowStyle.hpp#L44

https://github.com/MarioLiebisch/a-maze-batz/blob/master/source/game.cpp#L103
Who reads documentation? :D But seriously: Never noticed SFML receiving Alt+F4 without "sf::Style::Closed", which is rather interesting, because I don't think other GUI frameworks (like Windows Forms) work like that. Just from memory right now though.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: A-Maze Batz
« Reply #9 on: September 10, 2018, 10:21:51 am »
It does work with Alt F4 on Windows for me with just Fullscreen flag.
Back to C++ gamedev with SFML in May 2023