Browse Source

add constants and form items necessary for gun game

Kirk Trombley 3 years ago
parent
commit
3fa0db8e14

+ 6 - 0
client/src/components/screens/Lobby/Lobby.jsx

@@ -17,6 +17,7 @@ import {
   NIGHTMARE,
   NIGHTMARE,
   RAMP,
   RAMP,
   RAMP_HARD,
   RAMP_HARD,
+  GUN_GAME,
 } from "../../../domain/constants";
 } from "../../../domain/constants";
 
 
 export const GameInfo = () => {
 export const GameInfo = () => {
@@ -82,6 +83,11 @@ export const GameInfo = () => {
           You will not be able to adjust your view
           You will not be able to adjust your view
         </span>
         </span>
       )}
       )}
+      {gameMode === GUN_GAME && (
+        <span className={styles.label}>
+          You will need to score over 4000 points to progress through each round
+        </span>
+      )}
       {roundPointCap && (
       {roundPointCap && (
         <span className={styles.label}>
         <span className={styles.label}>
           Only {roundPointCap} total points will be up for grabs each round
           Only {roundPointCap} total points will be up for grabs each round

+ 19 - 0
client/src/components/util/GameCreationForm/GameCreationForm.jsx

@@ -14,6 +14,8 @@ import {
   NIGHTMARE,
   NIGHTMARE,
   RAMP,
   RAMP,
   RAMP_HARD,
   RAMP_HARD,
+  GUN_GAME,
+  DIFFICULTY_TIERED,
 } from "../../../domain/constants";
 } from "../../../domain/constants";
 import useCountryLookup from "../../../hooks/useCountryLookup";
 import useCountryLookup from "../../../hooks/useCountryLookup";
 import Loading from "../Loading";
 import Loading from "../Loading";
@@ -64,6 +66,11 @@ const PRESETS = {
     clockMode: RACE,
     clockMode: RACE,
     scoreMethod: RAMP,
     scoreMethod: RAMP,
   },
   },
+  GUN_GAME: {
+    ...DEFAULTS,
+    gameMode: GUN_GAME,
+    generationMethod: DIFFICULTY_TIERED,
+  },
 };
 };
 
 
 export const LastSettingsButton = ({ onClick }) => (
 export const LastSettingsButton = ({ onClick }) => (
@@ -189,6 +196,9 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
           <Item value={PRESETS.BOOTLEG_GG_DUEL} display="⭐">
           <Item value={PRESETS.BOOTLEG_GG_DUEL} display="⭐">
             Legally Distinct from Geoguessr Duels
             Legally Distinct from Geoguessr Duels
           </Item>
           </Item>
+          <Item value={PRESETS.GUN_GAME} display="⭐">
+            Gun Game
+          </Item>
         </Dropdown>
         </Dropdown>
         {lastSettings && (
         {lastSettings && (
           <LastSettingsButton onClick={() => setPreset(lastSettings)} />
           <LastSettingsButton onClick={() => setPreset(lastSettings)} />
@@ -212,6 +222,9 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
             <Item value={3600} display={ms(60 * 60 * 1000)}>
             <Item value={3600} display={ms(60 * 60 * 1000)}>
               1 Hour
               1 Hour
             </Item>
             </Item>
+            <Item value={7 * 24 * 3600} display={ms(7 * 24 * 60 * 60 * 1000)}>
+              &quot;Limitless&quot; (1 Week)
+            </Item>
           </Dropdown>
           </Dropdown>
           <Dropdown selected={rounds} onSelect={setRounds} open="rounds">
           <Dropdown selected={rounds} onSelect={setRounds} open="rounds">
             <Item value={1}>1 Round</Item>
             <Item value={1}>1 Round</Item>
@@ -230,6 +243,9 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
             <Item value={URBAN} display="🏙️">
             <Item value={URBAN} display="🏙️">
               Urban Centers
               Urban Centers
             </Item>
             </Item>
+            <Item value={DIFFICULTY_TIERED} display="🎲">
+              Difficulty Tiered
+            </Item>
           </Dropdown>
           </Dropdown>
           <CountryDropdown
           <CountryDropdown
             countryLookup={countryLookup}
             countryLookup={countryLookup}
@@ -244,6 +260,9 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
             <Item value={FROZEN} display="❄️">
             <Item value={FROZEN} display="❄️">
               Frozen
               Frozen
             </Item>
             </Item>
+            <Item value={GUN_GAME} display="🔫">
+              Gun Game
+            </Item>
           </Dropdown>
           </Dropdown>
           <Dropdown
           <Dropdown
             selected={clockMode}
             selected={clockMode}

+ 2 - 0
client/src/domain/constants.js

@@ -9,11 +9,13 @@ export const ERROR = "ERROR"; // Error state
 // Generation Methods
 // Generation Methods
 export const RANDOM_STREET_VIEW = "RANDOMSTREETVIEW";
 export const RANDOM_STREET_VIEW = "RANDOMSTREETVIEW";
 export const URBAN = "URBAN";
 export const URBAN = "URBAN";
+export const DIFFICULTY_TIERED = "DIFFICULTY_TIERED";
 
 
 // Game Config Options
 // Game Config Options
 export const NORMAL = "NORMAL";
 export const NORMAL = "NORMAL";
 export const TIME_BANK = "TIMEBANK";
 export const TIME_BANK = "TIMEBANK";
 export const FROZEN = "FROZEN";
 export const FROZEN = "FROZEN";
+export const GUN_GAME = "GUN_GAME";
 export const RACE = "RACE";
 export const RACE = "RACE";
 export const COUNTRY_RACE = "COUNTRYRACE";
 export const COUNTRY_RACE = "COUNTRYRACE";
 export const DISTANCE = "DISTANCE";
 export const DISTANCE = "DISTANCE";

+ 4 - 0
server/app/point_gen/__init__.py

@@ -124,6 +124,10 @@ class PointStore:
         In the event that the configured source cannot reasonably supply enough points,
         In the event that the configured source cannot reasonably supply enough points,
         most likely due to time constraints, this will raise an ExhaustedSourceError.
         most likely due to time constraints, this will raise an ExhaustedSourceError.
         """
         """
+        # in the case of using the "difficulty tiered" generator there is some special logic
+        if config.generation_method == GenMethodEnum.diff_tiered:
+            # TODO - actually implement this, for now just fail
+            raise ExhaustedSourceError
         try:
         try:
             point_tasks = [self.get_point(config.generation_method, config.country_lock) for _ in range(config.rounds)]
             point_tasks = [self.get_point(config.generation_method, config.country_lock) for _ in range(config.rounds)]
             gathered = asyncio.gather(*point_tasks)
             gathered = asyncio.gather(*point_tasks)

+ 2 - 0
server/app/schemas.py

@@ -11,11 +11,13 @@ CountryCode = constr(to_lower=True, min_length=2, max_length=2)
 class GenMethodEnum(str, Enum):
 class GenMethodEnum(str, Enum):
     rsv = "RANDOMSTREETVIEW"
     rsv = "RANDOMSTREETVIEW"
     urban = "URBAN"
     urban = "URBAN"
+    diff_tiered = "DIFFICULTY_TIERED"
 
 
 
 
 class GameModeEnum(str, Enum):
 class GameModeEnum(str, Enum):
     normal = "NORMAL"
     normal = "NORMAL"
     frozen = "FROZEN"
     frozen = "FROZEN"
+    gun_game = "GUN_GAME"
 
 
 
 
 class ClockModeEnum(str, Enum):
 class ClockModeEnum(str, Enum):