## Other simple game ideas

My recent blog about the L-Game reminded me of other simple games and I did a bit of digging on the web.  If you are ever looking for ideas for games or game mechanics, take a look at the Wikipedia page on abstract strategy games.

It reminds me of my teenage years when I used to get Games & Puzzles magazine. Here’s an interesting list of subjects from there, many with links.  I wrote my first game for my O-Level (you were allowed to do games in those days) based on  game I saw in Games & Puzzles magazine.  It was a tennis game using 2 dice. Here’s the game play details.

The tennis court is split into 12 segments numbered 1-12 with the net between segments 6 and 7. Bit Like this:

```   Opponent
-----------
12        1
11        2
10        3
9         4
8         5
7         6
--- Net ----
6         7
5         8
4         9
3        10
2        11
1        12
-----------
You
```

The ball starts with you. To serve, you roll two dice and move the ball by the total. So if you get less than 7 then the serve failed as the ball doesn’t cross the net, otherwise it moves the ball by that amount so it ends in segments 7-12.

If for example you rolled 9 then the ball would be in segment 9 which from your opponents point of view is 4. The opponent can now roll either one or two dice and move the ball by the amount. In this case I’d choose one dice as a roll of 1 or 2 would fall short but 3-6 would get it over the net. If you rolled two dice then 9 or above would take the ball out of the court.  There’s no real skill except figuring out whether 1 or 2 dice maximises the odds of the ball staying in play.

It’s a fun little game and easy to code in C or any language.

## Interesting Visualisation – like tixy.land

If you remember tixy.land that I mentioned back in November last year, here is another website that lets you control a visualisation. In this case, tileflip.xyz lets you create a single function and applies it to every square on a board. You can control how many squares the board has and how often they are updated through a pair of sliders. You can pause the animation and toggle squares by clicking on them in the mouse. One of the early examples runs Conway’s Life and has a really short function.

The functions can be quite complicated (it’s JavaScript) as this example shows which moves a ball around the screen while changing colours.

The ctx (short for context) object has various properties and functions that you can call on it. For example ctx.resolution is how many squares there are on the board and this page lists all the properties and functions.

``````function rule(ctx){

ctx.color = ctx.floatToColor(10/ctx.t)

let r = Math.min(ctx.t**2/10, ctx.resolution/4);
let cx = ctx.t*2%(2*ctx.resolution+1);
let cy = ctx.t*3%(2*ctx.resolution+1);

if(cx >= ctx.resolution+1){
cx = 2*ctx.resolution - cx;
}

if(cy >= ctx.resolution){
cy = 2*ctx.resolution - cy;
}

cx = cx/(ctx.resolution)*(ctx.resolution-2*r+1)
cx += r - 1;

cy = cy/(ctx.resolution)*(ctx.resolution-2*r+1)
cy += r - 1;

let toReturn = inCircle(cx, cy, ctx.x, ctx.y, r);

if(!toReturn){
ctx.color = 'black'
ctx.invert = true;
}

}

function inCircle(cx, cy, x, y, r){
return (cx-x)**2 + (cy-y)**2 < r**2 ? 1 : 0
}``````

JavaScript is like C in many ways and while not the main purpose of LearnCGames.com, websites like this are an inspiration to games creators. My other interest is C# and I’m currently learning about Blazor a technology that lets you create webpages in C# using WebAssembly so it’s quite possible that things like this could be done in Blazor.

But it’s fun to look at the different example functions and you can also download the images as gifs via a link at the bottom of the page,

## Where are the business games?

Back in the 8-bit days there used to be a few business simulation type games about. These were mostly text games; I remember one was a multiplayer game about making and selling televisions; you had to make decisions about how many lines to run in your Factory, how much to spend on marketing, R & D etc. and then each turn the program would determine how many TVs you had sold and whether you made a profit or loss.

The only modern equivalents seems to be games like “Pizza Tycoon” and of course the web/mobile game FarmVille (which has just shut down!) . There are others e.g. Airport Tycoon etc. But the simpler games don’t seem to exist any more.

The type of game I was thinking about were more like business simulations. Back before home computers were popular in the late 1970s, I worked one summer on a farm owned by a bloke who created business games for companies for use as training aids.

One such game I played ran in a games ‘Zine back in the late 70s. The person running the game must have had a computer because each turn I’d receive a complicated printout with all sorts of accounting information on it. Things like Cost of Sales, depreciation of value of stock, cost of storing stock and so on as well as P & L and Balance Sheet. It had to have been written by an accountant!

