Skip to content

Commit

Permalink
Copied in the game files from brisberg/twine-games
Browse files Browse the repository at this point in the history
  • Loading branch information
brisberg committed Nov 9, 2020
1 parent 6eec8c9 commit eafad99
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"github_username": "brisberg",
"title": "Journey",
"repo_slug": "journey",
"description": "Journey across the sea and overcome challenges along the way.",
"description": "Travel the high seas, overcoming challenges in an Oregon Trail inspired game.",
"_template": "https://github.com/brisberg/cruft-spindle-project/"
}
},
"directory": null
}
}
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Journey

Journey across the sea and overcome challenges along the way.
Travel the high seas, overcoming challenges in an Oregon Trail inspired game.

Twine 2.3.7\
Tweego 2.1.1\
SugarCube 2.31.1

### Features

- Mainly a test game to explore some mechanics of SugarCube
- Random series of event cards
- Item pick ups (keys)
- Startup, Footer passages
- Simple Google Analytics with Custom Events

### Tutorials
- None

## Toolchain

Expand Down
2 changes: 0 additions & 2 deletions header/header.html

This file was deleted.

33 changes: 33 additions & 0 deletions header/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Game Name key (for analytics)
window.GAME_NAME = 'journey';

// Setup Initial Static Data
setup = {
initialState: {
distance: 100,
hull: 20,
crew: 10,
fuel: 8,
},
events: [
'Calm Seas',
'Rough Seas',
'Storm',
'Old Shipwreck',
'Raft',
'Friendly Port',
],
hullMax: 20,
crewMax: 15,
fuelMax: 15,
};

// Setup custom functions
window.customPrint = () => {
return 'This is a custom print';
};

