Switching From AS3 To Swift

So it has been a long while since I’ve posted here. I do a lot of things, and coding no longer takes up a majority of my time. But I still enjoy it more than anything else.
For the last year, my biggest coding project has been to translate my biggest app, Mah Jong Tiles Solitaire, from AS3 in Adobe Animate (AKA Flash) to Swift in Xcode. My main reason for this is I no longer have confidence that AS3/Air/Animate/Flash has a long-term future as an iOS app development environment. To even build an app you need to now get the “packager” from another company, owned by Samsung. They haven’t done much to move forward with it, and seem to mainly be interested in the Android side of things, not the iOS side. I’m amazed it still even works to produce an app from Adobe Animate and get it into the iOS App Store.
So I decided to slowly rebuild my game from scratch in Xcode with Swift. My initial experience was painful. The first week of trying to learn Swift was slow and unrewarding. My old mind hasn’t learned a new programming language and environment in a while. But then things started to click. I made fast progress after that and had a majority of the game working in about a month.
At that point I slowed down. I was past they point where I doubted I could make this happen. So with the old AIR app in the store and doing fine, I wasn’t in a rush anymore. If I needed to update the app and AIR wasn’t working anymore, I was sure I could finish off the Swift app quickly.
Here and there I worked on it, with the goal of making it look and work just like the AIR app. I didn’t want players to see much of a difference. I know how these casual game players hate change, and even so much as a font size difference is enough to invite bad reviews and “Why’d they change it!” complaints.
When I got close, I decided to do a beta test using TestFlight. I actually did 5 rounds over 3 months. I recruited testers with a message in the old game, explained to them what I was doing, and asked for feedback. It went very well with the game being substantially better at the end of the testing.
Then I held my breath and launched it. I was concerned that the little differences would upset players. I was also concerned that it would change the amount of downloads or the ad revenue in some way. But it didn’t do any of that. Worked very well.
Part of the reason for me to do this is so that I can now really work on the game with confidence. I want to do regular monthly updates with new features. I want to slowly change the game to be more modern and fit in with how other apps work. So much of the game is stuck with old 2010 designs, or even things from the days where this was a Flash (and Shockwave before that) game on the web.
So since the launch of this new version, 3.0, I have come out with 3.1 and 3.2 with improvements I would have never attempted in the AIR version.
Another thing I am doing here is to try to focus on just this one app. I’m resisting doing the same thing with my next-most-successful app. I just want to work on this one. Make it better, add features, promote it even. We’ll see if I can keep it up and if that constant attention will translate into growth.

Posted on May 13, 2021 at 11:55 am by site admin · Permalink · Leave a comment
In: General

New Site: WP Tips and Hacks

For years I have been thinking about how successful MacMost has become, and how I can keep it growing. At the same time, I have though about duplicating its success. I’ve really gotten good at updating a resource like this almost every day, and keeping it up for years. So is there another topic I could cover besides Apple stuff?

I think about what I’m good at, what I have a lot of experience with, and what I use all the time. Then just recently it hit me: WordPress. I’ve been using WordPress for a long time. Not just using it, but modifying it and digging into it. PHP, the language it is built on is something I’ve been using even longer.

It didn’t take me long to realize that this was the idea I had been looking for. So I started a new site all about WordPress.

I’ve putting my own spin on it, as I did with MacMost. It won’t be for professionals, like plugin or theme developers, or those that work to build and maintain WordPress for clients. Instead it will be for everyday users of WordPress who prefer to do it themselves. I think this is a lot of people.

All too often when you try to figure out how to do something in WordPress, the answer at some site is: get a plugin. A lot of people out there have sizes with dozens of plugins as a result.
I’m going to try to champion writing small bits of code, or “hacks,” to get things done, rather than always grabbing another third-party plugin. I’m going to teach this the right way, encouraging people to develop their own custom plugin for these hacks. But I’ll also have posts where I mess with themes, functions.php, and various settings. And I probably will talk about some plugins when I think they are worth installing.

I’m off to a great start with this project, having posted every day for the last month. I even jumped right in and created my first Udemy course. It teaches the basics of creating your own swiss-army-knife plugin. Here’s a coupon to get it for only $10.

