A console based fan fiction RPG for The Walking Dead
Walkers is a rough fan-fiction console based RPG for The Walking Dead built in PHP and can be used for educational purposes on OOP and how to write clean and extensible code.
Requires PHP >= 7
Clone the repository and install the dependencies
composer installRunning the tests
./vendor/bin/phpunit testsRun the below command to start the game and then follow the steps stated below
php index.phpOn the first screen, player will be presented with the option to choose player
For the current release, each of the players have different healths. It was planned to give different abilities to each of the players (as you might be able to guess from the player class names i.e. GunnerRick, NinjaMichone, RunnerGlenn etc) but was plucked out of this release.
After choosing the player of your liking; the game begins
On the top, player is shown a not-so-uplifting message and then the HUD showing the current progress including experience, health and the level that the player is on. Then the player is asked to chose a door, where some of doors are empty and some of them have randomly placed walkers in them.
If the chosen door had walker in it, Walker gets to grab a bite of player while decreasing the health depending upon the walker. Player is returned back to same level with the same choice. Walker are shuffled again in different doors
If the chosen door was empty, player is rewarded with experience and is advanced to next level
The process keeps repeating unless, one of the below happens
Player chooses to save game and exit.
In which case, player will be asked if they want to resume the game or start a new game when the game is run the next time.
Game data is stored in
/storage/game-data.wdin encrypted-but-not-so-super-encrypted manner.
If the user chooses to restore game; it will begin from the last state (i.e. same level, health and experience). If not, it will begin from the first level.
Player chooses to exit game.
Player gets bitten by zombies again and again to the point that health becomes zero.
Final level is reached.
/configdirectory in the root contains any configuration and map files./srcis where all the magic happens/src/Consolecontains the contracts and implementations for console component to be used for logging and getting inputs. Currently having the implementation for Symfony's console component/src/ExceptionsAny exceptions to be thrown/src/Playerhas the contracts and implementations forPlayer. Also houses sample implementations for some Walking Dead Characters/src/Walkerhouses the contracts and implementation forWalkershaving sample implementation for some walkers./src/Storagehas everything relevant to storage. Currently there is JSON file storage support./src/Game.phphouses the game loop and acts as the controller for game./src/Map.phphas all the map specific details./src/Runner.phpRunner (A symfony command) that initiates the game loop./storagecontains any storage related data/testsof-course contain the test cases./index.phpis the file that bootstraps the game
- Adding or modifying levels Head to the map file at
config/map.phpand follow the instructions at the top to add new level or modify the existing levels. To add a new level all you have to do is add it to thelevelsarray in the map. A sample level may look like below: For further details. Also please check the docs inconfig/map.php.
[
'doorCount' => 3, // Doors on this level
'players' => [ // Array of allowed players (if first level) or players to be unlocked (on any other levels [TODO])
'Rick - The Father' => GunnerRick::class,
'Carl - The Kid' => KidCarl::class,
],
'walkers' => [ // Array of walkers that will be put in random doors
OneLegged::class,
],
'experiencePoints' => 10, // Experience points added on successful completion of level
],- Changing the Console component For now it relies upon the Symfony's console component. In order to extend, all you have to do is just implement the interface
KamranAhmed\Walkers\Console\Interfaces\ConsoleInterfaceand pass the instance of it while initializing Game. - Adding New Players You can introduce new players in the game just by implementing the
KamranAhmed\Walkers\Player\Interfaces\Playerinterface. You might want to extend theKamranAhmed\Walkers\Player\Abstracts\BasePlayerclass for some basic functionality. - Changing Storage Method Currently there is
JsonStoragebut you can easily replace it with database or anything else by implementing\KamranAhmed\Walkers\Storage\Interfaces\GameStorageand injecting that while initializing the game. - Adding New Walkers You can add new walkers by implementing the
\KamranAhmed\Walkers\Walker\Interfaces\Walkerinterface and start using them. Plus, if you would want to modify the bite behavior, just override theeatmethod in the base walker class and implement your own in the walker.
MIT © Kamran Ahmed









