Started from the bottom... and well we're here

Category: Javascript (page 1 of 1)

Docker | Screeps Private Server

Project Website

Screeps is a game that comes and goes out of my life, it is some of the most fun I have while also driving me insane more than any hobby has a right to do.

You surely remember Age of Empires, Rise of Nations, Galactic Battleground. The classics of RTS, but sometimes the units were just incredibly stupid. Opting to take the long way around the lake instead of the obvious shortcut between trees!

Turns out the developers of Screeps felt the same way. Screeps at it’s core is an RTS with you in control of the units actions. It relies on Javascript code to control small entities called Creeps. They are your units, a harvester, a miner, a fighter… really whatever you can cobble together in code, it can do.

Read more

JS | ASCII Text Display

While attempting to format my console output in hackmud, I found myself spending entirely too long formatting, copy, and pasting ASCII letters directly into a messy echo. I decided to write a script to display ASCII Text dynamically, by supplying an array of ASCII text broken down by row along with an display string.

Initially I attempted to concat strings whole letters at a time and found it too sloppy of a process and ultimately meant a messy output with little flexibility. I settled on taking the ASCII font a row at a time. Utilizing .indexOf() I compared the string letter against a string containing the alphabet and used that value to display the ASCII font. I looped through the display string each row and concated a row together before moving onto the next row. Finally displaying the rows separated by a new line character. I wanted the script to be more flexible allowing for variable width and height letters, so I included 2 parameters defining those dimensions.

I had originally wrote this in a golf friendly way. I have expanded the code slightly for readability, commented it and put it into a JSFiddle for you to explore and test.