My plan is to keep it going. I want to add content day-after-day, year-after-year, just as I have with MacMost. I think I’ll enjoy it as it combines my teaching skills from MacMost with my coding skills. There’s a weekly newsletter at the site, so sign up for that and watch it grow!

Posted on November 7, 2018 at 4:07 pm by site admin · Permalink · Comments Closed
In: General

WindWord Development Notes

So I’ve been building games professionally for 24 years now. Do I have a process? Not one, but several. And none of those are how I made WindWord.

It started out as a basic idea for a quick word game, something I could punch out in a few days. You have a word search grid and you can make words by linking letters that are next to each other. Lots of games are like this. But my idea was that you had to start with the center letter. Then when you finished a word, the grid shifted so the last letter of the word became the new center.

Once I built that in a few hours, I couldn’t help notice that it felt like you were traveling around on a map. So I made it a map. To make it look more map-like and to get around the issue of whether diagonal moves were allowed, I switched to a hexagonal map.

It is much easier to have a map that is all water and plop down some random islands than it has to have a land map and come up with mountains and rivers. So I did that. And it struck me right away that finding words in the sea of random letters was a lot like sailing. Sometimes you had to tack. Sometimes you had to go with the wind even if it was in the wrong direction. Sometimes you had to do a lot to travel a little, and sometimes you could shoot across to your destination.

So not only did this establish the main game mechanic, but the name of the game just appeared in my head. And the name made me think of 18th century sailing vessels, pirates and old school trading games like Sea Trader and Taipan. It also helped that I am in the middle of Neal Stephenson’s Baroque Cycle series right now, which has a lot of ships and trade.

So I put a port on each island and set up a trading game like Taipan. You could buy and sell six goods in each port, and the prices fluctuated as the days passed by. I added a random chance of pirate raids. This turned out to be a good way to encourage players to look for longer words instead of just using two-letter words to move around. The longer the word, the less chance of a pirate encounter.

Pirate encounters in the old school trading games were usually just tun-based fight-or-run dialogs. But since I was already combing a word game with a trading game, I added card battles. You buy cannon cards at ports and then use the numbers on the cards to put a little strategy into the fights.

I started adding lots of little features. There is a mini-map. You can “pray” for help if you can’t spot any good words in the sea use for moves. Each port has a single piece of a treasure map available for sale. Once you have all the pieces you can get the treasure and “win” the game.

There were a lot of nice and juicy programming challenges for me in this one. It turns out that a sea of random letters won’t contain many words in it. Even using weighted letter choices (more e’s, fewer x’s) only helped so much. I experimented with letter pairs, but encouraging good pairs of letters (“ea”) to appear and discouraging bad pairs (“fp”). At one point I used a genetic algorithm that generated seas with letters based on rules to see how many words appeared. Then it mutated the rules to find better rules.

In the end, the best method was to lay down actual words in random paths throughout the game like building a word search grid. Then fill in any blanks with weighted random letters. This not only placed a lot of words directly, but many words have common parts and these often combined with other parts to form new words.

I also had to play with the trading game economics. It isn’t very complex, though. It just basically starts you off trading the least expensive item until you can afford to get the next one. It helps to find a trade route — a quick way to get from one port to the next and then back. And then repeat that for a while. You know, like real life. But since treasure map pieces and cannons are scare, you do need to branch out eventually and travel around the whole map.

So what about the revenue model? I decided to just make this a paid game with no ads or in-app purchases. This kept my design clean. And anyway, I’d like to build up a collection of these purely-paid apps so I can eventually build more no-revenue apps like Island Golf that exist purely to bring more attention to my entire collection of games.

And the game is doing somewhat well. It is definitely my best launch of a paid app since the early days of the app store. Some days are at zero, but on others I sell a handful.

I’d like to keep working on the game. So I hope to get some decent sales in over the next few weeks. I can add so much more to this game. More items to buy besides cannons and map pieces, more combat strategies, more graphics, certainly. If this game does well I could very well decide to focus on it. I have been hoping for some time that a game will do well so I can focus instead of just moving on to the next game. And this would be a good one for that as I would really enjoy it.

Posted on June 1, 2018 at 3:17 pm by site admin · Permalink · Comments Closed
In: General

Cribbage vs Robots