window.randomEvent = () => {
const index = Math.floor(Math.random() * setup.events.length);
return setup.events[index];
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "journey",
"version": "0.1.0",
"description": "Journey across the sea and overcome challenges along the way.",
"description": "Travel the high seas, overcoming challenges in an Oregon Trail inspired game.",
"scripts": {
"build": "yarn run spindle",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
9 changes: 9 additions & 0 deletions src/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
id: "journey"
version: "1.0.0"
title: "Journey"
description: "Travel the high seas, overcoming challenges in an Oregon Trail inspired game."
head:
- "shared/analytics/header/analytics.html"
deps:
- "games/journey"
- "shared/analytics/js"
60 changes: 60 additions & 0 deletions src/events.tw
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
:: Calm Seas
The seas are calm with a slight, salty southernly breeze. Your crew are in good spirits as they unfurl the \
sails and tend to the rigging.

You spot a flying fish leap from the water but it is too far to catch.


:: Rough Seas
<<set $fuel -= 1>>\
Strong winds whip the ocean up into a rage. Tall waves crash over the deck, as your crew hurries to secure \
supplies to the deck and lower the top sails.

Before your crew is finished, a large wave washes a crate of coal overboard.


:: Storm
<<set $crew -= 1>>\
A violent sea squal approaches rapidly from the north. Your crew rush to stow the sails and take the heavy \
supplies below deck to ride it out. Rain drenches your face as you try to keep the ship on course.

Above there is a brillient flash of lightning, followed imediatly by a deafening thunderclap. A crewmen on \
the rigging loses his footing on the rain slick beams and falls overboard.

"Man Overboard!" shouts the foreman, as several men try to throw him a line. However, he is quickly swept \
under by the rolling waves and disappears from sight.


:: Old Shipwreck
<<set $fuel += 4>>\
The Barrelman in the crows nest yells that he spotted a small vessle beached on a sandbar off the starboard side. \
You bring your ship around and send out a small rowboat to investigate.

Your men return saying the ship is abandoned and likely been there for several years. However, they recovered \
several crates of fuel in water-tight barrels so you count your blessing.


:: Raft
<<set $crew += 1>>\
The Barrelman in the crows nest yells that he spotted a small raft on the horizon just ahead. As your ship approach \
the raft you can make out the body of a man lying motionless across the bamboo raft.

Your crew hoists the man up, and to your surprise he appears to be alive! Baddly sunburned and dehydrated he \
can barely thank you before falling unconcious again.

You send him below decks to recover. A few days and warm meals later his vigor had returned and he pledges \
service to you for saving his life.


:: Friendly Port
<<set $hull += 5>>\
<<set $fuel += 5>>\
<<set $crew += 3>>\
"Land Ho!" shouts the Barrelman, pointing to a dark spot on the horizon ahead.

Your crew rejoices as you approach a small port town on this remote island. The port is friendly to the empire and \
your ship is welcomed to the docks. While your crew enjoys some much needed shore-leave, you set about requesting \
repairs and resupplies for your vessal.

The workmen work quickly to patch any holes and repair the rigging. Fresh barrels of fuel are brought aboard. Even \
a few young sailors looking for passage off the island signup to swell your ranks.
25 changes: 23 additions & 2 deletions src/main.tw
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,30 @@ Journey

:: StoryData
{
"ifid": "F76EC9DD-8B3B-43FE-A9F2-FA26005C9260",
"format": "SugarCube",
"format-version": "2.31.1"
"format-version": "2.31.1",
"start": "Start",
"zoom": 1
}

:: StoryInit
<<set $hull to setup.initialState.hull>>
<<set $crew to setup.initialState.crew>>
<<set $fuel to setup.initialState.fuel>>
<<set $distance to setup.initialState.distance>>

:: Start
Hello World from Twine on Spindle!
/* Only send Start event when story is restarted */
<<script>>pushEvent('Story', 'Start', '');<</script>>
<<goto Launch>>

:: PassageHeader
You are $distance leagues away from your destination.
----

:: PassageFooter
----
Ship Hull: $hull/<<print setup.hullMax>>
Crew: $crew/<<print setup.crewMax>> souls
Fuel: $fuel/<<print setup.fuelMax>>
111 changes: 111 additions & 0 deletions src/story.tw
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
:: Launch
Flags fly high, husbands and wives wave from the pier, and bells ring as your vessle, H.M.S Titus, \
leaves Port Royal on its maiden voyage.

Your ship is in tip-top shape and the crew is filled with joy and vigor.

The task ahead of you is a simple but important one: Voyage to Isla De'muerta and deliver much \
needed supplies and munitions to colony there.

<<set $event to "Calm Seas">>
[[Embark->Voyage]]


:: Voyage [nobr]
You are on your voyage!
<br>
<br>
<<include $event>>
<br>
<br>

<<if $distance === 10>>
<<set $distance -= 10>>
[[Onward!->Island]]
<<elseif $fuel <= 0>>
[[No Fuel]]
<<elseif $crew <= 0>>
[[No Crew]]
<<elseif $hull <= 0>>
[[No Hull]]
<<else>>
/* Update standard variables for each voyage step */
<<set $event to randomEvent()>>
<<set $fuel -= 1>>
<<set $distance -= 10>>
[[Onward!->Voyage]]
<</if>>


:: Try Again
Your Voyage ends here.
<<link "Try Again?">><<script>>UI.restart()<</script>><</link>>


:: No Fuel
Your engines chug to a stop as the last bits of coal are used up. You and your men look around \
at each other in despair as you realize you will likely starve or freeze before anyone can reach you.

<<script>>pushEvent('Story', 'Lose', 'No Fuel');<</script>>\
<<include "Try Again">>


:: No Crew
You stand alone, captain of a derelict ship. All of your crew have been swallowed by the Sea \
(or worse) and you are all that is left. It is impossible to run a ship this size alone. You \
keep things running as long as you can, but eventually your stamina gives out.

/* TODO: Add events here. (Hit a sandbar, sunk in a storm, pirates? etc) */\
Drifting aimlessly at the sea winds' whim, you eventually feel a rough thud as your ship runs in \
a long forgotten sandbar. The ship is beached permanently and it would take ten men to recover it.

You feel so very tired. As you drift off to a final slumber, you wonder if another captain will \
find your ship and make better use of your supplies.

<<script>>pushEvent('Story', 'Lose', 'No Crew');<</script>>\
<<include "Try Again">>


:: No Hull
Your ship creaks and groans under strain of holding itself together. Numerous gashes and \
splintered boards dot the lower decks and you have been taking on water for some time.

Finally the strain is too much and the aft section buckles, pulling the mast down with it.

"Abbandon ship!" you shout, though it may be too late. Your crew scrambles to lower the \
dingy and cram aboard. Some leaping to the water to swim for it.

However, they say a Captain must go down with his ship. You remain aboard, sipping wine \
as your crew rows into the distance and water slowly fills your cabin.

<<script>>pushEvent('Story', 'Lose', 'No Hull');<</script>>\
<<include "Try Again">>


:: Island
The sea is calm and the spies clear of clear of clouds. It is as if the sea knew how close \
you were to journey's end it rewarded you with a brisk southernly wind pushing you onward.

The Barrelman is the first to spot land on the horizon.

"Land Ho!", he shouts triumphantly.

Your navigator double checks his charts and confirms that you have at last arrived at your \
final destination. Your crew rejoices and breaks out into a merry sea shanty. You can finally \
relax and feel flush with relief as you stare at the steadily growing island on the horizon.

[[Dock at Isle De'muerta->Win]]


:: Win
You land at Isla De'muerta and are greeted by the Harbormaster. He shakes your hand with much \
enthusiasm, thanking you for your bravery and service to the Empire.

Porters begin to unload your ship of it's precious supplies and cargo.

You are treated to a find dinner in your honor by the Govenor of the island.

You and your crew enjoy yourself for a time, but soon you feel the sea calling to you again.

Will you set sail on another <<link "Voyage?">><<script>>UI.restart()<</script>><</link>>
<<script>>pushEvent('Story', 'Win', '');<</script>>

0 comments on commit eafad99

Please sign in to comment.