Log In  

Cart #59127 | 2018-11-18 | Code ▽ | Embed ▽ | No License

You are Pat Blastrock, down on your luck space hero. After a particularly ill-fated adventure, you stumble into Space Tavern Station with only 500 credits to your name and a busted up escape pod. (It was a very ill-fated adventure.)
Luckily, if there's one thing Space Tavern Station has an endless supply of, besides surprisingly vile synth-ale, it's suckers. You're going take the only option you have left and gamble your way back to fame and fortune.

The poker played here at Space Tavern Station is not a fancy tournament. Here, they play tavern-style. You can leave the table at any time, but you can't go "all in". If you get raised out, you have to fold, so make sure you bring enough cash to play a grownup's game.

Some of your opponents might be desperate enough to bet the keys to their ship. Don't feel any remorse in taking that bet. It's not your problem how they're going to get home.

If you're light on cash, you can go to your inventory and sell something.

Controls :
Arrow keys and (O) to navigate menus.
(X) to go back to the main menu. (Leaving the poker table.)

Pause Menu :
Sound : On/Off
High-Viz cards - Alternate card design. Some people find it easier to see.
Reset Data : Delete all data and go back to your initial $500 and busted up escape pod.

Old Version:

1.1 :
Cart #44434 | 2017-09-22 | Code ▽ | Embed ▽ | No License

1.2 :
Cart #44786 | 2017-09-30 | Code ▽ | Embed ▽ | No License

P#43606 2017-08-25 11:53 ( Edited 2018-11-18 07:06)

--Lessons Learned and Deep Thoughts--

1) I now appreciate why there were no good poker games during the 8-bit era.

2) I underestimated how much information needs to be onscreen to make a playable poker game. I finally managed to cram it all in, but it's not pretty. I wound up drawing my own 4px font for numbers. The cards had to be uncomfortably small to fit them all in a traditional layout. I would have liked the game to have four opponents instead of three, but there just wasn't any place to PUT them!

3) The four traditional suits were simply not readable at the small scale. I knew I'd need two new suits with new colors. I finally settled on planets and water-drops. I think they should be distinct enough that even totally colorblind players should be able to read them. (Thematically, those suits seem likely enough for a space-faring society.)

4) The word "Check" broke my UI in too many places. I ultimately went with the shorter "Pass", which is technically also correct, but very out of fashion for Hold'em games. Presumably the fashion is different in the space future.

5) The rules to poker seem straightforward, but there's a LOT of edge cases that need to be handled. I spent a lot of time debugging rules problems that only showed up in very specific situations.

6) It's surprisingly easy to use the Monte Carlo method to estimate (without cheating) the odds that you've been dealt the winning hand.

7) It's surprisingly hard to use that estimate to make a believable AI poker player!

8) Managing Pico-8's low MAXINT was a hassle, and I stupidly put it off until late in the project. It was a major hassle to retrofit large number support into the existing game, even though I used the simple method of moving the decimal point two places. (ie: The player starts with 5.00 score, but it displays as "$500".)

Q) The pico-8 'Q' character looks fine in the middle of a word, but on its own, it sure doesn't read as a Q. I decided to make a sprite to use instead of the font whenever I had to draw a queen.

Summary : This game took me a LOT longer than I expected. On the one hand this is good, because I put in more polish than I was planning, but mostly it's bad because it TOOK ME A LOT LONGER THAN I EXPECTED!

P#43607 2017-08-25 11:54 ( Edited 2017-08-25 18:08)

well done! impressive that you managed to fit all the necessary UI! yes, there is a reason why the cards are so big in my video poker cart ;)

it's fun playing with the AI players! I haven't played it enough to know yet: do the players have different "personalities" or are they all controlled by the same exact parameters (besides randomness)? I've never even thought about writing AI for poker before...it seems like it would be...difficult :D

I like the slider UI for betting; it communicates very clearly...I do think it might be a little bit too hard/maybe impossible to make small (e.g. $1) adjustments to the amount though...

also this should have music! some kinda space music or something would enhance the experience I think :)

I love that you wrote some "lore" for this :D

P#43620 2017-08-25 19:41 ( Edited 2017-08-25 23:41)

