MMBasic: Knightmare Game


Author Message
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 08:58pm 09 Dec 2023      

Thank you Tom and Bill

Bill, I'll take a look at the errors on the MMB4W. I will keep the adjustments for the CMM2 to the end of the project. The black boxes are a weird problem because I'm using the screen mode that supports alpha, and pages 0 and 1 will "blend" considering the transparent pixels, what is happening on the MMB4W.

I'm adding power-ups and delta time to the game this weekend. The delta time is to keep the game speed consistent across different platforms. I will try to fix the buffer issues you have reported.

I'm also considering implementing support for gamepads. I need to buy one first. What gamepads do you recommend?

Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1619
Posted: 10:38pm 09 Dec 2023      

I've had no experience with gamepads other than the Wired Classic Controller Pro like this one which is supported by Tom's Lazer Cycle and will plug into the CMM2 front panel. It worked well for me.

Bill

PS. "FITHUB"   I didn't notice that until I read it just now.

Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6832
Posted: 10:57pm 09 Dec 2023      

The wired Classic is supported by the PicoMite too now. :)

Tom's a champion of the NES/SNES controllers too, which are easy to read.

Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1619
Posted: 11:27pm 09 Dec 2023      

  Mixtel90 said  Tom's a champion of the NES/SNES controllers too, which are easy to read.

True: The CMM2 and MMB4W both need an interface for these and others but I don't want to hijack this thread.

Bill

LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 11:43pm 09 Dec 2023      

I found this super cheap one on Amazon, is it work?

https://www.amazon.ca/Nintendo-Controller-kiwitat%C3%A1-Joystick-Raspberry/dp/B01JYGYAX8/ref=sr_1_3?crid=2X4V5DJ5QHJT9
Edited 2023-12-10 09:43 by LeoNicolas

Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1619
Posted: 11:49pm 09 Dec 2023      

Sorry, I had no idea.

Bill

vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1110
Posted: 12:24am 10 Dec 2023      

  LeoNicolas said  I found this super cheap one on Amazon, is it work?

https://www.amazon.ca/Nintendo-Controller-kiwitat%C3%A1-Joystick-Raspberry/dp/B01JYGYAX8/ref=sr_1_3?crid=2X4V5DJ5QHJT9

I'd say no way, those are USB devices.

It needs to have the funky Wii connector, that sort of square thing that fits the circuit board jack.

Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6832
Posted: 08:53am 10 Dec 2023      

Unfortunately, at the moment there is no standard connector shared between the PicoMite boards, the CMM2 and the PC. The closest we get is the keyboard. I'm working on that, with a PicoMite board that will accept the WII Classic and other I2C controllers. There were adapters that will connect the Wii Classic to a PC too (Like this, but out of stock) . There was also the Elecom adapter but that seems to be unavailable now.
Edited 2023-12-10 19:09 by Mixtel90

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 09:26am 10 Dec 2023      

  Quote  The black boxes are a weird problem because I'm using the screen mode that supports alpha, and pages 0 and 1 will "blend" considering the transparent pixels,


Transparent pixels must be RGB(0,0,0,0) and not rgb(BLACK) = rgb(&HFF,0,0,0)
The best way to load a sprite is from a png file. If you view a suitable png file the background will be a grey checkerboard and not black



thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4048
Posted: 12:16pm 10 Dec 2023      

Hi Leo,

I'm worried the state of controllers has not been made completely clear:

1. MMB4W has NO controller support. Hence Bill having started this thread https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=16491#213846. Though, I hope my friend Bill will forgive me, this is the sort of "craziness" that hardware engineers come up with when unsupervised . In theory the OneLoneCoder library that Peter used for MMB4W has functions for (USB?) controller support (or at least it is available as a plugin), but that requires someone with both inclination and time on their hands to upgrade MMB4W.

2. The CMM2 (and now PicoMite) has support for Wii Classic Controllers with the "nunchuck" connector, like this one: https://www.amazon.co.uk/gp/product/B07H9BKG1G

3. The CMM2 and PicoMite cannot use any USB controllers, e.g. those "SNES" ones that you posted a link to, which aren't SNES at all, except cosmetically.

Best wishes,

Tom
Edited 2023-12-11 01:11 by thwill

LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 09:38pm 10 Dec 2023      

  matherp said  
Transparent pixels must be RGB(0,0,0,0) and not rgb(BLACK) = rgb(&HFF,0,0,0)
The best way to load a sprite is from a png file. If you view a suitable png file the background will be a grey checkerboard and not black


