[Completed] Video Poker

Use this forum to share and discuss Uzebox games and demos.
User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

[Completed] Video Poker

Post by Roukan » Sat Nov 03, 2012 12:38 am

Hi All

Whilst waiting for my EUzebox to arrive I've started work on my first project.

Being new to Uzebox / C programming / Tools, I decided to go for something simple to ease myself into things:

Current Planned features

Title: Video Poker (based on the arcade version "Jack's or Better")
Mode 1
Single Player only
High score Table (3 Entries)

100 Credits to play with, when there gone it's game over (100 is a starting point I may adjust this though)
Can bet 1 to 5 credits before first deal, no more betting after that. (Max games: 100 / Min: 20 depends on amount bet each game)
All winnings are banked separately from your credits, this will be your score at the end of the game.

I haven't written much code at this point (so no HEX file to share yet).

I've been at work on my main screen layout and the tiles that it is built from, I've kept them basic for now so I have something to work with.

A couple of screenshots to share for now:
VideoPoker1.png
Screenshot 1
VideoPoker1.png (2.99 KiB) Viewed 5700 times
VideoPoker2.png
Screenshot 2
VideoPoker2.png (2.93 KiB) Viewed 5707 times
I shall continue to post replies here with updates when they are available.

Any feedback / Hints / Tips are most welcome (especially in the Sound FX / Music department )

Cheers

Roukan / Jim
Last edited by Roukan on Tue Apr 09, 2013 5:09 pm, edited 2 times in total.

User avatar
Janka
Posts: 213
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: WIP: Video Poker

Post by Janka » Sat Nov 03, 2012 2:01 am

I'd say, such a game wins from making the opponents visible. No, not strippers :P , that's kind of disturbing. I think of comic characters with a number of facial expressions you have to identify quickly to check if they have good cards or bad. Oh, and a time limit for your moves of course.

User avatar
uze6666
Site Admin
Posts: 4449
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: WIP: Video Poker

Post by uze6666 » Sat Nov 03, 2012 4:52 pm

Looks great to me! Keep in any music for the title only. For FXs, you can simply reuse some from other games, build them from scratch or by using D3thAdd3r's patch tool.

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: WIP: Video Poker

Post by D3thAdd3r » Sat Nov 03, 2012 9:54 pm

Graphics are very nice!

User avatar
Harty123
Posts: 467
Joined: Wed Jan 12, 2011 9:30 pm
Location: PM, Germany
Contact:

Re: WIP: Video Poker

Post by Harty123 » Sun Nov 04, 2012 12:09 am

Very nice idea! It could be also a good gane for a later multiplayer option for the Uzebox!

User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

Re: WIP: Video Poker

Post by Roukan » Mon Nov 05, 2012 4:29 pm

Hi All

Thanks for the previous comments.

I've thrown together a quick "Title Screen" - has music and displays the current high score table.

Screenshot / Hex / MIDI files attached.

Note the Hex file only contains the title screen code ATM.


I have a slight problem with my music:

It plays fine and sounds like it's supposed to, except at the end of the song there is a 32 second gap of silence before it loops back to the start again :cry:

I followed the WIKI tips on preparing MIDI files and converting them using MIDICONV, but I've obviously missed something.

Perhaps if someone has a spare moment or two they could take a look and show me the error of my ways. :oops:


Cheers


Roukan / Jim

Titlescr.png
Title Screen
Titlescr.png (4.48 KiB) Viewed 5512 times
PATCHES.INC

Code: Select all

//Square Piano
const char patch00[] PROGMEM ={	
0,PC_WAVE,9,
0,PC_ENV_SPEED,-15,  
4,PC_ENV_SPEED,-7,  
0,PATCH_END
};

const struct PatchStruct patches[] PROGMEM = {
{0,NULL,patch00,0,0}
};
music.7z
Music MIDI File Archive
(947 Bytes) Downloaded 211 times
VideoPoker.hex
Video Poker .HEX file
(53.6 KiB) Downloaded 232 times

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: WIP: Video Poker

Post by D3thAdd3r » Mon Nov 05, 2012 7:50 pm

I'll take a peek this afternoon

User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

Re: WIP: Video Poker

Post by Roukan » Mon Nov 05, 2012 8:13 pm

D3thAdd3r wrote:I'll take a peek this afternoon
Thank you very much kind sir :D

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: WIP: Video Poker

Post by D3thAdd3r » Tue Nov 06, 2012 12:13 am

Ah, interesting problem with the midi that I haven't encountered before. What I did in AnvilStudio is look at view->event list to see the events. What I noticed is the midi tick that events start on was getting very high at the end of the song(last note starts at tick 49860!) Also tempo was 134, and apparently Anvil says it is set to change tempo over the course of the track and also volume(I see a track flags event, but I don't know the meaning of track flags bits and I assume they are ignored by midiconv).So my theory/initial thought is, something to do with the song position pointer in ProcessMusic() or related just overflowed due to those large numbers. I could be wrong but am too lazy to look through the code and this solution seems to work well.

What I did is open up a second instance of Anvil and a make a new 2 track song. Then I copy/pasted the notes from your midi into the corresponding tracks of the new song. This adjusted the ticks back to normal ranges, from there you can change your tempo back to 134 if you like. Seems to loop properly now. I changed each track to point to it's own patch which you could change back, but a second patch takes so little space and I recommend giving each instrument at least a slightly different sound to make it a little richer. Try the example patches included to see what I mean.

