Building a Card Playing Twitter Bot: gameplay dialog

I’ve built a couple of other Twitter bots, I have @kevinhookebot which generates random tweets generated from a trained ML model:

and I have a product name generator which generates humorous product names using the Tracery template library:

For my next project I’m thinking about what it would involve to build a multiplayer card game playing bot, a simple card game to get started, like Blackjack. The Twitter REST apis I’ve used so far will be reusable for this project, but the interesting parts are the interaction between a player and the bot, the game logic, and the persistence of game state (each of which I’ll discuss in future posts).

I’ve been thinking about the interaction for the gamevand think it will look something like this:

Player: @blackjackcard deal

Bot: @player bot deals you 4 Clubs and 7 Spades. Reply hit or stick

Player: @blackjackcard hit

Bot: @player bot deals you 4 Hearts. You now have 4 Clubs, 7 Spades, 4 Hearts. Reply hit or stick

Player: @blackjackcard stick

Bot: @player the bot currently has 3 Hearts, 9 Clubs, and takes a card

Bot: @player the bot takes 10 Diamonds and now has 3 Hearts, 9 Clubs, 10 Diamonds. Bust! You win!

The interesting part of the gameplay interaction is that there’s only 3 commands:

  • deal: start a game (get dealt your initial two cards)
  • hit: get dealt another card
  • stick: keep current hard

This makes the options that the bot needs to handle pretty simple. Next up, I’ll talk about persisting the game state to AWS DynamoDB.

Game development in progress: Space Invaders clone – update 3 (18 months later)

It’s been a year and a half since I’ve given an update on my Space Invaders clone on Android. Admittedly I haven’t been working continuously in my spare time on this project for 18 months, in fact the last time I remember working on it was several months back. What I got stuck on was updating the animation routines so the animation would display with a constant frame rate across different Android devices, and the display of the sprites to look consistent for devices with different sized screens, resolutions and pixel densities.

If you’re a seasoned game developer this is probably nothing new to you. If you only develop for a platform with identical hardware specs (like a game console) then this is probably something you don’t have to worry (too much?) about. However with the broad range of specs for Android devices, even testing with the device emulator for different phones, it’s pretty obvious unless your code handles these differences, your game might be fast on one device but slow on another, or the sprite layout may look at intended at the resolution on one phone but be too small on another phone.

I spent a bunch of time reading game dev articles about implementing approaches for constant frame rates, and tried to incorporate what I’d learned, but still, I’ve got some weird quirks I need to iron out.

Here’s what the game looks like on an emulated Pixel:

I was initially developing and testing on the emulated Nexus devices as my baseline test target, but it runs fine, as expected on the Pixel too (it’s harder to play when pressing the buttons with the mouse!).

Now running on an emulated Pixel 2 XL, it runs fine for a while until the number of invaders gets down to where I speed up. The speed up is too fast, and then for some reason that I haven’t found yet they animation stops before the game ends but the game is still playing:
Clearly I’ve still got some work to do here, but it’s getting close.

Installing OS/2 4.52 (Warp 4) on VMware ESXI

Installers with floppy disk boot images require swapping the disk images which is tedious. Find ISO images with 1 boot CDROM ISO and 1 install CDROM ISO – this is a much easier approach for installing. The Boot ISO and English ISO from this collection on archive.org work well.

Create a VM with:

  • 1 vCPU
  • 32MB RAM
  • 500MB disk

In ESXi this looks like:

Attach the iso boot image and boot the VM:

Remove the boot ISO cdrom and switch to the English language cdrom the press Enter:

F5 to switch to Physical View:

Tab to the [free space] in the second section, press Enter for Options, and create new Primary partition:

Press F5 to change back to Logical View, press Enter for Options:

Haven’t created or selected a logical volume, this forces you back to the Logical Volume Manager:

Choose the physical partition we created:

Now this looks like:

Set the volume to be installable:

Switch the ISO image back to the boot ISO and restart the VM.

On restarting the VM, with ESXi for some reason it changes the boot order at this point to the HD first, CDROM image second, so you’ll get a blank black screen on startup.

Power off the VM.

Go into your VM options and check the option to force boot to BIOS on next start:

Power on again.

When the BIOS menu comes up, go to Boot and change the CDROM entry to it is first in the list with the + key, then Save and Exit:

When booted, swap CDROM ISO image to the second install ISO when prompted.

You’ll now see the Welcome install screen again. Enter through the next few screens until you get to the partition selection screen, Accept the partition we created earlier and do a ‘Quick format’ when prompted:

Select HPFS:

The install from the ISO image goes pretty quick, then you’ll see this screen:

Followed by a reboot. You’ll now see the first of the config option dialogs:

You can leave the graphics as default, or press the button and switch the the GRADD drivers (which from memory are the better drivers to use):

Next/Ok through the the next few screens, then you’ll get to the optional installs:

I left the selected options, press Next:

Complete the registration screen, and then you get more options, I unchecked File and Print Sharing, and left the other pre-selected options:

Press Next, if there’s anything that needs additional config it will be flagged here, otherwise press Install:

The install goes pretty quick from here and will reboot at least once:

“IBM Means 3 Things”:

After another reboot if you get a blank screen with network card info, press Enter to continue then you’ll get to your desktop with more options – I selected Java 1.3 to take a look, and the IBM Web Browser:

At this point the installer doesn’t see my CDROM image even though it’s attached, but pressing Exit take me to the desktop.

Welcome to OS/2 Warp 4:

The network adapter wasn’t configured with DHCP by default, so from the TCP/IP folder on the desktop, find TCP/IP Configuration (Local) and enable the first interface and DHCP:

You’ll be prompted to reboot again, but now you should have an IP, and if you open Netscape, you’ll be able to browse the web, although with some rendering issues for sites using features not supported in this older version of Netscape.