Repository navigation
Show players' parties to each other, keep shared-world saves, and tire parties more slowly - #54
Merged
Merged
Conversation
Every account saves into one world file, but a session reads the world rows once, when it starts, and each save wrote its whole copy of them back. A save undid what other sessions had saved in the meantime: a mission another party completed was no longer completed, and when two players started a new world together, each session placed the NPCs and the later save won, while the other player kept meeting NPCs where the world no longer had them. A save now merges the world rows. Completed missions only grow, and an NPC keeps the place the first save gave it. The save hands the merged world back, and the session plays on in it, so the session start and every save command pick up what other players saved. The clock was a world row too, so logging in put a party at whatever hour the last player to save had reached. Each party keeps its own day, hour and minute now. A party saved while the world kept one clock starts from that clock.
Players on one server share a world but never met in it. Now a party
in the wilderness sees the other players' parties near it, each as a
horse in its own color on the square where it stands.
How far a party sees is a game rule, the new realm { partySight }
formula, which can use the hour of the party's day. Rylween's parties
see three squares, and one square at night:
formula(Formulas.partySight) {
value = whenValue(hour lt 6, 1, 3)
}
Without the formula parties never see each other. The runtime systems
schema is 15.
The runtime tells its host where the party is through a new
RuntimePresencePort whenever that changes: the map, the square,
whether the party is out in the wilderness, and its sight. Evaluating
sight never draws from the party's random numbers, so games play out
as before.
The bitmap server keeps every connected party in one registry:
- A party sees another when both are in the wilderness of one map and
the other is within its sight in any direction, diagonals included.
Sight is the seeing party's own, so at night one party can see
another that doesn't see it.
- A party in a town, dungeon or castle, or a player on the title
screen, is neither seen nor sees.
- Parties don't block each other, so any number can share a square.
- Players online together get different colors while the eight last.
- Each browser is sent the parties its player sees whenever that list
changes, sorted by square and then name, so a crowded square is drawn
the same way every time. A slow browser holds up only its own
messages, and a session that outlives its socket can't move the
party of the account's next session.
The browser draws a party alone on a square full size. Beside the
player's own horse, or with company, each is drawn small in a corner,
and when more than three share a square, the third corner counts the
rest ("+2"). The 3D wilderness view doesn't show other parties yet.
A party got tired after 14 moves, which players found too soon. Every
move or pass costs a rested hour, and a camp, an inn bed or a new party
gave 14. They give 21 now, and the later stages of tiredness come half
as late again too:
before now
tired 0 0
exhausted -4 -6
weak -8 -12
faint < -8 < -12
A camp still needs the party to be tired, and the test scenarios keep
their own rested hours.
The bitmap web runtime builds its distribution with its own installRuntimeBitmapWeb task, so the usual ./gradlew :runtime-bitmap-web:installDist failed with "task not found". installDist is now an alias for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Players on one server share a world. With this change, their saves stop undoing each other, and they can see each other's parties in the wilderness. Parties also tire half as late, and
installDistworks for the bitmap web runtime. One commit per step.Saves keep what other sessions saved
A session reads the world rows of
world.rsaveonce, when it starts. Until now, every save wrote that copy back whole:A save now merges the world rows. Completed missions only grow, and an NPC keeps the place the first save gave it. The save hands the merged world back, so the session start and every save command pick up what other players saved.
Each party keeps its own day, hour and minute. A party saved while the world had one clock starts from that clock.
Parties see each other
realm { partySight }formula, which can use the party'shour. Rylween's parties see 3 squares by day and 1 at night (hours 0–5). Without the formula, parties never see each other.RuntimePresencePortwhenever they change. Working out sight never draws from the party's random numbers, so games play out as before.{"type":"parties"}message whenever the list of parties its player sees changes.What is seen, and how it is drawn:
The 3D wilderness view doesn't show other parties yet. The runtime systems schema is 15, so the server needs a redeploy.
Parties tire half as late again
A party got tired after 14 moves. A camp, an inn bed and a new party now give 21 rested hours, and the later stages come half as late again too:
The test scenarios keep their own rested hours.
installDist./gradlew :runtime-bitmap-web:installDistis an alias forinstallRuntimeBitmapWeb, the project's default distribution.Tests
TownServiceHoursTestset the world's clock. It now sets the party's../gradlew check --rerun-tasks --no-build-cachepasses: 257 tests, 0 failures, 0 skipped.ktlintCheckpasses, andinstallDistruns with the configuration cache.Not checked: the build has not been deployed, and each commit was not built on its own; the head was.