Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Poker game

Author
Message
john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 16th Oct 2009 00:02
Hi,
Sorry but I'm begginer. Can help me somebody, how to I can create a poker game?
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Oct 2009 04:18
There are lots of types of Poker. The ones where you play a machine. Some with Jokers. Some against other players.

Quite a lot of stages to making the game.

Starts differently for each type of game.

Dim Cards(52,4) for cards, and suits.
Dim Cards(52,5) If you use Jokers.
Dim Hand(5) for 5 card games



You could be pasting images of the cards.

Sorting the cards into numeric sequence which helps later for finding out if you have a straight.

Checking the 5 cards against the complete set of hands that the game can create.

That's about it, apart from sorting the money out at the end.

demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 16th Oct 2009 05:18
Sorry Pincho why do you need the 52,4 there? Either you could have 13,4 or just 52 and have the value showing what suit it was.

And JohnP your first step you need to write down the possible combinations of hands - so have it set up so that for example 3 of a kind beats 2 pair. Then inside one kind of win you'd have to make sure that the highest value won (e.g. Aces full of Kings beats Kings full of Aces).

Start off creating a program which deals out cards at random and interprets them as whatever kind of card you want. I think there's a thread on the 2D games board with pictures of cards you might be able to use (not sure, haven't checked back in a while, but I think it was stickied). Then get it to deal however many cards you want. Get to this starting point and then come back with your progress and people will be able to help you with the next steps.

"A West Texas girl, just like me"
-Bush
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 16th Oct 2009 05:19
When I read this I thought: Hmmm... it would be kindof hard to figure out what hand everyones has. But I remembered I just programmed Yahtzee. So really, I've done most of the possible hands. (If you don't know Yahtzee and poker are similair, three of a kind, small straight, full house...).

I'm not completely finished yet, I still need to finish the menu and highscore part. But I've got the main Yahtzee game finished.

Razerx
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 16th Oct 2009 05:27
@razerx: Haven't played Yahtzee. but the way poker basically works:
you get dealt some kind of hand (depends on the type of game). The hands go in this order (worst to best):
High Card
Pair
Two Pair
Three Of A Kind
Straight
Flush
Full House
Four Of A Kind
Straight Flush
Royal Flush

I don't know the best way to approach this in playing but probably a scoring system for each of the hands. The player with the highest value wins, unless 2 or more players have the same value (for the same kind of hand)
Then you'd have to calculate which one won (which might be more difficult. Don't forget for example if 2 players had 2 pair Queens and 7's the high card could still affect the outcome).

Getting AI for this game might be the most difficult part - the computer couldn't just go on whether it had a good hand, that would make the game too easy to play. You need to have some sort of way for it to apparently bluff spontaneously (When it had a reasonable hand, to occasionally bet as if it had a really good hand or whatever). If you just assigned standard bets for different sets of cards, it would be too easy to inadvertently read the playing style of the computer. Honestly, I don't really know how to go about this. I might post back if I have any ideas tomorrow when I'm sober, but I definitely think this is the main hurdle to overcome.

"A West Texas girl, just like me"
-Bush
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 16th Oct 2009 05:48 Edited at: 16th Oct 2009 05:51
@demons breath
I've always wanted to make a poker game but I'm not good enough yet.


Here's what I got so far on the yahtzee game, I put some rules in there too.

It never ends so you have to exit after 13 rounds.

Razerx

Attachments

Login to view attachments
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 16th Oct 2009 11:59
If you want it to end after 13 rounds couldn't you just have a round counter incremementing each round? Then when they're done just go to your end routine.

And I'll look at that file later but it's coming out a weird file type - I don't have time to find the program (got a lecture in just over a minute and I'm still at home)

"A West Texas girl, just like me"
-Bush
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Oct 2009 17:02 Edited at: 16th Oct 2009 17:23
Quote: "Sorry Pincho why do you need the 52,4 there? Either you could have 13,4 or just 52 and have the value showing what suit it was.
"


