Random Number Programming and Magic the Gathering

I have been making progress on my Lights out game, coming up with new ideas, scaling back old ideas, putting some things to the side for latter, completely changing the user interface, and generally pulling my hair out at things that should “just work” seam to work on my machine and then just… don’t. So programming in a nutshell.

Now, what is that title about and how does it relate to my game?

Well for my game I have a section that generates random puzzles. As you can imagine this utilizes a random number generator, but it also uses a bunch of seed numbers (random between X and Y, target number, etc.) and I just recently realized a few mistakes I made when deciding these seed numbers. The most recent discovery was that for difficulty I was messing with entirely the wrong number and needed to change a different seed number to get the results I wanted, but more importantly I figured out that I was using the wrong scale of numbers. I had been using numbers in the 5-12 range and figured out I needed to use numbers in the 200-300 range. Why? Well lets get to one of the oldest design problems of Magic the Gathering to illustrate the problem.

In Magic both players start with 20 life, can generally generate one mana per turn of the game (dependent on deck and draw this can go way up or down but I digress), and start with 7 cards drawing one per turn by default. Those are the basic resources a player has to work with. In the first set of Magic they printed a card called Lightning Bolt, it cost one mana and dealt 3 damage to anything… and is widely considered one of the strongest direct damage cards in the game even 27 years latter with  about 4 sets per year. Latter they printed the card Shock, It was exactly like Lightning Bolt except it dealt 2 damage instead. Shock is considered a mediocre card, useful sometimes but your not excited to play with it. So why the giant disparity between reactions with the difference of 1 damage? Well the designers have said the ideal one mana direct damage spell would deal 2.5 damage, but they can only deal with whole numbers so it is either 2 damage or 3 damage. But imagine a world where all damage and life numbers were doubled. suddenly Lightning Bolt deals 6, Shock deals 4, and a new card could deal the new ideal of 5 damage. But because the resources they have to work with were set in stone 27 years ago they can’t actually tweak any of those numbers. Starting to see how this loops back?

By at first dealing with small numbers the number of changes I could make to the system was highly limited. But by dealing with giant numbers I can make much smaller changes for more precise control. Ironically Larger numbers allow for smaller changes.

This is a lesson I keep relearning, but as long as I don’t set things in stone and catch myself early enough I can afford to keep relearning it.

What is different about my take on the game?

Lights Out is an old game with lots of versions available differentiated mostly by graphics, quality of life features, and how many levels the game has coded in.

My take on the game is slightly different.

In Lights Out the objective is to, you guessed it, turn off all the lights. I took a slightly different approach and made it like a more traditional puzzle. Instead of simply turning all the lights off the objective is to change a starting pattern to match an ending pattern. For instance turning an X on the grid in to a box around the edges (I don’t know if that example is even possible I simply use it as an easy to explain example). This can change the thinking on solving the puzzle quite a bit.

To that end I created another tool inside the game, a level editor. This editor allows the user to freely set up a start state before having them use the normal game rules to set up the end state. This ensures that any puzzle created by the editor is solvable. As for sharing these levels… I am currently working on that.

I also have a few ideas on creating procedurally generated levels using a similar method to the level editor.

Why Lights Out?

Today I will talk about why I choose to take on making a lights out style game, and it starts (ironically) with an entirely different type of game. That game is 2048, or any or its derivative games (don’t remember what the first one was called). It was suggested to me to try and make a visually simple game that is easy to understand and can be ported to mobile. 2048 ticks all of these boxes. However I didn’t know how I would implement the mechanics of this game in my preferred engine: Unity. While thinking about Object interactions vs array driven interactions I remembered an old handheld game I used to play around with. That game was of course Lights Out. I realized it would be much simpler as it did not involve creating and destroying objects or much in the way of animation, while still being array driven and a bit object driven and giving me more experience that I might go back to 2084 with.

Been a While… Here’s Whats Up

Been a while since I wrote one of these. I think I have established that I am terrible at the whole “Report on my week” style or the “Something interesting happened” style. This is because either I don’t think of the thing as interesting or just forget that I have something I could write about during the times I could write about it. So this time instead of just offloading everything in one post I am going to try and pace out my posts, plan ahead a bit and release them slowly over time. This should result in more frequent posts but much smaller posts. Lets see if it works in the coming weeks.

As for my current projects, I am working on putting together a “Lights Out” style game in Unity. Lights out is a game were a grid of 5X5 cubes are lit up in a pattern and you are trying to put out all the lights. However when you toggle one box all of its adjacent boxes also toggle, making for an interesting puzzle.

Look forward to future updates such as: why I choose this project, my take on some of the game play, and general development woes, oddities, and wtf moments.

Now Return to the Regularly Scheduled Chaos

I only just realized that I committed to updating this weekly just before I was going to have four weeks of shifted and changed schedules…. mart move.