I’m experiencing a bit of a creative streak recently, creating several new games so far this year. I returned to app game development after more than a year away from it. My first game in this series, Island Golf, was a success in that I enjoyed making it, remained focused on the app all through development, and really took the time to fine-tune it before release. The result was a good game that had no major problems, even if it wasn’t much of a success in the store.

I followed that up with Nonograms Unlimited. Nonograms are en existing game, so I was simply implementing my version of that game. But this game, which includes ads, was more of a success. I won’t make a ton of money from it, but it looks like it will contribute a small piece to my bottom line from now on.

My third game, just released, is Cribbage vs Robots. Cribbage, of course, is an existing game. So this is just another chance for me to implement it better than existing apps. I think I’ve done a good job at this. I played a lot of other apps and figured out what I like and don’t like about them. I tried to make it quick and easy to play, removing all frustrations in handling the cards on a touch screen.

Since Cribbage is a two-player game, and I wanted to make a one-player app, I had to write a game AI to challenge the player. Writing a Cribbage AI is challenging, as most are. But you really need to balance the intelligence of the AI with its ability to make mistakes. No one likes to play a game and lose. People like to win. And playing against a perfect AI would make this a really bad game. At the same time, a perfect AI would take up a lot of processor time to run all of the numbers. So making a perfect AI and introducing some randomness to it wasn’t the way to go.

So I tried three different approaches. The first plays based off some basic rules that beginner Cribbage players are often told. So it looks for things in its hand and during the play, and applies the rules. The second uses a much more complex set of rules taking into account most situations and also looking at point values of cribs very closely to compare moves. The third is very different, running simulations of what would happen if cards were played or placed in the crib. Instead of considering all possible outcomes, which would take a lot of computations, it runs thousands of simulations based on decisions and picks the card(s) that score the best.

I liked all of these AIs. That’s why I decided to include them all in the game. This led me to the idea of creating “robots” that you could play against, each using a different AI, plus a random element to them to make them more unpredictable. So 6 different robots, two for each AI plus one a little more random than the other.

I actually come up with a fourth AI that I didn’t use, but was very interesting. This was my placeholder AI that I used to test the interface during early development. It was a completely random AI. It picked a random valid card to play each time. The surprising thing was that it played pretty well. After all, to pick 2 out of 6 cards for a crib is only 15 possibilities. So that’s a 1-in-15 chance of getting it perfect, and probably a better than 50% chance of making a reasonable decision that a beginner human would make. Then for the play, there is really only a 1-out-of-4 choice to make, followed by a 1-out-of-3, then a 1-out-of-2, then only one card to choose from. So there aren’t that many options. Often the random choice was reasonable, and sometimes it seemed like the random AI was being very clever.

From reading other developer blogs I know what to expect now. I will get complaints that the AIs are too hard. I will get complaints that they are too easy. I will get complaints that they “cheat” even though they do not. I will get requests from people to include their favorite Cribbage rule variations or suggestions to speed up or slow down gameplay. Cribbage players are very passionate about their game. But the main thing I need to focus on is the game’s success. I can worry about adding options and pleasing players if the game is successful.

Meanwhile, I am already well into the development of my next game. But this is going to be a bit of a weird one. I started making a word game. But the way the game looked moved me to making it a trading game. Right now it is both. I’m not sure anyone will want to play such an odd game. We’ll see how it goes.

Posted on April 24, 2018 at 10:34 am by site admin · Permalink · Comments Closed
In: General

Island Golf Development Notes

Island Golf is my first new game in more than a year. That’s probably my longest drought since I started making games in 1995. I’ve been busy developing online courses and had been discouraged by the lackluster performance of my last few games and the App Store in general.

Back in December I actually went looking for an idea for a new game that was small enough so I could spent lots of time perfecting it. I developed some quick prototypes for a number of games and tossed them away. I noticed a golf-like game in the app store that was new and doing well, and very simple. That made me think about one of my very first successes as a game developer.

Back in 1996 I had started making Shockwave games for my own website and was getting a lot of attention. One of those games was called Pretty Good Golf. It was a very primitive 2D golf game. Shockwave didn’t even have hit detection at that point, so I had each fairway drawn with a series of horizontal and vertical ovals. You can calculate hits using simple math with those. The game looks so primitive today. Actually, it looked primitive then too. But in 1996 people were just amazed that you could interact with a web page at all.