Lol yeah, not sure what I was doing there. Oh yeah I had a shuffle flag. Cards(52,2) 1 for flag, and 2 for Card Image. The flag stops a card from being picked twice during the shuffle.

john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 16th Oct 2009 21:14
Hi, a lot of thanks for your fastest answer!!! Generally I want to start create a game, a gambling game.
1. a poker like "royal flush" "two pair" "jacks or better"
2. a fruit game (with cherry's, bell's, 777)
Pls dont forget that I have the DarkGAME STUDIO only one day!!!
I'm begginer
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 17th Oct 2009 02:26
Quote: "If you want it to end after 13 rounds couldn't you just have a round counter incremementing each round? Then when they're done just go to your end routine."


I rarely start a game without knowing how to do every little thing.

I'm still working on my menu and highscore part of the code. After I finish that I'll make it take you to highscores if you beat any of them or to the menu if you don't.

Razerx
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 17th Oct 2009 05:16
@John P: Decide which kind of game you want to make and stick with it. If you want poker, then we can help you with that. If you want a fruit machine I'm sure we could do that too. But you need to make decisions yourself and be prepared to put in the work.

I'm not too sure about fruit machines (I prefer the itbox style quiz games when I'm in pubs and rarely play them) but for a basic one, all you'd need to do was randomly display 3 pictures and if they match up you win a prize. Obviously you'd develop it from there, but I think that would be the best starting point for doing it. It would help you learn just a couple of basic commands. Then you could have a 3x3 display with 9 pictures on and check for lines in any direction. Then you could start adding in the way an actual machine works, with a reel with the pictures on so they wouldn't just be random, they'd be in a specific order. Then those bonus things which I can never figure out (numbers, or when certain conditions are met another light lights up, or something along those lines) would be one of the last things you added.

"A West Texas girl, just like me"
-Bush
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Oct 2009 06:16
Poker is probably the hardest gambling game to do.
Fruit machine is probably the easiest.
Hey, you could start with a fruit machine and work your way up building an entire john p casino!

Here's what I think the order of difficulty is, starting with the easiest:
1. Fruit machine
2. Roulette
3. Black Jack
4. Poker

TGC Forum - converting error messages into sarcasm since 2002.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 17th Oct 2009 16:06
I don't know, I think Black Jack might be pretty easy and there's less to compute than poker, but it's pretty easy to show the cards and suchlike whereas a fruit machine you'd need to animate to show the wheels turning and all that sort of thing. I'm biased towards games that are simple in appearance though, as my skill for graphical design and visual cohesion is inferior to someone like Stevie Wonder's, so if it's just a "whack a few cards on the screen" kind of thing, I'll normally go for that.

"A West Texas girl, just like me"
-Bush
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Oct 2009 20:18
There's a simple explanation of how to randomly deal cards from a pack without repeating any in my strings tutorial (see the stickies).

TDK

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Oct 2009 21:42 Edited at: 17th Oct 2009 21:43
I was trying to do a real shuffle, because Blackjack uses up to 6 decks of cards, and doesn't shuffle them until you get to a wedge. So I needed a real shuffle routine. Then I just put my Blackjack shuffle into Poker.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Oct 2009 22:00 Edited at: 17th Oct 2009 22:02
Ah I see what you are talking about now.

You still don't need a shuffle routine though - my routine could be adapted.

Shuffling simply mixes a pack up so when you draw the cards one at a time from the top, they appear in a random order.

In my routine, you don't mix the cards up (shuffle), you take the cards from the pack from random positions. The end result is exactly the same as having a shuffle routine and dealing from the top.

All you need to do with my single pack deal routine is call it five times if you have five packs of cards.

TDK

demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 17th Oct 2009 22:47
But if you called your function 5 times would it not mean that it would go through all of the first deck before moving on to the next? Not shuffle all the decks in together like it really should. In a properly shuffled set of 5 decks you could have 5 aces of spades next to each other for example.

