West of House
You are standing in an open field west of a white house, with a boarded front door.
There is a small mailbox here.
>open mailbox
Opening the small mailbox reveals a leaflet.
>read leaflet
(Taken)
"WELCOME TO ZORK!
This is the beginning of the famous text adventure
ZORK1.
ABAPventure
Due to the limited graphical possibilities of the SAPGUI and ABAP I'm always in the search of games that can be adapted in ABAP.
I thought that an ancient text adventure might fit the graphical capabilities of SAP. Luckily,
Huw just made a youtube programming course of
how to program a text adventure. Thanks Huw, for the inspiration! The examples are in Java and C# but Huw explains how to build the classes and functions so it was quite easy to adapt everything to ABAP.
I use the programming of games to sharpen my ABAP skills. I can define my own data model and most functions and processes are kind self-explanatory. Everyone knows what to expect; there is no need to know about special SAP-modules, fields or functions. This makes designing and understanding a lot easier.
Hopefully such projects will help others to understand programming concepts better.
If you followed some of my blog posts, you know, that all my projects need an impressive name and fancy logo. So I came up with
AXAGE - an Abap teXt Adventure Game Engine
The idea of the project is, to have a game engine with all necessary commands and functions so that you can build your own quests.
You might spell this like AXE AGE...
image credits to
pixabay.
What is a text adventure?
The idea of a text adventure is to navigate through rooms and places and solve puzzles using the persons you meet on your journey and the things you find.
You interact with a simple command line (hello
dj.adams.sap 😉 ) with the game engine. You can look around and use simple commands to inspect things and interact with the environment.
You can go in different directions to move in the area and enter other rooms and places. On your journey you will find different
things that will help you solving the quest. Some things can be opened. Maybe the can only be opened with a special thing that you have to find. You will have to take these things and add them to your
inventory.
Current Status of AXAGE
The game engine is in work. And there is still some work to do and some problems to solve. this is the current status which is enough to build a small adventure game.
Parser
you can use two-word commands to interact with the game:
- WEST - go through the door on the west
- TAKE BOX - Take the box that is in the room
- OPEN BOX - Open the box
Two-word commands limit the interaction with the interpreter very strongly. Therefore the next step should be to implement four-word sentences to have more options to interact:
- OPEN BOX WITH KNIFE
- PUSH lars.hvam TO GITHUB
- GIVE MOTIVATION TO c436ae948d684935a91fce8b976e5aa7
- ATTACK RAT WITH SWORD
Rooms
The world consists of
rooms. Rooms can have exits on the north, east, south or west. You can go in a direction if the room has a door in this direction. You will reach the room next door.
You can also find things in a room which you can take (maybe). You can also drop things into the current room. So far you can take as many things you find. There is no limitation of weight or quantity. The inventory limitation will be one of the next tasks.
Things
Things are objects that you can interact with and which are standing or lying in the rooms. Things can be
takeable and/ or
openable. If they are openable you can define what thing will be needed to open the thing.
Thinglist
Things are organized in
thinglists. An openable thing might also have a thinglist. This thinglist holds the things that are needed to open the box. Mostly you might need one thing to open a box (KNIFE) but you also might need GOLDEN KEY and PURPLE KEY to open a chest.
Actors
Actors are persons that might be in a room. So far the can give you a hint if you ASK the person. You can only ask persons that are in the same room as you are.
Actors should also have a thinglist to hold things that they can give to you or you can give to them. So far this does not work yet.
Demo Adventure - The Cursed RfC
Your task in this simple demo adventure is, to find the Request for change and deliver it to the developers.
ABAPventure
The map consists of three rooms:
- the entrance
- the developers room
- the consultant office
There are two actors but they still have no functionality, because you need to have four-word commands to interact with people (GIVE RFC TO
marco.matjes , TAKE PASSWORD FROM
keller.m , ASK
jelena.perfiljeva2 FOR KEYS).
Join
Feel free to join the
project to add more features:
- implement a four-word parser
- separate game class and GUI
- extract parser engine into a separate parser class
- let actors help you giving and taking things
- implement other helpful functions
- create a UI5 GUI
- Create funny or scary adventures with this engine
Maybe we will encounter some of
bfeeb8ed7fa64a7d95efc21f74a8c135 three-eyed Monsters in a dark cave to ask them for cool books like
ABAP To The Future,
Clean ABAP or
ABAP Kochbuch.
Have fun coding and a happy weekend
Enno
/2022-05-14: added unit tests