ennowulff / axage Goto Github PK
View Code? Open in Web Editor NEWABAP teXt Adventure Game Engine
License: Apache License 2.0
ABAP teXt Adventure Game Engine
License: Apache License 2.0
I asked ChatGPT to create a json file for the following adventure:
_i have created a text adventure engine where rooms, things and actorss can interact with each other. a room can have things and actors and exits to the north, east, south and west. an actor can hold things and give it to the protagonist. a thing can be a treasure or a tool to open things (e.g. a knife, an axe or a stone) or hide a treasure (e.g. a box or or a chest). a treasure can be something like gold, wisdom, a ring, money, a statue or something similar.
create a json file which describes the following situation or task:
a poor knight needs to find a dragon in a dungeon, fight him and bring the golden ring, the dragon protects to a maiden_
{
"rooms": [
{
"id": 1,
"name": "Entrance Hall",
"description": "You are standing in the entrance hall of the dungeon. The air is thick with the smell of damp stone and mildew. The walls are rough-hewn and the floor is covered in dust and debris.",
"exits": [
{
"direction": "north",
"room_id": 2
}
],
"things": [],
"actors": []
},
{
"id": 2,
"name": "Dragon's Lair",
"description": "You have entered the dragon's lair. The room is filled with the heat of the dragon's breath, and the walls are scorched black. In the center of the room, the dragon is sleeping on a pile of treasure.",
"exits": [],
"things": [
{
"id": 1,
"name": "Golden Ring",
"description": "A shiny golden ring, set with a large gemstone.",
"treasure": true,
"hidden": false
}
],
"actors": [
{
"id": 1,
"name": "Dragon",
"description": "A fearsome dragon, with scales as black as coal and eyes that gleam like diamonds. It is fast asleep on a pile of treasure.",
"holdable_things": [],
"gives": {
"thing_id": 1,
"to_actor_id": 2
}
},
{
"id": 2,
"name": "Poor Knight",
"description": "A ragged and tired-looking knight, armed only with a rusty sword and shield.",
"holdable_things": [
{
"id": 2,
"name": "Rusty Sword",
"description": "An old and worn sword, with a rusty blade and a frayed hilt.",
"treasure": false,
"hidden": false
},
{
"id": 3,
"name": "Shield",
"description": "A battered and dented shield, made of wood and metal.",
"treasure": false,
"hidden": false
}
],
"gives": {
"thing_id": 1,
"to_actor_id": 3
}
},
{
"id": 3,
"name": "Maiden",
"description": "A beautiful maiden, with long golden hair and a kind face. She is waiting for you outside the dungeon.",
"holdable_things": [],
"gives": {}
}
]
}
]
}
In this example, there are two rooms: the entrance hall and the dragon's lair. The dragon's lair contains the golden ring that the poor knight needs to retrieve. The dragon is sleeping on a pile of treasure and must be fought in order to obtain the ring. The poor knight has a rusty sword and shield to use in the fight. Once the poor knight has the golden ring, they must bring it to the maiden waiting outside the dungeon.
Using the new version in the Pull Request (that has ABAP Cloud Class based approach and serializable instances), I've created a stateless, UI5 version of the of the game interface using the other open-source project ABAP2UI5. I didn't want to do a pull request directly here so as not to introduce a direct, hard dependency to ABAP2UI5.
Testing @jung-thomas axage_example on HANA1909 ( shhh, don't tell SAP ;) )
axage and abap2ui5 are up to date.
Sequence:
N, execute
E, execute
dump in ZCL_AXAGE_ENGINE, method CMD_LOOK
player->location is initial
and this fails:
IF player->location->things
This may or may not have something to do with the fact that N was not an allowable exit in the first move ;)
At the first step, in method INTERPRETE, this comparison fails:
IF player->location->north = zcl_axage_room=>no_exit.
During initialization of "entrance", N is correctly marked "no exit" but the objects are different:
CLASS zcl_axage_demo1 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
METHODS constructor.
PROTECTED SECTION.
PRIVATE SECTION.
DATA bill_developer TYPE REF TO zcl_axage_actor.
DATA mark_consultant TYPE REF TO zcl_axage_actor.
DATA engine TYPE REF TO zcl_axage_engine.
METHODS interprete
IMPORTING
command TYPE clike
out TYPE REF TO if_oo_adt_classrun_out. "<===
ENDCLASS.
@jung-thomas is it only available in a cloud system?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.