At the very simplest there are games like Hammurabi where you have to survive multiple years by selling land, planting and harvesting wheat to feed your population. This page on Wikipedia lists nearly 200 commercial and web games. It doesn’t however mention the likes of Dope Wars or even torn.com. Possibly those are perceived more like rpg/mmorpg rather than say pure business simulations.

For the simpler type of games like the ones I was describing, C is not a bad language to implement them in.

## I like web games

Not the Flash type games you get on sites like Kongregate but strategy games like Illyriad, (Pictured) Though you can waste an awful lot of time playing them. The web is an excellent platform for certain of multiplayer games. Heck you can even play games like Quake III which was a desktop game but redone using WebAssembly.

I used to play a strategy game Inselkampf (German for Island war) where you start off with one island and improve it then you can start building ships and invading other islands. I remember getting to the point where I was managing an empire of 80 islands and the only way I could do track all the details was with an Excel spreadsheet. But it was a big time hog, taking up over and hour and a half each day (just mad!) and I stopped playing.

It seems to have closed down a few years ago which is a shame as it was very popular in the mid 2000s. The UK website inselkampf.co.uk just has a start Game Over message on it! Searching about I even found a copy of the Inselkampf rules online.

Given my postal games background (I created three Play by Mail games back in the late 80s, two of which are still run today on kjcgames.com. ) I still have an inkling to create a big web or mobile playable game. I’m not saying I’ll make a £million like torn.com.  I’m not a great fan of web development (well the JavaScript part of it) but I’m currently studying a Udemy course on Blazor which is Microsoft’s take on C# and WebAssembly.  This lets you create websites in C# running in the browser. And C# I am most definitely a fan of.

## How to make a game with QR codes

This follows on from yesterday’s post about creating QR Codes. How about creating a web game similar to the Choose Your own Adventure type games but with a difference? I did think about implementing this as a proof of concept and may yet still but ideas are worthless until executed so I’m happy to put this out there. Here are a few notes on a proposed web QR game.

1. You can get open source QR generators for PHP, C#, probably most programming languages.
2. The web pages show one or more QR codes with a title on them. These are actions and by opening the URL (say in a QR reading mobile app) the action applies. Eg Go West into a room, open a chest etc.
3. If you use an 8 character parameter to the URL that gives you something like 2.8 trillion different destinations. eg example.com/r/h65tr321.  The idea is that the web application generates a page from this parameter. If the parameter has been spoofed then you fall into a bottomless cavern, get eaten by an Ice Worm etc and start again. These parameters are generated anew for each game.
4. You can add extra information such as carrying items with extra characters. Unlike web games, there only way to pass information is via the url. So the URL might now be example.com/r/h65tr321a6. (the QR code shown is for this url) The page would still be created from h65tr321 but the a6 might mean you are carrying say a sword and key. If you add on a character to the query for each item, you can have 36 different types of item using a-z and 0-9.
5. The whole adventure is created as a list of rooms, each with a description. A random eight character code is generated for each room. That’s where the h65tr321 comes from. At the start this list of rooms is read into the web application.
6. Puzzles are of the blocker type. To open a door that lets you escape you need to be carrying a key but that’s in a chest protected by a Dragon. You can fight the Dragon but only if you have the sword and the Dragon will always kill you unless you are carrying a potion of extra hit points. So first you have to explore the rooms, going from room to room and picking up items. But you can only carry three items at a time. You can either use or drop an item which stays in the room where you dropped it.
7. Every room you enter when carrying items displays each items with a use and a drop QR code.
8. Other ideas include a time element that reduces each time you move rooms/do an action. You only get so long to escape but a potion that can be used once adds more time.

As you can use any app to scan a QR code and jump to the url, it would be a bit tedious to play but might make for an educational project for teenagers or schoolkids.

It should be possible to build an app might be able to detect the QR codes automatically and display just the link text. Again like QR generators code there are open source packages for reading QR codes.

## Such simplicity- online QR generator

Sometimes you come across a design that is sheer simplicity, could not be easier to use and it just works. That QR code you will not be surprised takes you to this very website!

The website that I got it from is simpleqr.xyz. Just paste or type in your URL and a QR code appears before your eyes.

This is slightly off-topic for this site and no its not an advert – just a recommendation of a useful website. The thing is QR codes are quite complex (understatement).  This is quite a nice visual description.

This however is a very detailed explanation of how to create a QR code in 10 steps and I wouldn’t be surprised if its the method used in simpleqr.xyz.

I remember seeing this explanation a few months ago and no I don’t have a perfect memory. Instead, many of the websites I’ve found are through hacker news. Even better though is this search engine that searches hacker news. I used it to find that QR website.

