GithubHelp home page GithubHelp logo

michaeljb / 18xx.games Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tobymao/18xx

0.0 0.0 0.0 37.8 MB

License: Other

Ruby 99.82% Dockerfile 0.01% Makefile 0.02% Shell 0.04% CSS 0.08% JavaScript 0.02%

18xx.games's People

Contributors

andrewzwicky avatar andypymont avatar benjaminxscott avatar crericha avatar daniel-sousa-me avatar dfannius avatar doubt72 avatar galatolol avatar jason-johnson avatar jenf avatar joeb989 avatar kelsin avatar magnusstjarnhild avatar michaeljb avatar ollybh avatar outsidepasser avatar perwestling avatar philcampeau avatar roseundy avatar ryandriskel avatar scottredracecar avatar thepackrat avatar tobymao avatar tysen avatar underhilllabs avatar vandamm avatar ventusignis avatar volker18xxdev avatar yzemaze avatar zwergenpunk avatar

Watchers

 avatar  avatar

18xx.games's Issues

Remember manually chosen rotation for tile placement in localStorage, use that as default in future

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.

site maintenance banner idea

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

pin stuff - deploy and cleanup

  • prod deploy script should send the new pin file to public/pinned/
  • there should be a rake task to show (and cleanup with confirmation) pins that are not used by any games in the database; it should never clean up the pin matching the current release

1868 Wyoming

alpha blockers:

  • Credit Mobilier
    • not paying for river at M7-M9
    • not paying for free tile lays from privates
  • Info page - the train displayed loses its variant once the first of its type is bought
    • probably related: cloned a game where two 4+3 trains had been bought, in hotseat they did not rust the 2's
  • fort problem: route to miles city is reporting 2 forts instead of 1
  • make fort icons small when dev cubes are there, and whenever tile is laid
  • check with John about double hitting fort--should it just be each train can hit a fort once?
  • foncier should only give bonus on initial tile lay, not upgrades

beta blockers:

  • if P11 holder has more than 40% of UP when phase 5 hits, P11 should close and the double share remains in UP's treasury, available for anyone to buy
  • DPR home token on charter does not show selected home location
  • DPR home after BUSTing out should be selected during OR turn; it skips tile laying if it can place the token; if there is nowhere to put the token but a single tile could be laid/upgraded anywhere on the board to give it a home, it must do so and then places its token
  • blocking on companies step when only player-owned companies are not for sale
    • More investigation needed, should already be filtering those out, see base step buy_company
  • RCL and FEMV can't build track directly (meaning no cities/towns between their purple offboard home and it) into Black Hills (this too easily cuts off other RRs from building there, given the available green tiles); this rule was possibly removed for Miles City, so confirm that it is desired
  • no east-to-east route running

enhancements:

  • better / generic interface for closing companies at any time
  • remove "free home green tile" ability after it is used

cache available actions

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

Screenshot from 2022-05-31 16-18-35

New feature - "auto endgame OR" or something - repeat OR actions for endgame acceleration

  • for each operating entity, track the actions it took in its last OR, key is some short ID for the step, value is array of actions taken in order (value needs to be full action, not shorthand, since this mostly benefits routes); probably skip saving any pass actions
  • give new option in UI to repeat the last actions taken for a particular company, and pass on all other actions
    • cancel if an action is attempted and failed (should rollback to start of operator's turn)
    • cancel if president changes
  • should reduce clicks needed in endgame

Round tracker graphic and other info

render 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

GameError changes

  • should always link to last active action, this can probably be done without calling @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)
  • should always show the action that led to this error (is this always possible?)

Train buying interface could use a lot of improvement

  • fewer clicks?
  • make it more obvious if shares must be issued / implications about issuing those shares
  • button to explicitly start selling player shares?
  • show all available trains, grey out/etc trains that may not be bought, for whatever reason
  • confirmation if buying train from another player

ability timing

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

Local QoL things

  • rake tasks
    • import game
    • set all users passwords to password
    • run validation
  • concurrency for game validation

highlight log actions from last action?

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 object creation improvements

  • Game.load_from_json - take a path to json file, json string, or parsed json hash
  • Game.load_from_db - take a db Game model
  • action cursor param, and method to process through some action -- if going forward, now no need to create a new game object
  • when an exception is hit, stop the action cursor, set @exception; allows for better inspection of failed game

1846 when all corporations close

  • if players still own companies, the bank will eventually break; the app should do a game end check at the end of the OR even if there was no action in the OR (right now the app will never end the game)
  • if no players own companies, the game should end immediately; this situation is undefined in RAW, but there are no possible actions for any players to take

I've only tested hotseat, but I assume this would crash the server if used in a multi-player game

