Tower Unite Projects

A collection of projects based around Tower Unite.

Here you'll find laser projector code, arcade projects and a few other bits and bobs.

2D Minigolf

Minigolf made for the Arcade in Tower Unite.

This project utilised the arcade API and Box2D to recreate the minigolf gameworld from Tower Unite in 2D.

Play

Arcade Emulator

This is a web emulator of the Tower Unite Arcade API. Some functionality is missing, and performance is not 100% representative.

Mouse and keyboard required. No touchscreen support.

For the best experience, play on Chrome.

Known Issues:

  • Sound is not implemented
  • Clipping is not implemented (things draw outside where they should)
  • Some draw functions don't match the original API
  • Some textures don't match the original API

Overview

Originally written in lua, then ported to JavaScript to make use of a better physics engine, 2D Minigolf allows you to play a scaled-back version of the minigolf gameworld from Tower Unite, within Tower Unite's arcade.At the moment, the current version supports basic level editing and not much else. This, however, required a UI system to be written from scratch, which led to GameBase.

GameBase was a library designed to provide common utility functionality, including a hooks system and a basic UI library.

Technical Stuff

Below I will outline the history and development of this project, as most of it never saw the light of day. I hope some people may find it interesting.

Originally, the project was written in lua, with a custom physics system for ball collision and movement. The levels were static textures, which then had colliders added along the length of the course manually. Whilst this mostly worked, manually positioning colliders along the level using coordinates was a poor way of creating levels.

I decided to make a level editor for the game, but this would require a UI system, something the Arcade API didn't have. I made a system nicknamed GameBase, which would wrap most of the functions from the arcade and instead make them hook/event-based. This would allow various different parts of the code to hook into the arcade's functions without it all having to be in one function. For example, the draw or onMousePressed functions. This allowed me to create a UI system that could run on top of any game, making adding menus easy.

At this stage in the project, the Arcade API added early support for JavaScript instead of just lua. This meant I could replace my imperfect physics system with Box2D.js, an implementation of Box2D, a 2D physics enging, in JS. Unfortunately this also meant I had to port all my code from lua to JavaScript... I ported GameBase over to JS, but decided to start again with most of the game, as it had become a mess, and a lot of the physics had to be done differently using Box2D.js, meaning a lot of the code was redundant anyway.