Porting Game of Snails to PHP
I’ve been playing around with PHP for the past few days. Last year for one of my One Game a Month projects I made Game of Snails. I’ve been wanting to make a snail racing and breeding game for literally years. I first started thinking about it when I discovered that video games were actually a thing - the idea was triggered by a real life snail racing experience I had when I was little in Ukraine, collecting and training snails in the rain at my grandparents’ summerhouse near the Dnepr river.
Making the JS and HTML5 version of Game of Snails was a blast. I was finally able to bring this idea that I’ve been mulling over since I was something like 12 years old to life! It was very far from finished (I only had a month after all), but the basics were there - you could find, breed, and race your own snails (against other people’s snails).
The issue was that the idea in my head was never intended to be a canvas/JS game. It was always meant to be a text based browser game, in the vein of the PHP games that I was so obsessed with years ago. HTML5 Canvas simply wasn’t a great medium for all the information I had to display. In my head it was always a PHP web game, where you log in and navigate between pages to view your snails, organize your jars, interact with other people’s snails, train and race against each other, etc.
I think I’ll be using PHP in conjunction with JS and Canvas instead of in place of it. For example, all the snails will probably be drawn on canvas just like they are in the JS version (allowing for more flexibility and add things like movement easily, which you can’t really do that well with image sprites that are so common with these PHP pet breeding games).
So far in the PHP version you can:
- Register a user, with a “stable” name of your choice.
- Be prompted to look for your first snail
- Choose which location you want to search in around your “neighborhood”
- Have a random snail with random stats be generated
- Have a snail be drawn…partially (this is what I’m working now) on the page. Just like with the JS verison, the color combinations of the snail are pretty much endless. For the randomly generated snails the shell color is generated at random and then drawn on HTML5 canvas, so no limited set of pre-generated colors required.
- Select whether you want to add the snail to your stable or keep hunting for a new one.
So far in the MySQL database I only have a users and snails table. I will need to set up tables for things like races, jars, and items (among other things).
Revisiting my breeding formula has already given me some ideas on how to improve it. But I’m trying to force myself to not start working on anything new until after I’ve ported the entire game over.