better pinning/archiving/import_game etc

  • could look at most recent action in active game and pin instead of archive if the action is recent enough (say, last 3 days)
  • script to archive all games with status: finished and a pin, possibly over X days old
  • allow import_game to import from a game json file, possibly useful for importing into prod
  • script to remove pin files if no game is pinned to them
  • maybe on deploy, also always create pin file and put it in public/pinned (many of these ideas could be put in deploy script)
  • by default, pin a game to the latest pin file -- so if you manually pin before deploying, you don't need to specify the pin; on deploy, if the latest pin was unused it can be cleaned up and replaced with the current pin
  • whole list of all ids could be given, script could figure out if they should actually be pinned or archived

separate js bundles for each title

make 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

better game specs (more automatic)

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

"migration pin"

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:

  • new code is released
  • add 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)
  • when checking/migrating a game:
    • if the game can be repaired, migrate as normal; when migration is complete, delete migration_pin
    • if the game has nothing to repair, delete migration_pin
    • if the game cannot be repaired, move migration_pin to pin

`Graph#clear` improvements--less destruction of graph

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:

  • make it possible to "extend" a graph; don't destroy it, but add paths/etc based on a newly laid tile
  • when a new tile is laid, instead of clearing the whole graph, just "extend" the graphs of those corporations who are connected to the tile's hex
  • when a new non-neutral token is laid, "extend" the graph of the token-placing corporation; iff the token fills up the city, do a full clear of the graph for corporations that can reach that city but don’t have a token there

minor refactors

  • replace all instances of any? w/o a block with !empty?
  • replace applicable instances of name split '::' stuff with .type

more efficient loading/validation

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

more hashmaps and less lists

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

rake task to debug a fixture at a given action

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

RuboCop ideas

  • Opal cop to enforce any practices that produce better JS
    • !collection.empty? instead of collection.any? {}
  • configurable cop to prefer certain methods, e.g., index over find_index, size over length, etc

company ability refactors

  • use time instead of when (when is a ruby keyword)
  • use uses instead of count (.count is a method on Arrays)

Only the player who did the latest action should be allowed to undo it

Discourage players from thinking they should be able to just undo turns however they want

Complicating considerations:

  • undo is still possible via master mode; players who want this feature would want master mode undo actions to be logged
  • when dealing with undo actions in this way, would similarly need to consider redo actions
  • possible end turn button? this would be a very large change, would flow better if it was configurable in user settings (i.e., allow users to keep current behavior if they wished); if disabled, the end turn action would need to be automatically added to the actions list, not simply processed; also would not want end turn blocking if no actions were possible during the turn, only if actions were actually taken