The players do have different personalities, but I'm not sure how noticeable it is in normal play. They're not super different.

The AI was frustrating to do. I kind of assumed it would be easy. It was not.

"I love that you wrote some "lore" for this :D"
I was imagining how old games used to come with the story printed on the first page of the manual.

No way I'm going to write a whole manual! But I can do that first page.

P#43622 2017-08-25 20:26 ( Edited 2017-08-26 00:28)

> 1) I now appreciate why there were no good poker games during the 8-bit era.

Vegas Dream would like a word, good sir.

Oh.. actually you know what? They didn't add Poker until the SNES sequel. The one on NES is just blackjack, Keno, Roulette, and Slots.

You did a really good job on this! Are the ships collectable or just sort of there as extra lives? Because if not.. Maybe turn collecting them into a thing?

P#43623 2017-08-25 20:38 ( Edited 2017-08-26 00:38)


There isn't a bonus for collecting one key of every ship type. If that's what you're asking.

There is a final key that I consider sort of a "win condition", but it doesn't stop you from keeping playing.

In my early plans for the game there was going to be functionality tied to which ships you owned. But that was way too complicated. Both in terms of game-play and in terms of token limits.

Edit: I should add, that I'm super interested in hearing any suggestions on ways to make the ship collecting mechanic more compelling without making the game much more complicated.

P#43626 2017-08-25 20:58 ( Edited 2017-08-26 01:18)

I worked on a poker game once. We actually farmed out the AI to a studio that specialized in that sort of thing. I'm glad we did, since I think it might have been a nightmare otherwise. It really is awfully complex.

One thing that was kind of cool about that was that we set it up so we basically passed their library the current visible state of the game, and nothing else, so there was actually zero ability for the AI to cheat in our game, even unintentionally. Both sides saw the other as a black box. I liked that a lot.

By the way, would "CHEK" be too grammatically-offensive to use in place of "PASS"? :)

P#43633 2017-08-26 04:35 ( Edited 2017-08-26 08:40)

looks really good! I'm going to have to (re)learn poker (again) :)

small notes though:

  • your card rendering is kind of backwards. the small are too busy, the big are too bland.
  • you kept spade and diamond but now they seem out of place...
  • isn't there a bug in the card highlighting? there's always more than those of the stated hand.
  • cards get a little ugly with the cream color. maybe a flashing white frame around the cards?
  • not sure why you bothered with a smaller font, it's only in the bubbles it seems? those appear for a second, just use the normal font in a rect, over the opponent card?

about the cards graphics, here's a mock-up as a suggestion:

feel free to use it or not :)

got two ugly joes, cloning is all the rage. ;)

P#43635 2017-08-26 07:10 ( Edited 2017-08-26 11:19)

"isn't there a bug in the card highlighting? there's always more than those of the stated hand."

Uh, is there? It should highlight the best 5-card hand. If it's not doing that screenshots plz.

As for the other stuff, those are good thoughts. I will consider them when I put out a 1.1 version.


P#43662 2017-08-26 20:17 ( Edited 2017-08-27 00:17)

FIVE-card hand! of course :) I was expecting only the relevant cards (eg two highlighted cards for a pair).

actually, I find the highlighting confusing. I remember having a pair and seeing the wrong two card highlighted (5 creamed, 2 still white). dismissed as buggy (no big deal) but later I noticed it was the other way around! I'd suggest dimming the discarded cards instead (color 6 should work well enough?)

still not sure that you'd need to highlight all five cards but I'm a total poker noob, so I'm easily confused.

P#43673 2017-08-27 07:58 ( Edited 2017-08-27 11:59)

Nice job! I am really curious to dig into the code and see how the AI is implemented.

I had the same thought as ultrabrite about highlighting feeling backwards (thinking it was dimming cards instead of highlighting them).

It looks like the pot doesn't use the same trick to handle large numbers. I accidentally "won" a "huge" pot of $-32000 in one game.

I think you're on the right track with the hi-viz cards, except that in opponents hands, the number on their left card is half covered.

P#43886 2017-09-03 02:36 ( Edited 2017-09-03 06:36)

Oh, also the graphics on the pot get messed up when the pot gets too big (around $10k, I think?). It starts showing card numbers and suits or something instead of chips.

