Jigsaw Puzzle

All about games on the Falcon, TT & clones

Moderators: Mug UK, [ProToS], lp, moondog/.tSCc., Moderator Team

Post Reply
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Jigsaw Puzzle

Post by mjvans »

Hi all.
Here I present a homebrew Jigsaw puzzle game for the Falcon030.
Warning: Falcon030 640x480 256 colours only! There is yet no warning for wrong system or video mode.
The game is written in GFA basic 3.6
I wrote most of the game in 1995 but never got it to a working game in the last century. Also it was in 16 colours because I could not get GFA in 256 colour mode. Adding sound was another problem for me in 1995.
Now during lockdown time I got the idea of picking up where it was left.

This version works on my original Falcon030 14MB under TOS.
It creates puzzle sprites from a picture.
There is no score yet, the Falcon does not know the puzzle is finished.
There is only one puzzle in this first "demo".

Todo:
- replace intro music, it is not a loop (can someone help me with that?)
- choose your puzzle screen
- score
- success music (anyone?)
- error messages, warnings
- compress files if possible

I would be very grateful if you test it on your Falcon.
Remember to swith the desktop to 640x480x256
Any suggestions welcome.

It should look like this:

Image

Image

The files are "latzipped". It is about 2MB unzipped.
You do not have the required permissions to view the files attached to this post.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
MM41
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 126
Joined: Sun Jun 28, 2015 2:36 pm
Location: France

Re: Jigsaw Puzzle

Post by MM41 »

Nice :) , not yet tested (my Falcon have loose his NVRAM last week :( )
try http://paradize.final-memory.org/gfabasic.shtml for extended colors in GFA
:oops: 320*240 TC mode
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Interesting yes True Color. I will check these sources out for other projects. This Jigsaw benefits more of high resolution than of more colours.
Also there is some unpacker code that I could use.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
Anima
Atari Super Hero
Atari Super Hero
Posts: 763
Joined: Fri Mar 06, 2009 9:43 am
Contact:

Re: Jigsaw Puzzle

Post by Anima »

Great stuff. Thanks for sharing. :cheers:
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2158
Joined: Sun Jul 31, 2011 1:11 pm

Re: Jigsaw Puzzle

Post by Eero Tamminen »

It doesn't work for me (in Hatari), either with TOS v4.04 (Falcon), TOS v3.06 (TT) or EmuTOS. After starting sound, it just outputs "ERROR malloc failed", regardless of how much ST-RAM & TT-RAM is specified.

That seems to happen after loading "jigsaw8.pnt", when it does zero-sized allocation:

Code: Select all

...
GEMDOS 0x48 Malloc(0x80) at PC 0x25A80
GEMDOS 0x48 Malloc(0x600) at PC 0x25A90
GEMDOS 0x3D Fopen("C:\data\jigsaw8.pnt", read/write) at PC=0x281BC
GEMDOS 0x3F Fread(64, 4096, 0x111232) at PC 0x29626
GEMDOS 0x3F Fread(64, 304768, 0x154be6) at PC 0x2966C
GEMDOS 0x3E Fclose(64) at PC 0x28D42
GEMDOS 0x49 Mfree(0x280266) at PC 0x25B58
GEMDOS 0x49 Mfree(0x2802E6) at PC 0x25B6A
GEMDOS 0x48 Malloc(0x0) at PC 0x25F72
ERROR malloc failed
GEMDOS 0x49 Mfree(0x2DFD6) at PC 0xE45874
GEMDOS 0x4C Pterm(0) at PC 0x27CE8
According to TOS documentation: http://toshyp.atari.org/en/00500c.html#Malloc

"prior to GEMDOS Version 0.15, Malloc( 0L ) will return a pointer to invalid memory instead of failing as it should."

I.e. this is application bug as zero sized Malloc is supposed to fail.
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Ha Eero thanks for testing. I will install Hatari here on my pc.
btw. my real Falcon has TOS v4.02, GEM 0.3, AES 3.40 and NVDI 4.11
I used only GFA code no ASM inlines.
I remember there were sometimes issues with Reserve and Malloc in GFA.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Hatari with TOS 4.04
Withouth NVDI the colours were crazy.
With NVDI it looks ok only the sound is going crazy now.

Image
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
bjkock
Atarian
Atarian
Posts: 6
Joined: Wed Sep 07, 2016 4:23 pm
Location: Sweden

Re: Jigsaw Puzzle

Post by bjkock »

Tried it on my Falcon, TOS 4.04, 14MB and a “clean” start, no auto or acc programs loaded and my Nemesis accelerator disabled.
I get the same result as you got in Hatari with crazy colors, but with NVDI 5.03 loaded the colors are right.
I then tried with Nemesis activated in both high and low speed mode and it works as expected (if NVDI is loaded).
Looking forward to test some more as development proceeds :cheers:

// Jesper
User avatar
SweYC
Atari freak
Atari freak
Posts: 51
Joined: Sun Apr 27, 2014 2:32 pm

Re: Jigsaw Puzzle

Post by SweYC »

Hi

For best results, you should not use pictures that are dithered on system pallete (i reckon they were dithered in gfx app while using nvdi and thus without nvdi they mess collors). Its better to dither them in best possible way, and then set pallete for each picture. Of course, you need to save system palete at start and resore it when exit the app to restore the system colors. You will avoid the mess with colors that way, and have better quality pictures as well...
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Thanks for feedback people.
About the colours the pics are converted with Imagecopy 4 with match palette on. It is to keep the background and buttons visible.
extra todo:
- save and restore system palette
- it should also work without NVDI (but who lives withouth NVDI??)
- Hatari compatibility
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Messy colour problem is fixed.
There was an unneccesary change in palette at some point. Strange that I didn't see that with NVDI on.
It now works with and withouth NVDI.
(download is the new prg only)
file removed, obsolete
Last edited by mjvans on Wed Jul 15, 2020 3:59 pm, edited 1 time in total.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

- save and restore system palette - DONE
- it should also work without NVDI - DONE
You do not have the required permissions to view the files attached to this post.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2158
Joined: Sun Jul 31, 2011 1:11 pm

Re: Jigsaw Puzzle

Post by Eero Tamminen »

Tested again in Hatari.

Now the game starts fine if:
* Falcon is set to 640x480@256 mode before starting the program
* There's at least 8MB of ST-RAM (e.g. 4MB of ST-RAM and 16MB of TT-RAM isn't enough)

If I run program with TT (emulation), with EmuTOS, it gives an error dialog about wrong resolution. The error dialog looks a bit wonky:
dialog.png
If I use TOS v3 instead, program dies just before showing the dialog to:

Code: Select all

...
XBIOS 0x59 VgetMonitor() at PC 0x290F4
WARN : Bus Error writing at address $ff1100, PC=$e1c37a addr_e3=e1c37a op_e3=1083
GEMDOS 0x4C Pterm(-1) at PC 0xE0126E
If there isn't enough ST-RAM, or program was started in from some other resolution (e.g. 320x200@256), program looks like it's still running, but in reality it has terminated after outputting error message (found out with Hatari "--trace os_base" option). I'm not sure how it manages that, does it reserve screen and not free it at exit, preventing GEM desktop from redrawing itself? (IMHO better would be to output error, wait user input, and call pterm() only after that)

Could the program support also 16 color modes? Reason why I ask is that:
* Larger 256-color mode modes are really slow on base Falcon and make IMHO the program pretty much unusable for performance reasons (unless one has NVDI to speed up drawing operations?)
* Then it could work also with TT med-rez

When the game worked, it didn't really give me any feedback on piece selection and where I was moving it. I assume this is for performance reasons?
You do not have the required permissions to view the files attached to this post.
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Eero Tamminen wrote: Wed Jul 15, 2020 8:48 pm Tested again in Hatari.