Yes, it is what I'm doing. On GIMP I'm exporting the image as PNG 8bpc RGBA.

This is the PNG from the project repo:
https://github.com/leonicolas/knightmare-cmm2/blob/main/tiles/objects.png


Edited 2023-12-11 07:41 by LeoNicolas

JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3820
Posted: 11:37pm 10 Dec 2023      

When I view that it doesn't look to have a checkerboard background.

That's in firefox - is that the wrong way to view?

John
Edited 2023-12-11 09:38 by JohnS

LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 11:59pm 10 Dec 2023      

The browser does not show the pattern, it shows the background under the image. The square pattern is rendered by some softwares to show the image transparent areas. You can download the PNG and open it on Gimp. Gimp uses the square pattern

lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3157
Posted: 12:55am 11 Dec 2023      

Ok, got it:


matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 10:28am 11 Dec 2023      

If you load the complete image as a sprite does that show as expected? How are you breaking up the image into individual sprites?

LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 05:06pm 11 Dec 2023      

  matherp said  If you load the complete image as a sprite does that show as expected? How are you breaking up the image into individual sprites?


I'm doing something wrong for sure

I'm also having artifacts sometimes when I'm hiding and showing sprites. The following image shows an example of when I'm hiding the sprite over the block that shows the block content (the gray block is the background and is overlayed by a sprite showing the question mark or the block content). This problem happens when the shield is over the block, and I'm hiding the block sprite. I will probably need to create a simpler code reproducing the artifacts problem to help you.



These are the steps I'm using for creating sprites:

1) I'm loading the PNGs into different pages when the game starts using:


page write MAP_TILES_BUFFER: load png "MAP_TILESET_IMG"
page write OBJ_TILES_BUFFER: load png "OBJ_TILESET_IMG"
...


Where:


const SCREEN_BUFFER=2                     ' Screen buffer number
const MAP_TILES_BUFFER=3                  ' Map tileset buffer number
const OBJ_TILES_BUFFER=4                  ' Objects tileset buffer number
const BOSSES_TILES_BUFFER=5               ' Bosses tileset buffer number
const GENERAL_USE_BUFFER=6                ' General use buffer number


2) In the main loop, I'm drawing the map tiles in the SCREEN_BUFFER and also scrolling the background

3) I'm spawning new sprites when necessary in the SCREEN_BUFFER using:


sprite read sprite_id%, OBJ_TILE%(obj_id%,0)+offset_x%, OBJ_TILE%(obj_id%,1)+offset_y%, OBJ_TILE%(obj_id%,2), OBJ_TILE%(obj_id%,3), OBJ_TILES_BUFFER
sprite show safe sprite_id%, g_obj(i%,1),g_obj(i%,2), layer%


Where OBJ_TILE contains the coordinates of the image in the PNG to be used by the sprite.

4) I'm moving the sprites using sprite next and sprite move

5) I'm copying the SCREEN_BUFFER page to the page 0 using:


page write 0
blit 0,TILE_SIZEx2, SCREEN_OFFSET,0, SCREEN_WIDTH,SCREEN_HEIGHT, SCREEN_BUFFER
page write SCREEN_BUFFER

Edited 2023-12-12 03:11 by LeoNicolas

LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 06:11am 14 Dec 2023      

  matherp said  If you load the complete image as a sprite does that show as expected? How are you breaking up the image into individual sprites?


Matherp, I have found and fixed the issue that was causing artifacts when collecting the bonus blocks  

I also partially implemented the power-ups. I will release a new version with full power-ups on the weekend.

The following video has a glimpse of the new power-up implementation

https://youtu.be/PCZzFoVUj44

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4271
Posted: 08:30am 14 Dec 2023      

Hi LeoNicolas,

This is looking so good !!! Wauw.

Volhout

LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 04:14pm 14 Dec 2023      

Does anyone have the experience and time to help me migrate VGM audio to MOD?

I can provide the VGM files that can be opened on FamiStudio, which provides the song notes and effects from the two used audio channels. Unfortunately, FamiStudio doesn't support exporting MOD files.

The following image exemplifies the Knightmare stage 1 song in FamiStudio.



Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1117
Posted: 07:02pm 14 Dec 2023      

https://www.thebackshed.com/forum/ViewTopic.php?TID=16416&P=1#212599