"A West Texas girl, just like me"
-Bush
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Oct 2009 23:02
I meant using the routine to create 5 packs and calling the routine for each one - using a multi-dimensioned array.

TDK

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Oct 2009 04:33
I wrote a nice little function for turning a number from 0-51 into a suited card. I'll see if I can dig it up.

TGC Forum - converting error messages into sarcasm since 2002.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Oct 2009 05:05 Edited at: 18th Oct 2009 05:08
Here's my Poker game. It's not really finished, but it works OK. It might give you some ideas.....

Harry Potter's Magic Poker (2002) Slightly copyrighted I guess.. that's why I never posted it.,,, until now!

Attachments

Login to view attachments
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 18th Oct 2009 06:16
I might have a bash at looking at making a blackjack game actually, it could be interesting to try... If I can manage it over the next few days (got a lot on... swamped in coursework... who knew a maths degree would entail so much essay writing and suchlike?) I'll post the code with some comments, possibly try and write a tutorial, in case John P is still interested in trying this.

"A West Texas girl, just like me"
-Bush
john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 18th Oct 2009 14:55
I hope to create a game like yours Pincho Paxton. What software you used, the DarkBasic classic or Darkbasic pro???
john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 18th Oct 2009 15:27
[quote]@demons breath: I'm not too sure about fruit machines (I prefer the itbox style quiz games when I'm in pubs and rarely play them) but for a basic one, all you'd need to do was randomly display 3 pictures and if they match up you win a prize. Obviously you'd develop it from there, but I think that would be the best starting point for doing it. It would help you learn just a couple of basic commands.

So,demons breath I'm ready to accept your help, when we start?
john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 18th Oct 2009 15:32
The problem is that we don't know from where to begin.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Oct 2009 15:48
It's DB Classic.

john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 18th Oct 2009 16:30
@Pincho how long it took to create it???
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 18th Oct 2009 16:35 Edited at: 18th Oct 2009 16:36
@John P: I don't really have time to get too involved in a project at the moment, but we can point you in the right direction and if you get stuck people will be more than happy to help. The first thing I would advise though is reading through TDK's tutorials if you haven't already, just to get a feel for the basics.

Some of the areas you will definitely need to look at from these tutorials:
The variables one - variables are basically the building block of any program, and one of the most important things you'll learn how to use.
The layout, style and structure one - not only will it make reading your own code and finding syntax errors easier, but it will mean that if you post code up here because you have a problem then people will much more likely be able to help.
The elementary commands one, for things like printing text to the screen.
The choosing which variable to use one, just because it helps avoid problems later. There are only a few types, so it's easy to grasp, but I didn't realise for a while back when I started that floats needed the # at the end but integers didn't. I kept putting # at the end of both...

But yeah like I say I will be more than happy to help you, as will most of the guys on here, if you have a problem.

"A West Texas girl, just like me"
-Bush
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Oct 2009 17:19
I began with the background screen, and making the buttons clickable.

john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 18th Oct 2009 20:11
Pincho,
what program you used to create the background and the buttons?
Generally what software need the graphics and what type format?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Oct 2009 21:46
Quote: "what program you used to create the background and the buttons?"


Any Windows paint program will do - even Paint which comes with Windows will do. Just save your images as BMP or JPG (BMP recommended) and you can load and display them with Load Image and Paste Image.

TDK

john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 18th Oct 2009 22:33
Thanks TDK...!!!
john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 23rd Oct 2009 00:48
@demons breath,

Thanks for your help, lets start.
john p
14
Years of Service
User Offline
Joined: 15th Oct 2009
Location: Greece
Posted: 30th Oct 2009 01:04
hey guys I need a help hand. I want to build a gambling game. Your advice is to start with something easy example a black jack or a fruit game. If anybody of you, have started a project (fruit or blackjack) complete or not, will to help me somewhat. I need a start point. Thanks

Login to post a reply

Server time is: 2024-05-09 11:31:46
Your offset time is: 2024-05-09 11:31:46