michaeljb / 18xx.games Goto Github PK
View Code? Open in Web Editor NEWThis project forked from tobymao/18xx
License: Other
This project forked from tobymao/18xx
License: Other
Enter a pre move mode, stop receiving other updates; enter in the moves for your corporations
submit like an auto action that triggers once it’s that corp’s turn
From slack:
Sometimes the default orientations of new track tiles in 1846 is annoying, it would be slightly more convenient if the Indianapolis tile the Big4 lays always defaulted to point to Terre Haute for instance. Or the gentle curve at C13 defaulting to point SE rather than NE.... although probably not worth the code for the special cases 😕
Maybe "preferred" rotation for a given game => hex => tile could be cached in localStorage and offered as the first option. Probably would make most sense to limit to yellow tiles. If a different rotation is chosen, that should update the cached value.
do a request for "maintenance.txt" or something, if it's there, show a yellow banner with a little boilerplate text plus the contents of the file; this will let users know when there's possible downtime for a few minutes
alpha blockers:
4+3
trains had been bought, in hotseat they did not rust the 2'sbeta blockers:
enhancements:
between the time one action is finished processing, and the next one starts processing, most of the game state should be stable. in steps, actions()
gets called many times for many entities, perhaps those functions could be cached once the available actions are computed once?
for example, here's console output showing the BuyTrain step computing the same result of available actions 17 times for a single action
i.e., move 18 Los Angeles to where it would be if it were "18LosAngeles"
pass
actionsrender a small graphic showing the current round in whatever the cycle is
Currently we show “operating round 1.1 (of 2)” but then in the SR it’s not necessarily clear how many ORs there will be
Also might be useful to always show the current game phase, info about the currently available train, and info about whatever train comes after that
@game.game_error
Round::Base#process_action
should confirm active_entities.include?(action.entity)
(when done, can clean this up from 1846 assign and 1889 special track)pass in a lambda or something so that when .abilities()
is called, the Game object can more precisely determine what "time" it is and what abilities are valid--will be very useful for ruling out abilities that should not be used
rake
tasks
password
When a hotseat game breaks, it vomits all over the home page, would be nice if we could keep the error to the game card
As a test, could try renaming 1836Jr30 to 1836Jr-30
style log actions for the latest action differently? maybe that only helps the active player; other players would want all log messages they haven't seen yet to be separate somehow
Game.load_from_json
- take a path to json file, json string, or parsed json hashGame.load_from_db
- take a db Game
model@exception
; allows for better inspection of failed gameI've only tested hotseat, but I assume this would crash the server if used in a multi-player game
status: finished
and a pin, possibly over X days oldmake the "core" file smaller and quicker to load; only load the titles as needed
pinned bundles would probably need to include everything, so a specific rake command or something to create the pinned bundle to go along with this would be ideal
all (or at least almost all) the fixture games copied into the game specs have a result key; there's no real reason to repeat that info in the game spec file; just dropping in the json should automagically add a test for it
If games could be pinned before any migration at all happens, and then after the migration is attempted, they're either up-to-date or pinned, there would be less downtime for players.
To make it easy to track, this would need to be a new key in the settings
, would be best to avoid using pin
for this.
So the new flow could be something like this:
migration_pin
for all active games that will be subject to migration (this could be games from all titles, titles known to be affected by the new code, or even the specific list of games known to be affected--this option is prone to missing games as the general method for finding such games involves using a db backup and new games can keep happening)migration_pin
migration_pin
migration_pin
to pin
when loading up just the home page from a fresh setup, a bunch of game engine code is compiled unnecessarily
seems like clear_graph_for
should only clear the graph for one corporation, but it calls clear
and blows all of the graphs away
I think graph clearing could be improved and then the graph would be cleared less aggressively:
any?
w/o a block with !empty?
.type
a lot of actions have some validation that needs to happen--for many things this is in the interface, but for a lot it's also in the engine, before or after processing the action; if we could isolate those actions into methods like prevalidate
and postvalidate
, we could skip those methods when loading--basically, while "loading", assume all the actions are valid, and only validate actions while actually adding them to the game
this might require #11, since there is some validation-type stuff needed in order to determine which actions are available, so this approach could mess with the available actions
lots of stuff like looking through lists of stops or all the hexes on the map or all the tiles in the game to find/delete/etc the match in O(N) time, should do some profiling and see if using more Hashes helps performance
from https://18xxgames.slack.com/archives/C012K0CNY5C/p1676752236973439
you could add something like this...
describe '1850' do
describe 'your_fixture_id_here' do
it 'does something' do
game = game_at_action(game_file, last_working_action_here)
require 'pry-byebug'; binding.pry
puts "some more code here so the breakpoint from binding.pry has a stopping point before the test ends"
end
end
end
...to https://github.com/tobymao/18xx/blob/master/spec/game_state_spec.rb , run docker-compose exec rack bundle exec rspec -e "does something"
and that should give you a debugger console where you can inspect game.
if you want to debug further into the action, you can construct the action hash (example), then call game.process_action; while in the debugger console you should be able to set breakpoints elsewhere in the code https://github.com/deivid-rodriguez/pry-byebug#breakpoints
Opal
cop to enforce any practices that produce better JS
!collection.empty?
instead of collection.any? {}
index
over find_index
, size
over length
, etctime
instead of when
(when
is a ruby keyword)uses
instead of count
(.count
is a method on Arrays)Discourage players from thinking they should be able to just undo turns however they want
Complicating considerations:
local branch 1868WY
has the full game implemented, and commits need to be moved over to the mainline in PRs, one batch at a time.
Now that I've done the first PR, I will no longer update the local branch by rebasing, but by merging, so I'll use this list to keep track of what commits have not been added. rubocop
commits are already checked off in advance, as any PR will need rubocop passing before merged.
21fc8c515
fix train countseee111176
fix RCL's home6c11efcfd
fix ghost town tile names0e6114bf4
gray C tile9d884d603
whitespace fix4e762dd17
change order of TILE_GROUPS for more sensible ordering on tile page2dac09607
tile renaming: 5b/B -> 51b/B, drop "Y" from yellow boom tiles38387482e
remove optional rules, just make CM pay a base of $10cc6de1f7e
debug: show number of tiles "physically" used12b15a762
new boom tile track progression - 2/3/4/5 paths instead of 2/4/5/5d43967ea4
move Rapid City and Black Hills51a033878
P2 keeps its revenue when bought in0133a9d46
add optional rule for Credit Mobilier to pay $10 instead of $203a5380f3b
remove phase 6 coal DTs when phase 8 happens9b965f1c3
more image_optim for SVGs04588e1af
fix borders for hex J6b03a2ed86
rubocopdfd10c19e
fix issuing shares, enforce phase limit across whole OR, not just per-saleac508f202
CM - stop getting after golden spike, add bonus for Ogden mountains15f8f2666
fix coal DTs acting preprintedc59174779
stop getting CM bonus at phase 5182b31a1f
optional rule to randomly remove companies instead of choosing for P3/P47cd8c850c
limit share issuing by phase number89fac46b6
fix timing for P7 Pure Oil Campb0345361d
add 'async' optional rule66e110e37
P3a/P3b - don't create temp second tokene53b11a8d
render choices on separate line from choice_name60c7d9c3c
light up both Billings hexes if one is lit up [do after other golden spike stuff]e975c0c6f
fix centennial revenueb0ea0c553
render boomcity revenue with current in white, others in graycc1220c16
Auction - help text for choosing Developer/Surveyor1fef0416e
Credit Mobilier fix 0 payout bug9cde42b90
UP double share - fix buyabilitiy and capitilzation when exchanged before phase 52144d175f
Credit Mobilier WIP4f6c06df8
UP double share - protect the double share when presidency dumpedb57c10136
UP double share450d23168
entities: better descriptions for P3 and P4d1532ad79
make boomtown/boomcity tiles properly double-sided (TODO: generalize w/ 18Mag?)8409d7c69
manually close private companiesed9f3d200
P6 "Big Boy" [+1+1] token13bda316d
double-headed trains fixup62ac83cbe
P8 LHP to 2+1 train06e2beec8
P7 Pure Oil Camp41d0709d3
rubocopd25ac0dd5
fix ghost towns -- blank ghost town is upgradeable0b477c737
P3b - Buffalo Bill's Bonanza Oilac77c0498
fix capitalization for UP share from P9ead100181
fix trainsec6d77093
delete putsfbdc4b203
fix busting to ghost townsa18535f70
rubocop400678628
rubocopec7d23d60
WIP on endgame - current hotseat is testing trigger by export377a7e389
rubocop -Ad177b76fe
WIP - DPR's homed6f52031e
WIP fewer trains to quickly test phase 55e810e7b3
fix full cap eventd8f2afa3d
WIP on DPR's home tokene930cffc7
on par, LNP and OSL get their home green tile for free6bf5f79f2
fix OSL home coordinates59cb8c91b
uranium boom and bust36be10999
BUST fixes7755a5f6d
wind river canyon grey tile8bc32a696
remove logic for handling double boom cities1ae9c4c35
update coal company logo216f6dc3c
add oil companiesfb0e095ab
skip double-heading if no available route1ca505dd5
add names for player-owned coal companies3c0a343fb
fix removing old coal DTs, remove unused ones every phase1f3873b59
P3c - $20 discount for placing DTsd2be52ca3
only RCL may run routes to its home purple hexe5c1a7479
P3a Union Pacific Coal99214d280
fix coal token setup/placementbda01be55
fix available hex check for development tokense7c0ad680
DT WIP - use squares for DTs4e835cf5b
DT WIP - fix showing placed DTsb92f7dce8
DT WIP - fix where DTs may be placed49fd7a22b
smaller cow skull file size309123ab3
map: uranium icons54ddddfef
new icons for golden spike stuff8aca1f1e4
WIP on golden spike and northern spike - see msg body for TODO8410ba9a8
map: golden/northern spike revenues, some missing offboard stubs4cf7c6b1a
route_distance_str for C+t trainsedde608fe
double-headed trains1803e1240
EMR and bankruptcy378cd3811
player selling pre-operational shares gets the new price79f62897d
issue/redeem shares7e49997e5
private company certs don't count toward end game valuebd58862bf
fix +trains, allow first number to count townsbbb7684a3
fix map, label "C" for Casper7d55f1756
double and triple jumpsad146ec19
building overpass track costs $2012d0e0af0
priority orderd6de0e248
if sold out at end of SR and at top of market, move down and rightae9b20943
Walden is a city that cannot be tokened80383a619
allow arbitrary hex-colors for multi-part revenues; use for boom revenuef8c82f2b2
East-West bonuses7b3087953
P4c - $60 discount on one tile lay per OR3ecd13367
P4b discount on every tile lay702ec5092
P2 Yellowstone bonus331bec6b8
fix P4a/P5 tile layingd5f8bbaae
P10 can exchange for UP 20% sharecc19644df
yellow/green/brown pars612a7c947
fix initial auctionf6f26ea7f
update player count804a9bcdc
update corporations - delete the removed ones485ce4662
update tiles4ff2cf6ef
update train costs844e17fda
update texts for private companies, delete removed companies49e2844b6
new stock market61a099755
new map and home locationsI wonder if it would be feasible to change the engine to automatically fill in a pass when a step hits an error. Maybe a new error type for the specific case where a step to process the current action can't be found, then pass actions are created and processed until a step can be found for the current action.
Example: in 1846, buying the meat packing company in at end of turn and the turn being passed to the next corporation before the meat packing token could be placed.
tobymao#1637 still uses the bit of code I originally wrote for G1846::BuySellParShares#process_buy_shares
where the bundle is modified to be a 10% bundle in the midst of processing; would be better if only the partial bundle could be exposed as buyable in the first place; mutating the bundle during processing the action feels real bad.
Apart from the overlaps, the track appearance hasn’t changed since launch. It is a little skinnier than physical game tiles, and the white outline would help make it more visible against dark tiles.
A layered approach would be needed, and we’d need to investigate how much rendering is impacted
1 all white outlines
2 all “under” track
3 white outlines for “over” track
4 “over” track
tile manifest page could show manifest closer to back of rulebooks, where upgrades are shown without clicking
Tray style manifest visible on game page, where clicking a tile highlights hexes where it could be laid, and clicking one of those hexes lays it
Could perhaps restrict this in Actionable?
some notable exceptions to actor == player
Maybe add a programmed action to set up automatically converting at the right moment? tobymao#8396
kind of like assets spec - take a fixture json, but have tests that can spot at any action and inspect the game state; this could probably replace a lot of the other tests
Explain why steps are skipped. From a slack discussion:
requester: now if you could make the “skips” code in general tell you WHY it’s skipping stuff, that would be awesomer
me: yeah, in "general" it's just an indication that the engine found no legal actions for that Step, explaining those would have to be a case-by-case basis
I guess there's a few easy ones[23:50] UP skips run routes
could become
[23:50] UP skips run routes (no train)
requester: yeah, and tokens when you’re out
it’s the weird cases which are likely game-specific where I end up having to guess and dig into rules where it really matters the most
“why won’t it let me X?” shouldn’t be ambiguous when X is a normal action
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.