There are innumerable free QR apps on smartphones so good ahead and verify the QR code!

There’s an elegance about QR codes though it’s not exactly steganography (hiding data or images inside something else) but the fact that you can’t understand it without an app is quite clever. I had an idea once of making a Choose your own Adventure EBook using QR Codes to navigate around a website.

## Text and URLs

QR codes can hold a lot of information. Would you believe it if I told you that the QR below has all this blog text (about 230 words) up to the Text and URLs title at the start of this paragraph? Try it!

Also I compressed the PNG file but it still works perfectly. Here’s a screenshot of the QR app that scanned it.

## A different way of generating a dungeon level

I talked previously on how I generated dungeon levels by splatting down squares and circles of random sizes and then linked them together by corridors.

But another way that might make levels look not quite so procedurally generated is to first compile a catalogue of dungeon rooms.  These are “hand drawn” in a master text file, perhaps something like this:

```*****|****
*        *
=        *
*        =
*        *
*****|****
```

Where * marks the walls,| a possible location of a vertical running corridor and = the same for horizontal running corridor. Each entry in the catalogue has a size (vertical, horizontal) e.g. (6, 11) for the room above and the generator program has to find space for this and then see which of the four doors it can connect to.

You can decide if you want a dead end room or one with more doorways. Any unused doorways are just replaced with a * for wall. Single door rooms might have a secret door that the player has to first discover and unlock/open.

When the generator starts, it reads in the master file, builds a list of rooms and then starts using them to generate levels.

The advantage of the catalogue method is that you are free to create as many room sizes and shapes as you wish and they don’t have to be rectangular or square. Yes the level is procedurally generated but using this methods makes it look less so. You can have very small rooms (2 x 2 anyone?)  or massive hallways with lots of columns.

## An interesting game system – Fiasco

As well as games programming, I like game design and one of the best ways to practise this arcane art is to look at other people’s ideas and borrow/pinch/steal/be inspired by them.

The image is here is from a game Fiasco by a designer called Jason Morningstar of bullypulpitgames.com. It’s such a different game (they call it a weird game)  and you can see what it’s about on their Fiasco page as well as look at the various downloads.

Why I like it is because it gives you a flavour of tv shows with complex plot lines like Fargo. There are several ‘players’ involved and you’re never quite sure how things are going to turn out; there’s not what you would call a hero. You don’t get that in many computer games so anything that can advance the art is very welcome.

OF course turning it into a computer game would present some challenges. But I’d play it!

## So much fun from 16 x 16-tixy.land

If you are looking for inspiration for games creation, take a look at tixy.land. It’s a 16 x 16 square of dots whose colour is determined by a user entered JavaScript function. If you click the page, you’ll see new patterns. This was created by a developer Martin Kleppe and you can see other examples in this twitter thread..

The function is limited to 32 characters but even so that gives you a lot of possibilities. Most patterns are dynamic, changing as you watch. It’s quite fascinating.  The pattern shown in the screen shot is from Math.tan(t*(100-y*x)/9). and the actual url (including the code is)

``https://tixy.land/?code=Math.tan%28t*%28100-y*x%29%2F9%29``

The %28 etc are the HTML encoding of (, while %29 is ) and %2f is /.

You can edit any function on the page so try substituting sin, cos instead of tan. Also abs works as well.

## A collection of app ideas

Now this isn’t a bad thing. On GitHub, someone has built a collection of ideas if you are looking to develop something to further your skills. There always seems top be something about November as a month to do things, whether it’s growing a moustache (“Movember), Writing a 50,000 word novel (NaNoWriMo) or this.

These are in three tiers with 35 Tier 1 “Developers in the early stages of their learning journey. Those who are typically focused on creating user-facing applications.”,  the same number at Tier 2 “Developers at an intermediate stage of learning and experience. They are comfortable in UI/UX, using development tools, and building apps that use API services.” and 20 at Tier 3. “Developers who have all of the above, and are learning more advanced techniques like implementing backend applications and database services.”

If you finish all those, you’ll have done 90 projects. The last 20 of course being the most complex and including such things as a Discord Bot that plays Battleships, an Elevator simulator, a fats food restaurant simulator and the like. There’s no platform or programming language specified.

I’ve seen elevator simulators done before. Single elevator or multiple ones and for varying numbers of storeys.  Optimising the algorithm to minimise the waiting time is interesting and not always obvious. Do you have elevators wait wat floors when not in use or do they sit on the ground floor.

The author of this Florin pop has also completed 100 projects in 100 days if you fancy a challenge.