So I believe you did everything correctly here, it was the midi. Did you do any processing the midi and what program if so? I will try and add a trouble shooting section to the tutorial where such things can be there for everyone.

PS I used these arguments for midiconv and the speed is close you might want to dial it in a bit by changing -f a bit. Start and End are right on.
-s0 -e7680 -f66

I suggest you make your patch file like this to start experimenting:

const char patch00[] PROGMEM ={
0,PC_WAVE,9,//experiment with this one for sure!
0,PC_ENV_VOL,128,//start off with a middle volume, less harsh sounding IMO
0,PC_ENV_SPEED,-15,//volume -= (4*15)
4,PC_ENV_SPEED,-7,//volume -= (10*7)
10,PC_NOTE_CUT,0,//make sure patch goes to 0 volume and is properly terminated
0,PATCH_END
};

const char patch01[] PROGMEM ={
0,PC_WAVE,9,
0,PC_ENV_VOL,128,
0,PC_ENV_SPEED,-20,
4,PC_ENV_SPEED,-7,
7,PC_NOTE_CUT,0,
0,PATCH_END
};

const struct PatchStruct patches[] PROGMEM = {
{0,NULL,patch00,0,0},
{0,NULL,patch01,0,0},
};//this will sound pretty good with this song, experiment with patches to find your flavor

Let me know if this all works, I tend to get hasty throwing zips together ;)
Attachments
mfix.zip
(2.79 KiB) Downloaded 189 times

User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

Re: WIP: Video Poker

Post by Roukan » Tue Nov 06, 2012 1:13 pm

D3thAdd3r wrote:Ah, interesting problem with the midi that I haven't encountered before. What I did in AnvilStudio is look at view->event list to see the events. What I noticed is the midi tick that events start on was getting very high at the end of the song(last note starts at tick 49860!) Also tempo was 134, and apparently Anvil says it is set to change tempo over the course of the track and also volume(I see a track flags event, but I don't know the meaning of track flags bits and I assume they are ignored by midiconv).So my theory/initial thought is, something to do with the song position pointer in ProcessMusic() or related just overflowed due to those large numbers. I could be wrong but am too lazy to look through the code and this solution seems to work well.
Trust me to pick a somewhat alien MIDI file :?
D3thAdd3r wrote:What I did is open up a second instance of Anvil and a make a new 2 track song. Then I copy/pasted the notes from your midi into the corresponding tracks of the new song. This adjusted the ticks back to normal ranges, from there you can change your tempo back to 134 if you like. Seems to loop properly now. I changed each track to point to it's own patch which you could change back, but a second patch takes so little space and I recommend giving each instrument at least a slightly different sound to make it a little richer. Try the example patches included to see what I mean.
Now this is something I shall utilise in future, it seems like a good idea to start with a clean/empty file and cut/paste stuff across (leave those gremlins behind hopefully).
D3thAdd3r wrote:So I believe you did everything correctly here, it was the midi. Did you do any processing the midi and what program if so? I will try and add a trouble shooting section to the tutorial where such things can be there for everyone.
I only used Anvil Studio / Midiconv to process the original file:

The biggest change I made was chopping the file size down, the reason behind this was due to the fact that when I converted the whole file it finished playing half way through and I couldn't find out why, so I cut the file just before that point to try to get rid of the problem (but it stayed).
D3thAdd3r wrote:PS I used these arguments for midiconv and the speed is close you might want to dial it in a bit by changing -f a bit. Start and End are right on.
-s0 -e7680 -f66
I can't recall the exact values for: -e -f I used on the copy I linked in this thread, I think -f12 as by default it played very very slow and as for -e it was 49,xxx (ish).
D3thAdd3r wrote:I suggest you make your patch file like this to start experimenting:

const char patch00[] PROGMEM ={
0,PC_WAVE,9,//experiment with this one for sure!
0,PC_ENV_VOL,128,//start off with a middle volume, less harsh sounding IMO
0,PC_ENV_SPEED,-15,//volume -= (4*15)
4,PC_ENV_SPEED,-7,//volume -= (10*7)
10,PC_NOTE_CUT,0,//make sure patch goes to 0 volume and is properly terminated
0,PATCH_END
};

const char patch01[] PROGMEM ={
0,PC_WAVE,9,
0,PC_ENV_VOL,128,
0,PC_ENV_SPEED,-20,
4,PC_ENV_SPEED,-7,
7,PC_NOTE_CUT,0,
0,PATCH_END
};

const struct PatchStruct patches[] PROGMEM = {
{0,NULL,patch00,0,0},
{0,NULL,patch01,0,0},
};//this will sound pretty good with this song, experiment with patches to find your flavor

Let me know if this all works, I tend to get hasty throwing zips together ;)
I switched in your patches & midi include files, recompiled and it works perfectly now :D

Thanks for the patch tips, I shall have a play around with them.

To be honest aside from Alien midi files, this system is very nice and straight forward for a novice like me to actually get something coming out of the speakers - I like it :)

Big Big Thanks D3thAdd3r for taking time out to look into this for me, much appreciate it.

Some very useful tips under my belt which will help me avoid issues like this in the future.


**Edit**

Update:

Just tried the create a new midi file in Anvil and paste the tracks across on the full length version I mentioned earlier - that now works too :D


Cheers


Roukan / Jim

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests