GithubHelp home page GithubHelp logo

jayjader / warofthedukes Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 3.25 MB

An open implementation of an old wargame with hex tiles, from Jeux & Stratégie Magazine #1

GDScript 93.24% C# 5.63% Rust 1.13%

warofthedukes's People

Contributors

jayjader avatar sblondon avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

boyquotes

warofthedukes's Issues

Complete combat mechanics

Targetting

  • unit can only be attacked once per turn

Terrain Effects on Combat

  • Forest gives +2 attack
  • Hills gives +1 attack

Retreat

  • cannot retreat into enemy z.o.c.
  • if all avenues of retreat blocked by terrain, enemy units or z.o.c., retreating unit dies instead
  • if all remaining avenues of retreat blocked by allied units, "push" 1 that isn't blocked out of the way

Exchange

  • kill attackers totaling at least as much attack strength as the defender's strength; attacking player manually allocates, use effective combat strengths (apply terrain and duke aura multipliers)

Post-Retreat Pursuit

  • attacking melee unit can occupy tile defender retreats from, as a free movement with no movement point or z.o.c. restrictions

Artillery special case

  • artillery ignores Retreat, Exchange, and Eliminated result effects that would apply to them when attacking at range > 1 or across a river

Duke special cases

AI missing for Movement

overall

  • adopt a strategy pattern
  • parsing-inspired approach: input "current state" and receive "next state". in this case:
    • input board tiles, current unit positions, current remaining movement points per unit
    • receive/output/return next move command to issue OR end move phase

Biases

  • Bias towards occupying minor objectives
  • Bias towards defensible positions
  • [ ] bias towards flanking allied positions
  • [ ] bias towards enemies menacing objectives
  • [ ] bias towards enemies menacing allies
  • [ ] bias according to kind:
    • [ ] duke -> away from enemies (and ideally towards tiles that position allies between the duke and enemies)
    • [ ] artillery -> towards 2 tiles away from enemies
    • [ ] cavalry & infantry -> ?

Game Lobby Focus Handling

  • grab focus at start/on ready (-> confirm/new game?)
  • navigation:
    • orf -down-> wulf
    • wulf -up->orf
    • wulf-down->confirm

Finish Gameplay Implementation

Game should be playable as human vs human, hot-swapping keyboard & mouse, from start to finish.

Map Data

Introduce Zones

  • prop on map data of type {_zone_count: int, NameString->AxialPosition}
  • paint zones in editor:
    • faction capitals:
      • Orfburg
      • Wulfenburg
    • minor objectives:
      • city
      • territory

Setup

Board

  • Report hover
  • Report click

split into 2 subphases:

  • Fill Cities and Fortresses
    • show instructions
    • click to place unit on tile that is not City or Fortress, or outside faction borders -> do nothing
  • Deploy remaining units
    • show instructions
    • click to place unit outside faction's borders -> do nothing

Movement

Choose Unit

  • click on unit tile:
    • retain chosen unit/tile
    • next subphase
  • click on empty tile -> do nothing
Board
  • Don't report click
  • Don't report hover

Choose Destination / Move Unit

  • click on current position -> do nothing deselect unit/previous subphase
  • click on different tile -> check if valid destination:
    • can be reached from unit's current position?
      • tile kind cost
      • border kind cost
      • enemy units & zone of control
    • can hold/receive unit?
    • both of the above:
      • move unit
      • next subphase
Board
  • Report click
  • Report hover

End Phase

  • Button to end movement phase and start combat phase

Combat

Choose Attackers

  • click on unit tile:
    • already attacked -> do nothing
    • already attacking -> remove from attacking
    • neither of the above -> add to attacking
  • click on choose defender button -> retain attacking, next subphase

Choose Defender / Resolve Attack

  • click on unit tile:
    • in range -> resolve attack
    • out of range -> do nothing
  • click on cancel button -> previous subphase

Board

  • Don't report click
  • Don't report hover

End Phase

  • Button to end movement phase and start combat phase

Endgame Detection

Duke Death

  • after combat resolution involving duke as defender or attacker

End of Game

  • major objective control
  • minor objective control

accessibility pass

  • colorblind mode for map ? (or find some way to make the different terrains and features recognizable in greyscale - patterns, shapes, etc)

Focus handling

Main Menu

Game Lobby

Game Setup

Game Play

  • grab focus at start/on ready (-> board / tile selection?)

Movement

  • add game action for ending movement phase
Choose unit to move
  • cursor on board -> snaps to controlled units' tiles
  • add game action for selecting unit under cursor
  • add game action for cycling which unit under cursor is selected
Choose move destination
  • cursor on board -> snaps to tiles in movement range of selected unit
  • add game action for choosing destination
  • add game action for canceling which unit is chosen to move

Combat Phase

  • add game action for ending combat phase
  • add game action for adding a unit to/starting an attack
Choose attackers
  • cursor on board -> snaps to controlled units' tiles (restricted to units that have at least 1 enemy in range?)
  • add game action for removing a unit from an attack
  • add game action for confirming choice of attackers
Choose defender
  • cursor on board -> snaps to valid defenders' tiles
  • add game action for

AI missing for Combat

approach

same as before:

  • strategy object/pattern
  • init with current world state (including attacked & defended)
  • returns choice of attackers + defender, or end combat phase

extra cases

  • retreat single unit
  • handle making way
  • choose next unit to retreat out of several
  • allocate next exchange loss from remaining to be allocated given remaining strength to allocate

biaises

  • Bias according to combat ratio/projected result
  • [ ] Bias towards largest combined attack on weakest defender

AI shouldn't be able to use its Duke piece as an attacker in a combat

This is incorrect according to the game rules, and causes the following bug/program halt:

2024-01-13_15-01-1705156673

Analysis so far:

  • Dukes have 0 attack
  • There is no result column in the combat results table for a ratio made from a zero [and any other number]
  • The code assumes a result column will always exist for ratios that are consulted in the table

=>

  1. An attack launched with only a Duke causes a lookup of a ratio of 0:[the defender's effective defense] in the results table/dictionary object.
  2. The code assumes this lookup will not fail [as Dukes should not be selectable for attacking] and produce a full, contiguous Array of size/length 6. The lookup instead produces a null value as the dictionary has no value for the ratio/key.
  3. The code proceeds to lookup the final combat result at [for the purposes/context of this bug/issue] an arbitrary index on this null value, provoking the error that halts/crashes the game.

AI missing for Setup

adopt strategy pattern

  • init w/ group of available tiles
  • query for next (unit_type, tile) tuple

maybe combine into "pure" function for starters?

  • Bias tiles close to inter-player territory border, tiles in minor objective zones, then defensive bonus, then roads/farther potential movement per turn from
  • [ ] Bias tiles "behind" infantry for artillery (ie so that infantry and enemies are kept in same direction from artillery placement)
  • [ ] Invert or adjust bias from tile features according to border movement point cost for Cavalry
  • [ ] Invert border-distance-bias for Duke

Focus Handling for Game Setup

  • grab focus at start/on ready (-> board / tile selection)
  • disable focus on setup buttons?

Map Cursor

  • cursor on board -> snapped to tiles
  • add game actions for moving cursor on board: 6 directions
  • convert mouse hover to cursor placement

Unit Placement

  • add game actions to switch between which unit type is being placed during setup
  • add game action to enable "auto setup remaining"

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.