This week I had to shift my schedule around a doctor’s appointment and so didn’t have my usual time to write this and am instead writing it now.

Next week my schedule is mostly normal but on Friday I am have something that will take up most of the middle of my day. No details yet but hopefully soon.

The week after that is a new set release at work and so all hands on deck for Friday and once again my schedule is shifted.

Then the week after THAT is World Con which I am both attending and helping with so expect some of these posts to be about that in the near future.

Long story short: these updates will be sporadic for the next few weeks and hopefully settle in to a Friday weekly schedule.

The Grind Continues

I am never going to be able to post regularly am I? Hopefully with a few changes I might be able to manage it now. From now on I am going to try and post weekly either about something that happened that week in my life, a review of a game or movie, or just notes about Ideas I have had, about game ideas or anything else.

With that in mind I guess I should give a general status update today.

Still working at my warehouse job with a few prospects of different types of work there. Still improving my coding skills and getting back to an old project, fun side note is that I remember having a problem with the program last time I was working on it and when I went back to it I fixed the problem easily. Sometimes you just need time to back away from something. Helping out at Worldcon this year and might be on a panel (stay tuned for more info).

As the title says the daily grind continues.

More work at work and beyond

Been a while since I posted here. Time to try and fix that again.

I have been working on a few programming jobs and continuing working at Channel Fireball. My programming work has mostly been contract work implementing smaller features for clients, mostly things that took a one or two hours (mostly looking up a new command or tweaking numbers). I have been working on a larger program called the anonomizer. It is similar to Neo Ipsum in that it inserts garbage text to see formatting styles, but instead of filling empty text boxes it replaces all existing text. It also forces you to save a new version of your project as a bit of idiot proofing. And while I don’t have much I can tell people yet I might be getting some more contract work that could turn in to something more.

At Channel Fireball things are also going well, progressing in my packaging training (almost to the point where I am trained to do everything in the packager role). But I also have an extra project that I am working on for the company: PROGRAMMING! Won’t go in to specifics but my bosses found out  I could program and said “here are some  things that need to be integrated/fixed in our current macros. Can you work on this.” So more paid programming work!

Updates and random thoughts

Heh, had a plan for an update schedule for this site… guess plans and this site don’t go along together that well.

So what’s been up with me? At a recent department meeting I was acknowledged by the leads of my department for doing a good job. To which my general response has been “I saw something to do, did it, kept doing it, and no one told me to stop”. The recognition came with a nice dinner with the leads and the other guy that was recognized. Other than that work has been largely the same with new faces showing up (Sometimes for not very long unfortunately) and some older faces leaving. I am getting trained in the next part of the job: Packaging. And it is repetitive, with the exact same physical movements over and over again. But at least during packaging I can chat with people more, look for the pluses.

Where is my programming work at? Just finished some contracting work for which I was writing add-ins for PowerPoint. These Add-ins did several things such as, find and replace specified Tags, and fixed bugs with headers and footers between versions of powerpoint. And right now I am working on another project.

Hopefully I will make these posts more often from now on, but we all know how that promise went in the past. So see you when I see you.

People in the Service Industries

Can’t remember If I have stated it here but I got a job with Channel Fireball in order fulfilment. As a result I have gotten a slightly different view on the service industry. One of the common thoughts about the people in the service industry is that “anyone could do that job.” While this is true physically (In most cases, disabilities can make certain ones harder) it is not true mentally.

Let me explain. In my job I retrieve an order and then go around a warehouse room collecting the cards on the order. And while certain types of orders can be slightly more complex than that I did just sum up 75% of my current job. Sounds easy right? But could you do that for 8 hours a day, 5 days a week? The job gets very repetitive. This is part of the reason my coworkers and I have conversations during the day or listen to music/podcasts, to break up the monotony. But some people just can’t seem to do this job. For some it is the monotony, for some they don’t mesh with the culture of the workplace, and for still others they lose interest in the job because they just don’t click with the job.

And all of this is without any direct customer interaction. Having to deal with sometimes unreasonable, stuck up, hostile, confused, or just delusional customers adds a whole nother dimension that I am  happy that I don’t (at least yet) have to deal with. I am sure some customers are a joy to interact with, but it does add another difficulty in the job.

So the next time you look at someone and think “Anyone could do that job.” imagine yourself doing that job. Imagine that doing that job would give you a living wage. If you would rather do a different job then you just disproved your assumption. Not everyone is mentally equipped to do these types of jobs.

Making Code Behave

What a lot of people who don’t code don’t realize is that only a small part of the code is actually doing the work, most of the code is checking to see that the code is working/the user didn’t mess things up, and the rest is comments to remind yourself and others how it works.

That being said it is also very nice to be in this situation: I have problem A and a related problem B. I know how to deal with problem A but need clarification on problem B. *Works on Problem A and finds solution* Oh so that is problem B…. the solution to problem A already fixes that.