[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 »

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:
Screenshot 1
Screenshot 1
VideoPoker1.png (2.99 KiB) Viewed 13718 times
Screenshot 2
Screenshot 2
VideoPoker2.png (2.93 KiB) Viewed 13725 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: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: WIP: Video Poker

Post by Janka »

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: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: WIP: Video Poker

Post by uze6666 »

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: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: WIP: Video Poker

Post by D3thAdd3r »

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 »

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 »

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

Title Screen
Title Screen
Titlescr.png (4.48 KiB) Viewed 13530 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 649 times
VideoPoker.hex
Video Poker .HEX file
(53.6 KiB) Downloaded 675 times
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: WIP: Video Poker

Post by D3thAdd3r »

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 »

D3thAdd3r wrote:I'll take a peek this afternoon
Thank you very much kind sir :D
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: WIP: Video Poker

Post by D3thAdd3r »

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 537 times
User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

Re: WIP: Video Poker

Post by Roukan »

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