Omnimaga

Calculator Community => Casio Calculators => Topic started by: Siapran on January 19, 2014, 07:22:43 pm

Title: [C] Minesweeper
Post by: Siapran on January 19, 2014, 07:22:43 pm
I started this project a while ago with Eiyeron, and never actually got to complete it... until today that is.
here is the updated project: dropbox link (https://www.dropbox.com/sh/qycc1y3ya0ig130/9woja4DkVo) (v0.9)

screenshot:
(https://dl.dropboxusercontent.com/u/40487730/sprites/Casio/minesweeper_mockup.png)
Spoiler For Full map:
(https://dl.dropboxusercontent.com/u/40487730/sprites/Casio/Menes_full_map.png)
video:


control explanations:
(https://dl.dropboxusercontent.com/u/40487730/sprites/Casio/minesweeper_controls.gif)
~ Arrow keys: move around
~ SHIFT: open box
~ ALPHA: toggle flag
~ MENU: exit

Right now the minesweeper has the following features:
~ scroll able grid
~ recursive opening of empty spaces
~ authomatic opening of safe zones (if you shift click on a already opened spot, and that you have placed an appropriate number of flags around that spot, the game will open the 8 adjacent non-flagged spots)
~ saving and loading gamestate from storage memory (gamestate is saved as "mines.dat")

Features to come:
~ alternative skins (already sprited)

The game isn't complete yet, but it's closer to it than when I unboxed it a few hours ago.
have fun!


(v0.5) UPDATE/HOTFIX:

~ fixed keys blocked by GetKey
~ added part of the GUI
~ game no longer loads save by default
~ F5 to save current state

(v0.6) UPDATE:

~ added timer
~ added mine count
~ added icon

(v0.9) UPDATE

~ game autoloads and autosaves on launch and exit (F5 and F6 don't do anything anymore)
~ exit keys are MENU or EXIT
~ the game now handles victory and failure
~ the game is now complete for v1.0
~ the game's code needs some cleanup
~ the game

(v0.9.1) UPDATE

~ fixed timer
~ SH4 compatibility
Title: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 20, 2014, 12:25:46 am
This looks pretty nice! Is it SH3-compatible?
Title: Re: [C] Minesweeper
Post by: Siapran on January 20, 2014, 02:30:10 am
yes, currently it only works with SH3 (can't remember how to fix for SH4)

To make this clear, I owe most of this project to Eiyeron: he's the one that made the structure, I merely adapted some functions I had made in BASIC for my old minesweeper, added ergonomic keys and the saves.
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 20, 2014, 04:08:29 am
Source will be cleaned and GITed for readability and making others learn tricks/methods from it. That's mainly how I learn C from PierrotLL's games.
Title: Re: [C] Minesweeper
Post by: Siapran on January 20, 2014, 04:08:44 am
(v0.5) UPDATE/HOTFIX:

~ fixed keys blocked by GetKey
~ added part of the GUI
~ game no longer loads save by default
~ F5 to save current state
Title: Re: [C] Minesweeper
Post by: Sorunome on January 20, 2014, 07:59:44 am
Looking nice, good to see some casio programs!
The only casio i have is the fx-9750G plus and i have no idea how to connect to pc.... :/
Title: Re: [C] Minesweeper
Post by: Siapran on January 20, 2014, 08:24:55 am
(v0.6) UPDATE:

~ added timer
~ added mine count
~ added icon
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 20, 2014, 11:42:19 am
Looking nice, good to see some casio programs!
The only casio i have is the fx-9750G plus and i have no idea how to connect to pc.... :/
Have you tried FA-124? It's the best software to transfer files to FXes. Do you have the Casio's cable, or do that calc have an USB port?
Title: Re: [C] Minesweeper
Post by: Sorunome on January 20, 2014, 12:03:53 pm
Looking nice, good to see some casio programs!
The only casio i have is the fx-9750G plus and i have no idea how to connect to pc.... :/
Have you tried FA-124? It's the best software to transfer files to FXes. Do you have the Casio's cable, or do that calc have an USB port?
No casio cable, no usb port :(
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 20, 2014, 12:18:59 pm
So, I'm sorry, but you won't get any Addins if they were compatible (that, I don't know, it seems your calc is too old). YOu can still open basic programs with FA-124 and write at hand the source.
Title: Re: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 20, 2014, 12:48:50 pm
Also the 9750G and G+ have a different processor (4 MHz I think, and are much slower than the 9750GII.
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 20, 2014, 12:50:20 pm
Ah, if it's that processor, Sorry Soru but you won't have any addin at all.
Title: Re: [C] Minesweeper
Post by: Siapran on January 20, 2014, 01:19:48 pm
you can still grab the SDK and try it out on the emulator: SDK (http://www.planet-casio.com/Fr/logiciels/dl_logiciel.php?id=76&file=1)
Install the SDK, open the project file, and run the game!
Title: Re: [C] Minesweeper
Post by: Sorunome on January 20, 2014, 01:30:42 pm
So, I'm sorry, but you won't get any Addins if they were compatible (that, I don't know, it seems your calc is too old). YOu can still open basic programs with FA-124 and write at hand the source.
meh, i wouldn't want to do that :/
Also the 9750G and G+ have a different processor (4 MHz I think, and are much slower than the 9750GII.
Well, the plus must be there for something :P
Title: Re: [C] Minesweeper
Post by: Siapran on January 20, 2014, 05:50:56 pm
(v0.9) UPDATE

~ game autoloads and autosaves on launch and exit (F5 and F6 don't do anything anymore)
~ exit keys are MENU or EXIT
~ the game now handles victory and failure
~ the game is now complete for v1.0
~ the game's code needs some cleanup
~ the game

video incoming :3

Title: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 20, 2014, 08:14:34 pm
I like the scrolling :D

Btw you should use the modify button :P
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 21, 2014, 01:24:01 am
Please Siappy, unless the last post is quite old, refrain yourself from doing double posting, okay?

By the way, the only thing we have to do is clean&comment the source.
Title: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 21, 2014, 01:26:29 am
That was a quite ironic double-post Eiyeron. :P
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 21, 2014, 01:27:21 am
Yup, and I'd like to thanks the mobile network and the tunnels to make that scene quite fun.
Title: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 21, 2014, 01:28:32 am
That tends to happen more on my actual computer than mobile for me. When the AJAX posting is stalled and do nothing, two copies of my post appear sometimes. >.<
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 21, 2014, 01:29:33 am
That's irritating when you want to erase the first and you can't because the signal is insuffisant

Oh and when Siappy finishes c&c-ing, I'll add Eye-candies everywhere.
Title: Re: [C] Minesweeper
Post by: Siapran on January 21, 2014, 04:57:40 am
fixed the double post

by the way, feel free to suggest new features/improvements/eyecandy
The next big step is to add a menu, so that the player can chose the dimension of the grid, and manage saves
Title: Re: [C] Minesweeper
Post by: Sorunome on January 21, 2014, 06:11:08 am
As DJ said, i like the scrolling, and it is looking pretty good over all :)
Title: Re: [C] Minesweeper
Post by: Siapran on January 22, 2014, 08:03:26 am
v0.9.1 UPDATE

~ fixed timer
~ SH4 compatibility [EDIT] apparently not...


control explanations:
(https://dl.dropboxusercontent.com/u/40487730/sprites/Casio/minesweeper_controls.gif)
Title: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 25, 2014, 12:28:00 am
Looks pretty good! :D
Title: Re: [C] Minesweeper
Post by: fb39ca4 on January 25, 2014, 12:34:10 am
I don't know much about Casio hardware, but would it be possible to add grayscale? It would look a lot better than the dithering in those unrevealed tiles.
Title: Re: [C] Minesweeper
Post by: DJ Omnimaga on January 25, 2014, 12:46:15 am
Since the calc runs at 29 MHz (or 58 for newer models) and both can be overclocked a bit, I'm pretty sure it could, but I don't know how that particular LCD works. If motion blur is non-existent like the HP 39gII, then grayscale would only work if the LCD supports multiple shades of gray like the 39gII one.
Title: Re: [C] Minesweeper
Post by: Eiyeron on January 25, 2014, 04:31:00 am
I don't know much about Casio hardware, but would it be possible to add grayscale? It would look a lot better than the dithering in those unrevealed tiles.
Well, grayscale is quite the hard thing here.

First, we don't have an ASM community, there are only 2-3 guys who touched sh3 ASM here. So we have to deal with the speed/size loss from programmin in C. Nothing is as optimized as it could be in Axe or z80 ASM. (I'm one of them but I'm still searching a way to code iin ASAM with GCC in Wondws. Do you have a sh3-elf based GCC  here with the right tools to compile for Graph family, for Windows?)

Next, in C, having a stable timer-based grayscale has been very hard. We have to deal with a bugged timer and maybe jump limitations. Having a too big addin with grayscale make the calc directly crash. Nothing to debug this. :/

EDIT :I havee to add that grayscale addins exists, but Graph 35 and 75/85/95 have almost each of oine different reaction to theses addins. The G35+ have for instance a too dark constrast set each time that an addin tries to correct it, and the screen timers are differents for each model...

Third the screen is made to imporve readibilty, it don't have enough "motion-blur"/"afterglow" to have a nice 4-grayscale. Only almost perfect 3 grayscale is possible for Graph 35+. The rest is quite flicky.

Fourth, we didn't tried the Axe method, but as the screen is "better" than TIs, that can be too flicky to be good. I have to test that.

So... Monochrome is fine too! :p
Title: Re: [C] Minesweeper
Post by: Siapran on January 25, 2014, 03:29:07 pm
I had originally planned on making this minesweeper a grayscale game:

(https://dl.dropboxusercontent.com/u/40487730/sprites/Minesweeper.gif)

however, the HITACHI compiler had this very annoying obsession of building timer-based add-ins that systematically send out a magnificent EXCEPTION BLOCKED RESET on run.
so after a few turned over tables and smashed keyboards, I calmly decided to downgrade the graphics to monochrome:

(https://dl.dropboxusercontent.com/u/40487730/sprites/Minesweeper_monochrome.gif)

I then reworked the sprites to a slightly different style.
Title: Re: [C] Minesweeper
Post by: Sorunome on January 25, 2014, 06:29:31 pm
The monochrome is looking just fine IMO ;)