Now the game starts fine if:
* Falcon is set to 640x480@256 mode before starting the program
That is good. It was made for Falcon 640x480x256
If I run program with TT (emulation), with EmuTOS, it gives an error dialog about wrong resolution. The error dialog looks a bit wonky: dialog.png
Good at least there is an error dialog now. The dialog looks strange yes. Sorry I had not tested it myself yet.
If there isn't enough ST-RAM, or program was started in from some other resolution (e.g. 320x200@256), program looks like it's still running, but in reality it has terminated after outputting error message (found out with Hatari "--trace os_base" option). I'm not sure how it manages that, does it reserve screen and not free it at exit, preventing GEM desktop from redrawing itself? (IMHO better would be to output error, wait user input, and call pterm() only after that)
When it crashes there could be memory reserved I presume. Not sure what you mean with pterm its only GFA Basic you know. That I managed to get a 1000 lines of 25 year old code running is already victory for me. My TOS and GEM knowledge is very rusty.
Could the program support also 16 color modes? Reason why I ask is that:
* Larger 256-color mode modes are really slow on base Falcon and make IMHO the program pretty much unusable for performance reasons (unless one has NVDI to speed up drawing operations?)
* Then it could work also with TT med-rez
Yes I started programming with 16 colours, but i didn't like how it looked. Maybe later I do 16 a colours version. Combining the 2 in this stage made the listing unreadable. Actualy it can behave a lot faster because a move does now do a stupid redraw of all the pieces on screen. That was a quick fix of an error.
When the game worked, it didn't really give me any feedback on piece selection and where I was moving it. I assume this is for performance reasons?
It is now klick once on the piece click on the destination and wait a second. You can also swap pieces btw.
Not sure if some animation can be done fast enough. Have to try something. Maybe light up the source and destination.

I will work on the gameplay features like choosing a puzzle first. I will report back when it has changed a lot. I won't bother you testing every step.
For now it's Falcon 256c only. A more compatible version is ofcourse possible but first I want to finish the goal I started in 1995.
Again I'm very grateful of your testing and comment. If we had internet and forums back then programming would have been a lot easier, but maybe I would only watch the web and download stuff like I did the last 20 years..
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2158
Joined: Sun Jul 31, 2011 1:11 pm

Re: Jigsaw Puzzle

Post by Eero Tamminen »

As I mentioned, for some reason error dialog unfortunately comes only for some unsuitable resolutions, not all.

Photos will surely look bad with 16-colors, but you could use pictures that are already in 16-colors or lower, like line art.

Screenshots from great Atari demos, or drawing competition results from demo competitions like SommarHack 2020 could work fine: https://demozoo.org/parties/3913/

I think that for example the image from the latest New Beat demo would look great: https://demozoo.org/graphics/280154/

As to highlighting a piece, maybe you could just XOR it? That way you don't need any extra colors for highlighting.
User avatar
lotek_style
Mod(ul)erator
Mod(ul)erator
Posts: 2494
Joined: Sat May 11, 2002 2:39 pm
Location: germany
Contact:

Re: Jigsaw Puzzle

Post by lotek_style »

mjvans: Even with the new fix... no luck here in Atari... music starts playing and I get "ERROR malloc failed".

I did an entry on Demozoo anyway... maybe it get's solved and I can complete it :)

https://demozoo.org/productions/281185/
lotek style / the sirius cybernetics corporation
- musician - ascii-artist - swapper - archivist -

.tSCc. - low-tech atari cyberpunks since 1990
http://www.tscc.de/ | http://demozoo.org/ | http://www.lotekstyle.de/ | http://ymrockerz.atari.org/
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

