Skip to content

Latest commit

 

History

History
216 lines (190 loc) · 8.32 KB

README.md

File metadata and controls

216 lines (190 loc) · 8.32 KB

Wandering Journey

Small project made in Elm for the final grade in the module 'Deklarative Software Technologien' at Hochschule Flensburg

Game General View

How to play

A playable version can be accessed at https://mrhemanik.github.io/wandering-journey/

Brief Gameplay Description

Concept is inspired by the mobile game "Lapse: A Forgotten Future", though it plays completely differently than Lapse.

You have 5 resources to keep up: hunger, thirst, physical health, mental health, and money. if one of them (except money) reaches 0 you have lost. You are presented with a text prompt and the ability to choose either the left or right side. Choosing an option can add/remove resources, and items, plus it can unlock achievements. Text prompts and their choices are saved in “cards”, which can have alternating decisions based on your items. The cards that generate can also change, either via an event line (unlocking card from choice on the previous card) or by changing the location you are currently in.

The game has a defined ending, though it can be played endless to reach a high score if one wants to.

Setting / World Building

Wandering Journey plays in a medieval low-fantasy setting, so while magic does exist, the world is not based around it. The world has two mayor churches/orders. The church of Mutan, standing for power and the church of fortuna, standing for luck. Being a member of the church of Mutan can lead to an unwanted symbioses with an unknown shape shifting organism for as long as you're part of the Mutan Order. The world holds three different crystals, each colored differently

Assets

Images in /achievements, /backgrounds and /items are self-made, while the others are from various sources

Visuals

Starting Screen

Shows Resources, Location, Score, Information about the Card, Inventory, Buttons to open Controls/Achievement Starting Screen

Controls Window

Controls

Achievements Window

Achievements

Delete Confirmation Window

Delete Confirmation Window ####Card Window

Before Choice After Choice
Before Decision After Decision

Death Window

Death Window

Code-Specific Information

Custom Libraries

We use mdgriffith’s Elm-Ui for our browser UI, as it makes layouting and designing easier: https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/

Useful links

How to compile

Run the command: elm make src/Main.elm --optimize --output wanderingJourney.js to compile the elm code into javaScript.

How to run

There is a compiled version here. Else compile the game and run it on a (local) server. Just opening index.html doesn't work as CORS blocks access to local files, in our case our gameData like cards.

Data Types

Records

GameData

{ items : List Item, cards : List Card, startingCardIndexes : List Int, achievements : List Achievement }

Every preset data that gets loaded at init and does not change.

  • Is saved per .json and gets loaded from html via Elm Flag

Game

{ resources : Resources, allowedCardIndexes : List Int, activeItemsIndexes : List Int, currentCards : List Card, location : Location, card : Maybe Card, nextCard : Maybe Card, score : Int}

Everything that is game related and can change except choice and if a run is active.

ViewState

{ item : Maybe Item, showControls : Bool, showAchievements : Bool, showDeleteConfirmation : Bool, newAchievements : List Int, highlightedAchievements : List Int, selectedAchievement : Maybe Achievement, endGameText : String }

Saves everything variable for visualisation purposes only.

  • Usage cases are for example which extra window is open, what achievements are new or what item/achievement is selected.

Resources

{ hunger : Int, thirst : Int, physicalHealth : Int,mentalHealth: Int, money : Int }

Value from 0-100, except money which can go infinitely high.

  • Used as “health”.

Card

{ id : Int, possibleLocation : List Location, mainText : String, decisionLeft : Decision, decisionRight : Decision, flags : List CardFlag }

Card that is fundamental for gameplay.

  • Holds information about what decisions you must take and what happens when you do.
  • Gets loaded from JSON.

Decision

{ choiceText : String, pickedText : String, resourceChange : Resources, flags : List Flag }

Choice you can make, that has a text before and after you decide to take this option.

  • Resources get added/removed and Flags are getting processed when a decision is made.
  • Flags can alter variables in game, like changing what cards can be generated or what items you own

Item

{ id : Int, name : String, description : String }

Item that a player can own inside off a run.

  • Decisions can change according to what item(s) you own.
  • Gets loaded from JSON.

Achievement

{ id : Int, name : String, description : String }

A way to show progress.

  • Get either unlocked per flag on cards or at the end of the game via “Achievements.checkUnlock”.

Player

{ unlockedAchievements : List Int, highscore : Int }

Progress data.

  • Gets saved in and loaded from the local storage as JSON via Elm Port.

###Custom Types

Model

= GameOver GameData Game Player ViewState
| Running GameData Game Player (Maybe Choice) ViewState

Holds everything currently loaded (State).

  • In retrospect should’ve been a Record with ‘screen’ custom type as an attribute to make some code parts cleaner.

Msg

= Key Key
| NewCard Int
| GenerateNewCard
| LoadFollowUpCard
| ToggleItemDetails Int
| ShowControl
| ShowAchievement
| ShowDeleteConfirmation
| DeletePlayerData
| DeactivateAchievementHighlighting Int

Event that can happen to update when the user interacts with the browser interface.

  • uses the same functions as the key equivalents.

Location

= Desert
| Forest
| City
| None

To decide from which cards you draw.

  • Every location has a “switch to x location” card.

Flag

= AddItem Int
| RemoveItem Int
| AddCards (List Int)
| RemoveCards (List Int)
| ChangeLocation Location
| FollowUp Int
| UnlockAchievement Int
| TakeMoney Int
| EndGame String
| Unknown

Flags can be part of a decision and will be processed after a decision is made or are part of a card and will be processed when a card is generated

  • AddItem/RemoveItem/AddCards/RemoveCards: Adds/Removes an item/cards from the inventory/allowedCardsIndexes
  • ChangeLocation: Changes the location to the one specified
  • FollowUp: Instead of generating a new card, the card with the specified id will be loaded
  • UnlockAchievement: unlocks an achievement
  • TakeMoney: Takes money without showing the moneyLabel and without checking if you have enough. Used for thieves that steal as much as they can
  • EndGame : Ends the game with a custom message. Happens when going to next card to let them read the followUp before.

CardFlag

= ConditionalDecision Condition Bool Decision
| DefaultFlag Flag

CardFlags are an extension of flags that can only be used on cards, not decisions

  • ConditionalDecision: Replaces a decision if a condition is true. If there are multiple conditionalDecisions that can replace one decision, the last one will be taken

Condition

= OwnItem Int
| OwnAllItems (List Int)
| OwnXItems Int (List Int)
| Unknown

Consists of conditions that a conditionalDecision can have

Key

= ChoiceKey Choice
| Restart
| NumberKey Int
| Controls
| Achievements
| Delete
| Escape
| UnknownKey

Takes the keypad input and turns it into a Key Type for further evaluation

Choice

= Left
| Right

Used to state which decision was taken