And I think the turn order gets messed up when an opponent busts.

P#43887 2017-09-03 02:52 ( Edited 2017-09-03 06:53)

Ha! In my defense for when you start looking into my code : It was easier to understand before I had to trim it down to meet the compressed size limit.

It's more than a little bit awkward anyway though. That's what happens when you dive in and start coding the interesting parts first without a plan for the boring parts.

"It looks like the pot doesn't use the same trick to handle large numbers. I accidentally "won" a "huge" pot of $-32000 in one game."

Oh no. That's a bad bug. I'll have to look into fixing that. (Until it's fixed, just imagine that the other players got tired of you winning all the time, pulled their laser revolvers, and mugged you.)

I'll probably adjust both the highlighting and the layout of the HighViz cards while I'm at it.

The pot graphics, and the betting order with both bugs that I was sure I had fixed. I'll look into those too.

P#43945 2017-09-05 09:27 ( Edited 2017-09-05 13:28)


  • Fixed Pot overflow bug.
  • Fixed (I think) pot graphics bug.
  • Made minor adjustment to AI behavior
  • Changed layout of "HiViz" cards, to make them more visible.

I experimented with different ways to highlight the winning hand, but I couldn't find one I liked better that didn't take a surprising amount of code. All of the palette manipulation I'm doing to draw the cards, make's it tricky to make adjustments. So I just left that.

I looked into the betting order, but it looked OK to me? If there's a problem with it, someone will have to explain it to me.

(And I'm pretty sure I didn't cause any NEW bugs!)

P#44435 2017-09-22 11:52 ( Edited 2017-09-22 16:34)

Thank you very much for publishing this and the very useful commentary. Much appreciated!

P#44454 2017-09-22 18:00 ( Edited 2017-09-22 22:00)

What the hell. If you go all-in in this game then opponents can bet $1 more than you have and get to keep all your money no matter what cards they have. I'm not familiar with how this works in actual casinos but I'm pretty sure it doesn't work that way. That seems to disagree with everything I thought I knew about good game design. If you have the best cards and you bet everything then you should win the hand no matter how much money the other guy has. Poker has side pots for a reason.

P#44571 2017-09-24 17:27 ( Edited 2017-09-24 21:31)

@BenMcLean: Yeah, this uses tavern style where you can push others out as you described. There's no 'all in' mechanic when you play this way. FYI, it is a style played in Vegas -- for obvious reasons, unless you're a Rockefeller, I'd stay away from those tournaments though. Blackjack with a consistent group who knows how to play 'against' a dealer is going to be your best odds in my experience.

In this game, that mechanic also lets you do the same to your opponents at times, though. Even if your cards are absolute garbage. Getting lucky like that on a bluff is the only way I was ever able to achieve max cash in Vegas Dream or the sequel, so I guess I take it for granted as part of video game betting sims.

P#44595 2017-09-25 11:47 ( Edited 2017-09-25 15:47)

If you go all-in in this game then opponents can bet $1 more than you have and get to keep all your money no matter what cards they have.

That is correct. The betting rules are old-fashioned tavern-style rules. (I think this is an anachronism, Texas Hold'em is too modern for the kind of old-west tavern I'm imagining. But whatever. It's in space.)

Part of the strategy is judging whether or not you've brought enough cash to the table, if not, you have to play conservatively even when you have winning hands.

I'm not going to change that. I wanted it that way. (Hence the name. It ain't "Space Casino".)

However..., there is one feature I meant to implement but ran out of tokens, a little optimizing gave me room to add it back in.

So Here's an update where you can throw in the keys to your ship as collateral. Just like it currently works for AI players, wagering your keys will let you play out the rest of the hand without betting.

Mathematically, this isn't a good strategy, most ships have a nominal value much higher than the current bet, but if you're desperate, maybe it's worth it.

(Point of interest for completionists : If you lose your escape pod this way, you can't get another one. The other players will never bet an escape pod. You're the only gambler desperate enough to travel that way.)

P#44787 2017-09-30 20:00 ( Edited 2017-10-01 00:00)

Unless there's a game-breaking bug, that'll be the final update to this game.
It now has all the features I intended it to have.

I'm sure it could be made better in a lot of little ways, but I'm happy with it as it is.

P#44788 2017-09-30 20:11 ( Edited 2017-10-01 00:11)

OK I am not a gambler at all so I don't understand about different betting rules. What I don't understand about this "tavern style" is this: Once you have at least $1 more than anyone else at the table, what's to stop you from betting everything you've got every single hand for the rest of the game, and being guaranteed to win every single hand since nobody else has enough money to match your bets?

P#46060 2017-11-09 11:57 ( Edited 2017-11-09 16:59)

A couple of things

1) There is a maximum raise. If the other player calls you don't have an opportunity to raise again.