lotek_style wrote: Sat Jul 25, 2020 7:54 am I did an entry on Demozoo anyway... maybe it get's solved and I can complete it :)
Thank you I feel honoured already :D .
Maybe I was a bit too fast with providing a download. But I was so happy i got the old source code running. There were some brilliant ideas in it but it was a bit of a coding mess. It's all more complex as it looks at first sight.
At the moment I have fixed memory leaks. Forgot to free memory at many points.
A big addition is a picture selection screen with preview.
Now working on highlighting selected piece and speeding up by trying to redraw only part of the screen.
Possibly I add an import module to make a puzzle from your own pictures. That would make it more fun.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2158
Joined: Sun Jul 31, 2011 1:11 pm

Re: Jigsaw Puzzle

Post by Eero Tamminen »

lotek_style wrote: Sat Jul 25, 2020 7:54 am mjvans: Even with the new fix... no luck here in Atari... music starts playing and I get "ERROR malloc failed".
Did you start it from Falcon 640x480@256 VGA resolution and do you have at least 8MB of ST-RAM?

(At least in Hatari, it starts with that setup when run on just plain TOS v4, nothing else.)
MM41
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 126
Joined: Sun Jun 28, 2015 2:36 pm
Location: France

Re: Jigsaw Puzzle

Post by MM41 »

Tested on my Falcon (14MB,TOS 4.02Fr)
Nice work Mjvans :cheers:

some troubles to pick up and put puzzle pieces in the game zone,

I'm waiting for the next version :D
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

MM41 wrote: Fri Aug 14, 2020 10:34 pm I'm waiting for the next version :D
Thank you. Working on it. It will be faster.
I publish a new version soon when I have a score count and some other features.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
Mindthreat
Captain Atari
Captain Atari
Posts: 226
Joined: Tue Dec 16, 2014 4:39 am
Contact:

Re: Jigsaw Puzzle

Post by Mindthreat »

Very cool to see these original works from long ago continue on! Thanks for sharing =)
"My attempt at trying to create cool things for the Atari Jaguar:" - http://www.RISCGames.com
AtakiC
Atarian
Atarian
Posts: 1
Joined: Sat Sep 12, 2020 4:47 pm
Contact:

Re: Jigsaw Puzzle

Post by AtakiC »

And I like puzzles, I often add them with my son.
Ich habe vor Ort eine Kanalreinigung bestellt, jetzt rate ich allen https://rohrreinigung-zollikofen.ch/ weil es wirklich schwierig ist, eine gute Firma zu finden.
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

Ok great expectations. Well I got a little further with the program. It's not going fast, I'm not a pro but I am learning all the time.

New:
- main menu
- import function to make your own puzzles
- puzzle select screen with preview
- info
- score counter
- faster
- Puzzles are now in a \puz folder that sounds more logical. When have an old version you better delete it complete and use the new one.

In Hatari I still have problems to run the program. Sound is still a problem. I only use Falcon xbios functions for the sound. Maybe I could try to replace them with ste compatible dma funtions. Compatability with other systems than Falcon must be possible then but as I said before I need to learn some tricks and it takes time for me.
You do not have the required permissions to view the files attached to this post.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2503
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Jigsaw Puzzle

Post by lp »

Noticed when clicking 'Info' in the menu the text doesn't word wrap correctly. Maybe you used PRINT? If so, easy fix:

Code: Select all

PRINT CHR$(27)+"v";  !enable wordwrap
' then output your text
User avatar
mjvans
Atari maniac
Atari maniac
Posts: 80
Joined: Thu Dec 31, 2015 2:08 pm
Location: Netherlands
Contact:

Re: Jigsaw Puzzle

Post by mjvans »

lp wrote: Wed Sep 16, 2020 3:46 pm Noticed when clicking 'Info' in the menu the text doesn't word wrap correctly. Maybe you used PRINT? If so, easy fix:
Yes it is a simple PRINT. Thank you lp.
Falcon030, Mega ST, 1040STfm, 800XL, Lynx, Jaguar
Post Reply

Return to “Games”