Petaxian

borgar
Posts: 52
Joined: Wed Mar 31, 2021 9:30 am
Location: Oslo

Petaxian

Post by borgar »

This is a small project started to scrach muliple itches
  • Doing something with the Commander X16 emulator (without having to work inside the emulator)
  • Writing something low level without having to write things in assembly (at least for now)
  • Test a new language (Prog8) found on the X16 pages
During the Covid lockdown I saw some good demos using C64 emulator and just PETSCII graphics and then I remebered the old Galaga game on the C64. The one using just character graphics and thought it would be interesting to test how difficult it would be to make something similar.

Petaxian has been written in Prog8 (attaced version of Petaxian was compiled with version 8.10 of the compiler), see
The game is currently in "a mostly finished state". It has a workable game loop, a decent amount of levels (I hope), but is lacking some polish etc. Would be nice with at least some title screen music as well. We'll see if I ever get around to adding something.

I initially wrote this just for the X16 emulator, but over time I've also focused on getting this to run well on the C64. Various
optimization of the code (including writing some function in asm) and some significant improvements in Prog8 now has the C64 running without noticable slowdowns.

Compile/run for Commander X16 with something like this

%JAVA_PATH% -jar prog8compiler-8.10-all.jar -srcdirs cx16 -target cx16 petaxian.p8 %X16EMU_PATH%\x16emu.exe -joy1 SNES -run -prg petaxian.prg

and for C64 with e.g.

%JAVA_PATH% -jar prog8compiler-8.10-all.jar -srcdirs c64 -target c64 petaxian.p8 %VICE_PATH%\x64sc.exe petaxian.prg

If you want to have a look at the code you can find it at https://github.com/cyborgar/Petaxian.
screen_title.png
screen_title.png (9.33 KiB) Viewed 7539 times
screen_title.png
screen_title.png (9.33 KiB) Viewed 7539 times
screen_game.png
screen_game.png (1.5 KiB) Viewed 7539 times
screen_ending.png
screen_ending.png (39.45 KiB) Viewed 7539 times


Try It Now!
Attachments
petaxian.prg
(18.79 KiB) Downloaded 340 times
Last edited by borgar on Fri Nov 03, 2023 8:05 am, edited 3 times in total.
User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Petaxian

Post by desertfish »

-deleted-
Last edited by desertfish on Wed Oct 18, 2023 9:19 pm, edited 1 time in total.
Magique
Posts: 1
Joined: Fri Apr 07, 2023 11:54 pm

Re: Petaxian

Post by Magique »

Great game. A reminder how much you can do with just simple graphics. This is better than a lot of games with much flashier graphics. Great job!
kelli217
Posts: 532
Joined: Sun Jul 05, 2020 11:27 pm

Re: Petaxian

Post by kelli217 »

The difficulty jumps quite a bit from level 2 to level 3. :o
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: Petaxian

Post by voidstar »

Hey this is working great on hardware!

BUT - the gamepad didn't work! I tried both ports 1 and 2. Didn't try 3 and 4 (had them connected for awhile, but disconnected at the moment)

regular snes gamepads, confirmed they are working on the controller tester and in other software titles. So not sure if I'm doing something wrong here?
User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Petaxian

Post by desertfish »

That is odd, a gamepad works fine in the emulator...
Do make sure to press the start/fire button on the controller you intend to play the game with. The game will then use that controller from then on.
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: Petaxian

Post by voidstar »

I tried it again - same, not working.

I'm using a legit Nintendo Super Famicom controller and it is responding fine to the CONTEST.PRG controller tester (and the prior game pad tester from the earlier DevBoard release). Same controller is working in Scumbotron, on h/w

Tried with just gamepad1 inserted. no luck :(
User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Petaxian

Post by desertfish »

This is very weird. I wonder what's going on here. As far as I know petaxian simply uses the kernal's joystick_get reading routine.
DragWx
Posts: 342
Joined: Tue Mar 07, 2023 9:07 pm

Re: Petaxian

Post by DragWx »

I suspect something's going wrong with the way the game chooses which joystick to monitor. It looks like joystick.pull_info() filters something out that joystick.pushing_start() and joystick.pushing_fire() do not, so maybe the keyboard joystick is getting auto-selected and locking out the other joysticks?

If that's indeed the issue, then a simple way to fix this (and to improve the UX as a bonus) would be to re-initialize your joystick class in the wait_key() routine just before the loop. So, each time that prompt comes up, it de-selects the current joystick.

Edit: Thinking about it some more, if a joystick were getting selected accidentally, it'd cause the game to skip past the prompt. My only other thoughts are, if the currently selected joystick value is somehow not being initialized correctly (i.e., it's defaulting to the keyboard and never proceeding to the part where it checks the joysticks), or if the Kernal's joystick scan (not joystick_get but joystick_scan) routine were somehow never getting called even though it's part of the default IRQ.
DragWx
Posts: 342
Joined: Tue Mar 07, 2023 9:07 pm

Re: Petaxian

Post by DragWx »

I may have figured out the problem. The version of the PRG file in this thread is an outdated version that only checks the keyboard joystick and doesn't check the joystick ports. I needed to Try It Now! and break into the monitor to figure that out. :P
Post Reply