Pretty Good Golf was actually the first game I licensed to another company. I continued to improve the game for a couple of years and then stopped working on golf games to move on to other things. So it has been at least 15 years, maybe more.

I started off creating this new golf game in Adobe AIR with one very important goal. I wanted the courses to be generated randomly from an algorithm. I remembered what a pain it was to make the courses for Pretty Good Golf. For this new game, I wanted a new fairway to just appear, and an infinite number of random fairways to come after that. I actually started with the idea that you would just keep playing holes in an infinite golf course.

So I embarked on weeks of development playing with algorithms that I devised to create a realistic-looking course hole. There had to be a fairway, surrounded by rough, then trees. And there had to be sand and water features too. And it had to be playable. And it had to fit on an iPhone screen and an iPad screen. And not too easy or too hard.

I started and tested and tossed dozens of models. I started over from scratch many times. I marked up my whiteboard with diagrams and equations. I loved it. What fun!

Eventually I got an algorithm that worked. After weeks of work on that, it took me about an hour to create a simple interface to “play” the holes. And I had a game where you could play hole after hole, never seeing the same hole twice.

One day I had the crazy idea of changing the background color to blue to see if the fairways would look like an island. It did! A few more adjustments and there were sandy beaches all around and even fairways that existed on multiple small islands where you had to hit the ball across the ocean. And it gave the game an artistic theme! I changed the trees to palm trees and worked on adding jumping dolphins and seabirds flying by.

And speaking of palm trees, I looked for some good vector palm trees and couldn’t find anything that looked just right. How hard could it be since you could make a palm tree with a few simple shapes. So that’s what I did. I spent a day creating an algorithm that created palm trees using math. That’s why all the trees in the game are slightly different. They are all generated randomly! Math FTW!

So the original game presented you with an infinite course. It was more of a toy than a game. So I changed it so you started with a set number of strokes and you saw how far you could get. With 50 strokes you could maybe make it to 7 or 8 holes before running out as a beginner. But someone good could go 18 or even 22 holes.

But after some testing, it turned out that this didn’t work so well. If you played an exceptionally good game, and so got to 21 holes, then it was unlikely that you would beat that any time soon. You would try a few times and then give up.

So I went back to the idea of a normal 18-hole round of golf. I wanted to do a high score board too. In order to make that fair, I switched from completely random holes to random holes starting with a random seed. So each day presents a new course, but the exact same course for everyone based on the date. Now you had a level playing field. And each day the high score board starts fresh. Hopefully this will keep players coming back. I know it does for me.

One difficulty I had to overcome with course generation was to make the holes look fine for such different screens. The iPhone X screen is 1125×2436, a 19.5×9 ratio, while the iPads are all a 4:3 ratio. So too wide and the fairway barely takes up any space on the iPhone X, leaving the top and the bottom of the screen blue water. Too tall, and the iPad screen has lots of water on the left and right. But the fairways had to be exactly the same to make the high score boards work. So there was a lot of compromise there.

How about monetization? Should I put ads in the game? In-app purchases? Or, just charge $2.99? I decided that any of these would hurt adoption of the game at the start, so I came up with the idea of doing it completely free. If the game is a hit, then I’ll pick one of those three in a future update. In the meantime, maybe I’ll get some more traffic to my other games.

Now that the game is out, what next? Well, I want to focus the next few weeks on just getting more people playing. It is unlikely that I will get featured in the App Store, or reviewed by a blog or site or anything like that. That takes luck, connections, or marketing bucks. But this time around I don’t want to be shy about spending money to buy ads from Apple, Facebook, Google and Reddit.

Of course I also have ideas for future updates if the game is a success. I want to improve the high score board with longer scrolling lists so you can see beyond 20. I want to improve the artwork in the game, especially the little pieces of flair that appear on each hole. I’d also like those to reflect holidays with little Valentines hearts, Shamrocks, Christmas trees, and so on. Maybe there should be two courses each day, to spread the high scores out. Maybe a north Pacific theme to the other course. Well, I don’t want to get too far ahead of myself.

Posted on February 9, 2018 at 10:54 am by site admin · Permalink · Comments Closed
In: General