2) In real life, if you were certain you had a winning hand but were being raised out, you might negotiate an IOU or a wager of a piece of property. This is simulated in the game by the ability to put the keys to your space-ship in the pot.

You're right that it is an inferior form of betting. Tournaments use split-pots and all-in bets for a good reason. It would have been simple for me to implement that, but there are so many games that emulate tournament-style play that I wanted to try something different, I thought it might have more charm.

I see that this was a very divisive decision.

P#46062 2017-11-09 12:32 ( Edited 2017-11-09 17:32)

This kind of betting system is refreshing for a change, i don't mind it. The only thing i didn't quite understand was that sometimes i can wager my escape pod, and sometimes i could not (especially if i had wagered it earlier), even if their raise is lower than the value of the pod, so i'm forced to fold even though i would have the pod?

EDIT: To clarity, this is when trying to call a raise made by A.I. with my escape pod, and being unable to do it. I'm not sure why i can't do it. I think the first time it works fine, but then the option is no longer usable.

P#46143 2017-11-11 13:05 ( Edited 2017-11-12 11:17)

Hmm... That sounds like a bug. I will look into it.

P#46288 2017-11-14 12:35 ( Edited 2017-11-14 17:35)

It just happened again, but this time it might have been because of a good reason; the ships value was lower than the raise A.I. did. However, i also noticed that i was able to call a raise with my ship before, that had a lower value than the raise, but i might have had a higher value ship in my inventory, i'm not sure about that.
I'll post screenshots, though it doesn't show that i had a ship. I wish i had prepared to record a GIF, but it was too late once i realized it.

This time it happened in high stakes table (happened in low stakes before), and also i didn't have an escape pod, but in both cases i only had one ship in my inventory. Whether that is relevant or not, i don't know. I'm also not sure if this is a bug or just how the game works.

Great game anyway :)

EDIT: Is there a problem with the img tags and uploading images here?

Screenshot 1
Screenshot 2

P#46308 2017-11-15 04:48 ( Edited 2017-11-15 09:51)

Definitely a bug.

It should allow you to bet a ship if you have one. Even if its nominal value is below the current bet. I will look into that this weekend.

Sorry for the problem!

P#46311 2017-11-15 10:21 ( Edited 2017-11-15 15:21)

No worries. I took a look myself too, but i didn't see anything wrong in the code. I suppose the menu.betship variable has to be false for this to occur? Not sure if pm.betship could do it alone.

Now i wish there was a debug tool which would allow printing values of variables, setting breakpoints and stepping through the code, the usual stuff. It would be really useful to know the values of variables at the point the bug occurs.

I guess i could at least constantly print some of them to the screen.

EDIT: If only we would have at least _G or a Pico-8 equivalent for debugging. It's also a bummer to debug when at code limit, because you can't put additional debug code in even though you never intend that code to be there in release. Maybe it's possible to build an external debugging tool, when in a real pinch.
I suppose it fits the theme, debugging is as minimal as the API for making the games is :)

I also found another bug. You have lvl_buyin={50,2500,100000}. 100000 in Pico-8 results in -32768 though :) I would not mind there being no buy-in limits at all, i kinda like to get a bit of a boost by visiting the high stakes before cleaning mid-stakes a bit more easily :)

