LiveCode Tower Jump 2: Part 1

For The Very First LiveCode Game Jam I planned to produce a game more ambitious than the games previously posted here. It is called UFO Reporter: Ground Zero Sydney. If you can, think of a story driven game based on Duck Hunt (1984) for the Nintendo Entertainment System to get some idea of what I was hoping for. With the Game Jam deadline getting closer each week, it was clear that it would not be finished in time.

So with days remaining in the game jam, a solution was to improve a simpler game and make it suitable for release. The result is Tower Jump 2.

Tower Jump 2 is based on the game in Chapter 7 of Coding Nine LiveCode Games. So with that headstart and a few days left, work was done to make it presentable for the game jam. For the curious, my UFO game is not abandoned and will be the focus of a future post here at LiveCode Game Developer.

The Tower Jump in Coding Nine LiveCode Games has a few problems that prevent it from being a finished game. The issues are:

  • No sound
  • No recording of your score
  • Difficulty does not change as you play, boring!
  • The platform positioning is random

The last problem in my first Tower Jump means eventually a time will come when the gap between two platforms is too large and so is impossible to successfully jump between. Whether intentional or accidental, a game that make progress literally impossible is very annoying.

For The Very First LiveCode Game Jam extra code was added to Tower Jump. While Tower Jump 2 is an improvement and is "finished" it could still do with more work. But since it is only around 500 lines of code, it shows how LiveCode can make a real game with not much code.

In part 1 of this game you will see:

  • One way of restricting what is entered in a field
  • Storing the game configuration in an appropriate folder
  • A simple way to call code on a server
  • Server-side code to check login details

Read more »

LiveCode Stock Trader: Part 2

Here is Part 2 for the Stock Trader Game. While Part 1 covered the overall structure of the game, much of the code was calling handlers in another file. This article looks at those functions and commands. This code is less directly related to the gameplay of Stock Trader, but without it the game would not work. Making games is unfortunately, how should I say, not always fun and games.

In this code you will see:

  • Parameters passed by reference
  • Handlers that accept a (no pun intended) variable number of parameters
  • The power of the UPDATE statement in SQL
  • Loops that access repeated HTML form elements with a minimum of code
  • Simplifying code by putting common actions into a tiny library of re-usable handlers

Read more »

LiveCode Stock Trader: Part 1

Here is the first multi-player online by the LiveCode Game Developer. In this game your goal is to make money by buying and selling stocks in 5 companies at a stock exchange. Sounds a lot like Stock Market from a previous post. But this game is different. Not only is your goal to buy stocks when their values are going to rise, and sell them to make a virtual profit, but to become the top trader by beating other players. While the single player Stock Market game can be fun, competing against real people at the same stock exchange takes it to another level.

Multi-player online games are increasingly popular. The list of online games, or single player games with a multi-player aspect, increases every year. Clash of Clans, Star Wars: The Old Republic, EVE Online to name three. Sure Stock Trader is not a RPG with graphics, but EVE Online has been described as just a massive spreadsheet. So in Stock Trader could there be the seed of the next big MMO franchise?

The online version of Stock Market is called Stock Trader and you start with $10,000 in virtual play money and hope to not only increase your total value after each day of trading (buying and selling), but to rise to the top of the leader board.

This game is based on the Stock Market game in BASIC Computer Games from 1978, but has been altered to do all processing on a server and use a web browser for the interface.

In this game you will see:

  • LiveCode Server used to run the game
  • A MySQL table storing player logins
  • Persistent variables stored in a flat-file
  • A user interface based entirely on HTML
  • How an online multi-player game can make a simple idea more interesting

Read more »

LiveCode Stock Market

Here is the first simulation game at the LiveCode Game Developer. In this game your goal is to make money by buying and selling stocks (commonly called shares in some countries) in 5 companies at a stock exchange. The game is called Stock Market and it simulates the changing stock prices of Apple, Google, IBM, Intel and Microsoft. Your goal is to buy stocks when values are rising, and sell them before they fall to make a virtual profit. You start with $10,000 in virtual play money and hope to increase your total value after each day of trading (buying and selling).

This game is based on the Stock Market game in BASIC Computer Games from 1978, but has been updated with a better interface than the original and the significant addition of a chart showing the changes in each stock over time.

In this game you will see:

  • How to draw a line chart without a complex library
  • LiveCode associative arrays used to simplify code
  • Error checking of user input
  • The Any and Random keywords used to simulate stock price movements
  • Rounding of numbers, while keeping trailing zeros after the decimal point

Read more »

LiveCode Desert Island Nim

Not just Nim, Desert Island Nim. This is the classic game of Nim, but with a cuter name and a visual theme of sand, driftwood and woven palm leaves. Never underestimate the power of dressing up a simple game with a fancy name or look. If Candy Crush Saga, which is based on Bejeweled (both could be called "Three In A Row") find a clever name helps, does the same work for Nim?

