Project – Pharaoh Idle – Part One

All is good and well when learning to go through the fixed learning programme, completing set tasks that build on the skills learned in that session in order to cement the learning. And indeed that works well for me.

Another great way is to set yourself a project, with an end goal in sight, yet little to perhaps knowledge of how it would be completed, nor what you would need to know to complete it. Therefore introducing ‘Projects’ as a concept, but also ‘Pharaoh Idle’; the current project.

What is it?
My plan for Pharaoh Idle is to build a browser based game, using HTML, CSS, and JavaScript. Idle games, such as the ever popular Adventure Capitalist, Cookie Clicker, and Idle RPG to name but a few, are casual games which often require not much more from the user than basic management, with numbers and resources growing exponentially to ridiculously sized numbers.

Adventure Capitalist gameplay Promo image
© Hyper Hippo Games

Pharaoh Idle
The game has taken inspiration from a number of games, however the first thing that I need to get started is obviously a plan, and then a basic web page and a timing mechanism:

Handwritten plan for game
A basic sketch of the game plan.

In order to have the game playing itself, the main facet of an idle game, I needed the basic resource, Slaves, to automatically generate. This was accomplished with the ‘setInterval()’ function; additionally, I knew in the future I would want to modify how often this functioned, so wrote the following code:

var tickLength = 2000;
var slaveMultiplier = 1;
var slaves = 0;

function timer() {
slaves += (1*slaveMultiplier);
}

setInterval(timer,tickLength);

Adding Workers
Another feature then is to add the workers, which are used by the game to generate other resources, in this case ‘Scribes’ which can generate a second resource for the game: gold.

As part of this cycle, the plan is for the ‘Thoth’ chain (Thoth is the god of scribes/writing), is to have Scribes produce gold, Scribe Schools produce Scribes, and Libraries produce Scribe Schools.

Check out the sample page on CodePen.io to see where we are up to with the project so far:

See the Pen Pharaoh Idle – Step 1 by Jon McCallum (@playwithbear) on CodePen.0

Next steps (for part two):

  • Complete ‘Thoth’ development tree
  • Add automatic production to all workers.
  • Add a feature to generate sacred cats

Leave a Reply

Your email address will not be published. Required fields are marked *