EDIT 2: Found another pretty bad bug. I and A.I. both got a straight, yet the pot was not split. :( I'm linking a GIF of that as well as a GIF of a 3rd occurrence of the "cannot bet ship" bug. Oh, also, i was able to move the betting slider while having $0. Didn't try if i could bet.
I'm using Pico-8 v. 0.1.11d.

GIF of pot not splitting
GIF of cannot bet ship
Ship i had in above case

P#46511 2017-11-20 09:49 ( Edited 2017-11-20 18:47)

Heyooo, I love this game and play it all the time!

Found a bug though :(

As you can see, a straight was dealt completely on the board, which actually should have split the pot, but the game appears to be considering Boglin's 8 to be the kicker card (it's hard to tell if that's what it's doing, or looking at his pair of 8s). Since in poker, no kicker is used beyond the 5th card, this should have been a split pot. However, even if it IS considering his 8 to be the kicker, or if it's considering even his pair of 8s, I still would have the jack kicker and a pair of jacks (in fact I had 2 pair on top of the straight, not that it should matter), so no matter what, the outcome was bugged.

P#56954 2018-09-20 23:25 ( Edited 2018-09-21 03:27)

Loving this card game. Nicely done relaxed game play. A definite favorite of mine.

As you mentioned you are having difficulty fitting cards on the screen, may I suggest a set I doodled a month back ? Yes, each card REALLY is only 8x8 pixels as I wanted to have the option to fill the screen with them. Color 15 becomes black when in runtime and "0" represents "10."


P#56960 2018-09-21 00:16 ( Edited 2018-09-21 04:17)


Some 8x8 cards I made inspired by dw's post. You can palette swap the red to different colors to represent suits.

P#56962 2018-09-21 00:48 ( Edited 2018-09-21 04:49)

Ooo. I didn't notice @Scathe's bug report. That's a nasty one.

I was resisting going back to tinker with this, but that's a serious enough bug that I'm going to have to look again.

There are some bugs you can live with in a poker game, but the hand-comparison algorithm absolutely has to work.

P#56968 2018-09-21 11:50 ( Edited 2018-09-21 15:50)

@dw817, thanks for the kind words, and those sure are some tiny playing cards.

P#56969 2018-09-21 11:52 ( Edited 2018-09-21 15:52)

Yep, they really are, apLundell. Suuuper small. :)

Looking at the last set. Inspired by Scathe's post.


It's tricky to draw numbers and letters in a 4x4 pattern (except for the 10), but it can be done !

P#56974 2018-09-21 14:34 ( Edited 2018-09-22 04:24)


  • Fixed hand comparator.
    There were two seperate bugs that could potentially prevent a tie from being properly detected. (One was a value that could go to zero, but I was checking for nil, the other, as @Scathe guessed, would sometimes allow it to try to compare "kickers" even when the winning hand consumed all five cards.)
  • Fixed "High Stakes Table" entry requirements
  • Minor graphics tweaks
  • Changed the name of one AI opponant.

Not Done :

  • Ship betting bug.
    I was unable to replicate this bug. If anyone can describe a situation where it always happens, or a way to force it to happen, I would be very grateful. The code that makes this decision is so simple, either the bug is incredibly subtle, or I'm being profoundly stupid.

Notes :
Sorry this took a little while. I'm not too fussed about most bugs, but a poker game can't live with a broken hand comparator, so I really wanted to get this out.

P#59128 2018-11-18 02:06 ( Edited 2018-11-18 07:06)

Fantastic game! I seem to have found a bug similar to the one above posted by Scathe.

In this dramatic round, there is a full house, kings over aces, on the board. I have another ace in my hand, though, so I was expecting to win with a better full house... right?

(Note that it wasn't even a tie, but rather I lost despite having the strictly better hand.)

P#90297 2021-04-09 19:28 ( Edited 2021-04-10 18:37)

Here's another one: why does Zorblax have three of a kind here? It looks like a full house, 66644.

I notice that the previous bug I posted also has a full house. It looks like it gets confused when there are two triplets, and fails to recognize the full house. So in the previous case, I'm guessing I lost because it treated my AAAKKK as a three of a kind.

P#90954 2021-04-22 20:32 ( Edited 2021-04-22 20:37)


if( triple~=0 ) then
  if( bxor(triple,pair) ~= 0 ) then 
P#90956 2021-04-22 20:51

Four of a kind is similar. Jelpi lost here because her hand was too good.

P#91217 2021-04-27 23:38

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-02 15:30:15 | 0.039s | Q:68