Textworld : ASCII turnbased game
January 9, 2014
Posted by on
I grabbed a copy of the libjcsi library and decided to make a turn base ascii-style game. The game would have simple concepts:
- There would be a world to explore.
- There would be FOW.
- There would be weapons to pick up.
- There would be a hunger and thirst factor and health.
- An axe would cut trees and hammer go through walls.
- There would be zombies.
- Limited AI. If they see you, they attack. If you move out of sight, they walk to last seen position.
- If you fire a loud weapon, or fell a tree or break through a wall, it would be noisy and the zombies in the area would walk to that spot.
- There should be different areas. (City, Water, Road, Parks/Woods, Cemetery).
- There should be an inventory that allows weapons/food/wood/bricks to be picked up/stacked/discarded
So here is what I quickly duct taped together.
Game loads a mapfile and generates areas per pixel. So the map file below will generate an grid area of 100×100 screens.
Each pixel represents a screen area (mapObject) that could be a building, road area, forest etc.
The gameplay area is 75×20 “ascii characters” wide and high. So the game screen looks something like this (area not fully explored):
A screen (map area) represents 1 pixel on the map posted above.
You’ll notice health, hunger and thirst in top right.
Inventory bar at bottom.
Starting the game gives you some minimal options. The game saves on normal exit and that save is the continue point. There were no options added and it was on my long todo list. but all the options were configurable in property files.
House being explored:
Somethings I still wanted to change:
Too many buttons… having an ascii type world, there is not sense of the direction the characters are looking in. So I have multiple keys to move and shoot in a specified direction.
Then there are also a key to interact on inventory items that does not require a direction. i.e. food, drink.
Lastly, the library does not allow access to the number keys. So the only way to move through the inventory is to scroll with X and Z…I don’t like this at all.
I’ve decided to stop development as I did most of the things I set out to do. It was a fun little development. The code is all downloadable here:
A note to the adventurous: The code was done quickly and very dirty. If you were looking for proper structures and comments, then probably best you not venture in the abyss which is this code set. That also mean it is pretty simple code since I had to understand what I was coding.