1868WY commits to PR into main repo

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 counts
  • eee111176 fix RCL's home
  • 6c11efcfd fix ghost town tile names
  • 0e6114bf4 gray C tile
  • 9d884d603 whitespace fix
  • 4e762dd17 change order of TILE_GROUPS for more sensible ordering on tile page
  • 2dac09607 tile renaming: 5b/B -> 51b/B, drop "Y" from yellow boom tiles
  • 38387482e remove optional rules, just make CM pay a base of $10
  • cc6de1f7e debug: show number of tiles "physically" used
  • 12b15a762 new boom tile track progression - 2/3/4/5 paths instead of 2/4/5/5
  • d43967ea4 move Rapid City and Black Hills
  • 51a033878 P2 keeps its revenue when bought in
  • 0133a9d46 add optional rule for Credit Mobilier to pay $10 instead of $20
  • 3a5380f3b remove phase 6 coal DTs when phase 8 happens
  • 9b965f1c3 more image_optim for SVGs
  • 04588e1af fix borders for hex J6
  • b03a2ed86 rubocop
  • dfd10c19e fix issuing shares, enforce phase limit across whole OR, not just per-sale
  • ac508f202 CM - stop getting after golden spike, add bonus for Ogden mountains
  • 15f8f2666 fix coal DTs acting preprinted
  • c59174779 stop getting CM bonus at phase 5
  • 182b31a1f optional rule to randomly remove companies instead of choosing for P3/P4
  • 7cd8c850c limit share issuing by phase number
  • 89fac46b6 fix timing for P7 Pure Oil Camp
  • b0345361d add 'async' optional rule
  • 66e110e37 P3a/P3b - don't create temp second token
  • e53b11a8d render choices on separate line from choice_name
  • 60c7d9c3c light up both Billings hexes if one is lit up [do after other golden spike stuff]
  • e975c0c6f fix centennial revenue
  • b0ea0c553 render boomcity revenue with current in white, others in gray
  • cc1220c16 Auction - help text for choosing Developer/Surveyor
  • 1fef0416e Credit Mobilier fix 0 payout bug
  • 9cde42b90 UP double share - fix buyabilitiy and capitilzation when exchanged before phase 5
  • 2144d175f Credit Mobilier WIP
  • 4f6c06df8 UP double share - protect the double share when presidency dumped
  • b57c10136 UP double share
  • 450d23168 entities: better descriptions for P3 and P4
  • d1532ad79 make boomtown/boomcity tiles properly double-sided (TODO: generalize w/ 18Mag?)
  • 8409d7c69 manually close private companies
  • ed9f3d200 P6 "Big Boy" [+1+1] token
  • 13bda316d double-headed trains fixup
  • 62ac83cbe P8 LHP to 2+1 train
  • 06e2beec8 P7 Pure Oil Camp
  • 41d0709d3 rubocop
  • d25ac0dd5 fix ghost towns -- blank ghost town is upgradeable
  • 0b477c737 P3b - Buffalo Bill's Bonanza Oil
  • ac77c0498 fix capitalization for UP share from P9
  • ead100181 fix trains
  • ec6d77093 delete puts
  • fbdc4b203 fix busting to ghost towns
  • a18535f70 rubocop
  • 400678628 rubocop
  • ec7d23d60 WIP on endgame - current hotseat is testing trigger by export
  • 377a7e389 rubocop -A
  • d177b76fe WIP - DPR's home
  • d6f52031e WIP fewer trains to quickly test phase 5
  • 5e810e7b3 fix full cap event
  • d8f2afa3d WIP on DPR's home token
  • e930cffc7 on par, LNP and OSL get their home green tile for free
  • 6bf5f79f2 fix OSL home coordinates
  • 59cb8c91b uranium boom and bust
  • 36be10999 BUST fixes
  • 7755a5f6d wind river canyon grey tile
  • 8bc32a696 remove logic for handling double boom cities
  • 1ae9c4c35 update coal company logo
  • 216f6dc3c add oil companies
  • fb0e095ab skip double-heading if no available route
  • 1ca505dd5 add names for player-owned coal companies
  • 3c0a343fb fix removing old coal DTs, remove unused ones every phase
  • 1f3873b59 P3c - $20 discount for placing DTs
  • d2be52ca3 only RCL may run routes to its home purple hex
  • e5c1a7479 P3a Union Pacific Coal
  • 99214d280 fix coal token setup/placement
  • bda01be55 fix available hex check for development tokens
  • e7c0ad680 DT WIP - use squares for DTs
  • 4e835cf5b DT WIP - fix showing placed DTs
  • b92f7dce8 DT WIP - fix where DTs may be placed
  • 49fd7a22b smaller cow skull file size
  • 309123ab3 map: uranium icons
  • 54ddddfef new icons for golden spike stuff
  • 8aca1f1e4 WIP on golden spike and northern spike - see msg body for TODO
  • 8410ba9a8 map: golden/northern spike revenues, some missing offboard stubs
  • 4cf7c6b1a route_distance_str for C+t trains
  • edde608fe double-headed trains
  • 1803e1240 EMR and bankruptcy
  • 378cd3811 player selling pre-operational shares gets the new price
  • 79f62897d issue/redeem shares
  • 7e49997e5 private company certs don't count toward end game value
  • bd58862bf fix +trains, allow first number to count towns
  • bbb7684a3 fix map, label "C" for Casper
  • 7d55f1756 double and triple jumps
  • ad146ec19 building overpass track costs $20
  • 12d0e0af0 priority order
  • d6de0e248 if sold out at end of SR and at top of market, move down and right
  • ae9b20943 Walden is a city that cannot be tokened
  • 80383a619 allow arbitrary hex-colors for multi-part revenues; use for boom revenue
  • f8c82f2b2 East-West bonuses
  • 7b3087953 P4c - $60 discount on one tile lay per OR
  • 3ecd13367 P4b discount on every tile lay
  • 702ec5092 P2 Yellowstone bonus
  • 331bec6b8 fix P4a/P5 tile laying
  • d5f8bbaae P10 can exchange for UP 20% share
  • cc19644df yellow/green/brown pars
  • 612a7c947 fix initial auction
  • f6f26ea7f update player count
  • 804a9bcdc update corporations - delete the removed ones
  • 485ce4662 update tiles
  • 4ff2cf6ef update train costs
  • 844e17fda update texts for private companies, delete removed companies
  • 49e2844b6 new stock market
  • 61a099755 new map and home locations

game processing auto-insert pass actions

I 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.

Share bundles shouldn't need to be modified during processing of them

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.

White outlines for track, make track more thicc

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 ideas

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

game state specs

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

Better logging when steps are skipped

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.