PHP codes in making simple slot machine games

Wednesday August 27th, 2014

online-3-reel-slotsPHP codes in making simple slot machine games

The PHP language is very convenient to use when creating browser games. Today, top gaming companies such as Goodgame Studios and Gameforge use PHP in the creation of their titles.

PHP is extremely easy to use and very much accessible to anyone around the world. Apart from this site, there are plenty of tutorials on the web that you can access in order to gain basic knowledge of PHP coding. Whether you want to create a very simple game of poker or a complex online RPG browser game, you can use PHP in materializing it for you.

Creating a simple slot machine game using PHP

Slot machines have been around on the Internet for quite some time. The first set of online slot machine games released on the Internet for public use were from InterCasino, which has been in the business since 1996. Despite slot games being an old form of entertainment, there are a lot of people who still play them in both actual gaming establishments and online. Check out the Dragonplay Slots and Slot Machine+ on the PlayStore and see just how many downloads both have garnered in just a few months of their release. Do you plan on creating your very own successful slot machine game someday? Here’s a simple framework code that you can use.

Making a three-reel slot machine game is easy. For this tutorial, let’s simulate a simple, three-reel slot with one payout line. You can add more payout lines after reading this tutorial.

First, let’s create the face of the game:

You can use any image for your slot machine. You may go for the classic look and use pictures of fruits, bars, and 7s on your reels, or you may utilize images of superheroes, pop icons, or music idols. Whatever makes you happy will do.

Next, you have to declare the winning combinations. In a classic slot machine, all three images on the reel must match. In a more modern one, at least three images must match on a 5-reel spin. But for the sake of this tutorial’s one payout line, let’s go for the “all three images must match” option.

Next, in a classic slot machine, the first and third reels spin in the same direction, while the second reel spins in another direction. In order to do those, you will need to code your reels like this.

There! With this framework, you will be able to create a very simple slot machine game. You may create more payout combinations and wheels for your game by modifying the payout codes (e.g. Image1|Image2|Image2) and adding wheels 4 and 5.

Stop Composer from caching the Packagist index (on Windows)

Friday May 30th, 2014

If you are actually trying to develop a package for Composer and you manage to do it without getting yourself into a bloodrage, then you are a much more zen person than me. One of the things that pisses me off the most is that it caches the Packagist index on my local machine, and when I am pushing tweaks to Github several times an hour, that is super annoying.

  1. Find your AppData\Local\Composer folder. For me, C:\Users\bob\AppData\Local\Composer.
  2. Delete all the crap in it.
  3. Right click the empty space you just made, choose Properties. Security tab, Hit Edit.
  4. Select your user, put a checkmark in the Deny box for Write. Hit Apply and accept its warning that you know you are denying yourself.
  5. Enjoy Composer being unable to cache.


I assume on Linux you can find wherever it hides it in your home directory and chmod 000 it.

Unadultered LibreOffice bashing – because I earned it

Thursday February 13th, 2014

Version on Windows 8

How to delete Icons from the new Android 4.4 desktop

Friday January 24th, 2014

Certainly it cannot be that difficult… right? Just like before… long press… drag to… wait… what? I spent about 15 minutes trying different things before figuring this one out.

Finally the option to hide the Google Search bar is an option in the default launcher. But wait, did you hide it? It turns out the Google Search bar is what turns into “x Remove” when you long press an icon. If you get rid of the search bar, you cannot delete any icons. To get the bar back, long press an empty spot on the desktop, and then choose settings.

Screenshot_2014-01-24-02-21-26 Screenshot_2014-01-24-12-36-20 Screenshot_2014-01-24-02-21-14

Of course, this will not be an issue for you if you are using a different launcher.

Google Chrome taking a long time to load on Windows 8.1

Monday January 20th, 2014

I came across this “fix” completely by accident. About two weeks ago my Google Chrome started taking 7+ seconds to launch, which made it as slow as both Firefox and Internet Explorer, while Opera launches in less than 1 second.

Hit up your about:flags page. At first I thought it was this option “Enable Instant Extended API”:




If you do not set that to disabled, the act of creating a new tab takes for-fucking-ever, and you have to sit there and wait for your search box and most visited sites. This fixed slow tabs, but did not fix slow launch. It ended up being this option “Enable D3D11″:




As soon as I enabled that, Chrome was launching in under 1 second again. I assume just like games, the “Default” option is using D3D9, and perchance may be buggy on modern computers. No idea.



Wednesday October 23rd, 2013

Don’t get me wrong, I love PHP. But I also don’t have delusions about it. IMHO she fits it perfectly, lol.


Constructors, Factories, and Typecasts… oh my.

Friday October 18th, 2013

Or – why I prefer a factory style object management system. For the duration of this post we shall assume I have a class called App\User, of which represents a user account in our database.

I am rather used to having unpopular views, so this post will probably be flamed or ignored. Does that at least peak your interest a little to wonder what in the world I could be talking about in here? Lowercase lol.

TL:DR – leveraging all three of these to work together for you is pretty awesome.

Continue to full post…

Reacting with ReactPHP

Wednesday August 14th, 2013

The slides from the presentation I gave at DallasPHP about ReactPHP and Ratchet.

Code that I demoed during the presentation is on Github.

Windows 8 on Macbook keeps having the wrong time

Wednesday July 31st, 2013

The Problem

Even if the timezone is properly set, if you set the time to the correct value eventually at some point the clock gets many hours off again at seemingly random times. You are going to need regedit to fix this.

The Cause

The internal hardware can be either set or not set for UTC and whichever that is, Windows is expecting the opposite.

Continue to full post…

Brightness unchangeable in Windows 8 on a Macbook with Nvidia

Tuesday July 30th, 2013

The Problem

You may notice one or more of these issues:

  • On the charm bar options the brightness button is disabled or says unavailable.
  • The keyboard keys for adjusting screen brightness do nothing.
  • The keyboard keys for adjusting screen brightness, or the charm bar brightness sliders think they are working when really they are not.

This happens every time I update the video drivers, apparently Nvidia forgot to include this option for enabling. In order to fix this you are going to have to open up regedit. (Win/Command+R, regedit)

Continue to full post…