Of course, Nim doesn't have the variable gameplay of those games. You can win every time with the right stratgegy, boring! But the point is don't underestimate the appeal of a simple concept with pretty graphics and a catchy name. (And it helps if the gameplay has that just one more go to beat my friends or top score temptation.)

Coding wise, in this game you will see:

  • Buttons themed with bitmaps
  • Buttons with a mouse rollover effect
  • An extra hidden card for storing resources
  • Using an array for flexible and simpler coding
  • An AI algorithm that works most when the CPU starts losing

Read more »

LiveCode Experiment: 3D Raycasting

This week instead of a game, the result of an experiment with LiveCode. This is not a polished program. As an exercise in optimising with LiveCode, I set myself the challenge of developing a 3D raycasting demo using only the LiveCode engine. This means no externals (like Franklin 3D) or a library written in another language more suited to 3D games.

Before you alert me of the fact that pure LiveCode is not the best platform to choose when developing 3D games, this I know. As stated above, this is an experiment in finding ways of optimising the speed of graphics and code in LiveCode. In the process, if I can have fun by creating the bare bones of an early 1990s first person game, why not?

The result of this experiment is LiveCode Spider Hunt. The concept puts you in a small building infested with overgrown spiders. Your goal is to kill all the spiders and to find the exit point. You have a can of bug spray. To keep track of how you are going, the status shows the number of dead spiders out of a total, and the distance to your goal.

In addition to this information, Spider Hunt shows the average frames per second (fps), and the average time in milliseconds (ms) required to update each frame. This status is updated every five seconds so this calculation does not affect the frame rate.

In the executable you will see in action:

  • A 3D representation of a room created with LiveCode graphic objects
  • A 2D layer over the 3D rendering for the can of bug spray
  • Objects in the rooms made from 2D bitmaps
  • Automatic opening and closing doors
  • A captured mouse cursor for controlling the view
  • Frame rates of up to 20 fps on current hardware

Read more »

LiveCode Tetris

Tetris. The original falling block, fill a row game. The game that helped ensure the success of the GameBoy. This game is a true classic and still has fans. (Addicts?) Some of the previous games on LiveCode Game Developer (23 Matches and 3D Isometric Maze) are more demonstrations of technique than compelling games. I made them, tested them for a few minutes and then moved on to something more interesting. But Tetris is different. This is the first game from this blog that I have repeatedly wanted to play, and it required less than 350 lines of LiveCode code.

In this game you will see:

  • Collision detection based on a tile grid
  • A compact way of representing and rotating the blocks
  • A game world larger than it needs to be to simplify coding
  • Storing of high scores to add incentive
  • Addictive gameplay

Read more »

LiveCode Text Adventure

Time for a break from games with graphics. Here is a simple text adventure. Calling it an adventure is a little generous because there isn't an in-game story, and the only puzzle is finding your way through the rooms to escape. But as a hack and slash text adventure it still fits in the broad category.

The original version of this game is from 1985, before mouse driven interfaces were standard, and so commands were entered by pressing a single key to indicate a command. For example, press N to go North and C to eat. Pressing C to eat shows one problem of such a simple interface, because the letters N, S, E, W were used for the four basic directions, E could not be used for eating. Instead you Consume food, obvious, right?

In this version, this problem is avoided by using a mouse driven interface, with a heap of dedicated buttons. Perhaps this is no more elegant than the original interface, but it is easy to code and allows the entire game to be played with only clicks, and hence, potentially on a touch driven device without a virtual keyboard.

In this game, you are in a castle full of treasure and dangerous creatures. Your goal is to leave the castle, alive. The original game is called "Werewolves and Wanderer" and has a back story about a mysterious faded letter found in a trunk telling a history of royalty, thunderstorms, a witch and a curse. The tired old story doesn't matter here, because this blog is about game programming.

In this game you will see:

  • A two dimensional array used as a room, treasure and monster map
  • A variable used for inventory with boolean operations
  • A single mouseUp handler for all the button presses
  • An interface that does not allow invalid actions
  • The random function used to add an element of unpredictability

Read more »

LiveCode 3D Isometric Maze

The game this time is more of a puzzle. It is a maze that uses an isometric projection to achieve a 3D effect. The maze is easy to solve, but it can easily be expanded and have more complicated paths to increase the challenge. To make it a little more interesting a timer is included that counts the seconds until you finish. It is you against the timer.

In this game you will see:

  • One way to store room data to allow easy changes to the maze
  • How 2D images and layers give the illusion of depth
  • A technique to scroll a maze that is larger than the viewport
  • A minimap to show the entire maze

Read more »

 

Legal Stuff

All blog posts are copyright and cannot be re-used without permission. But all the code and scripts are dedicated to the public domain. Use such code and scripts in any way you want, but I am not responsible if they don't work for you.

Contact

Further comments or feedback? You can contact me by email at: