Skip to content

Commit

Permalink
v0.5.7 Alpha, small balance tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Jul 25, 2022
1 parent 0852140 commit a92ce53
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 49 deletions.
2 changes: 1 addition & 1 deletion BuildLibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import re

def GetVersion() -> str:
return 'v0.5.6 Alpha'
return 'v0.5.7 Alpha'

packLengthRegex = re.compile('^(.*?)(\d+)(\w)(.*?)$')
class FancyPacker:
Expand Down
24 changes: 12 additions & 12 deletions BuildLibs/confile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ class ConFile:
def __init__(self, game, conSettings, name, text):
info('\n', name, len(text))
self.game = game
self.conSettings = conSettings
self.conSettings:dict = conSettings
self.name:str = name
self.text:str = text
self.regexes = []
self.difficulties = []
for r in self.conSettings:
self.regexes.append(re.compile('^'+r+'$'))
self.difficulties.append(self.conSettings[r]['difficulty'])
for v in self.conSettings:
r = re.compile('^'+v['regexstr']+'$')
v['regex'] = r

def ShouldRandomizeVar(self, name) -> Union[float,None]:
for i in range(len(self.regexes)):
if self.regexes[i].match(name):
return self.difficulties[i]
def GetVarSettings(self, name) -> Union[None,dict]:
for v in self.conSettings:
if v['regex'].match(name):
return v
return None

def RandomizeLine(self, l:str, seed:int, range:float, scale:float, difficulty:float) -> str:
Expand All @@ -32,11 +30,13 @@ def RandomizeLine(self, l:str, seed:int, range:float, scale:float, difficulty:fl
oldval = int(m.group(2))
theRest = m.group(3)

var_difficulty = self.ShouldRandomizeVar(name)
if var_difficulty is None:
var_settings:dict = self.GetVarSettings(name)
if var_settings is None:
return l
var_difficulty = var_settings.get('difficulty', 0)

rng = random.Random(crc32('define', name, seed))
range *= var_settings.get('range', 1)
r = rng.random() * range + 1

if var_difficulty < 0:
Expand Down
50 changes: 27 additions & 23 deletions BuildLibs/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def SpriteRange(min:int, max:int, value:dict):
d[i] = value
return d

def ConVar(regex:str, difficulty:float=0, range:float=1) -> dict:
return { 'regexstr': regex, 'difficulty': difficulty, 'range': 1 }




Expand Down Expand Up @@ -679,34 +682,35 @@ def SpriteRange(min:int, max:int, value:dict):

# difficulty > 0 means higher number makes the game harder
AddConSettings('Ion Fury', conFiles = {
'scripts/customize.con': {
'.*\wHEALTH': {'difficulty': -1},
'.*MAXAMMO': {'difficulty': -1},
'.*AMOUNT': {'difficulty': -1},
'scripts/customize.con': [
ConVar('.*\wHEALTH', -1, range=0.5),
ConVar('MEDKIT_HEALTHAMOUNT', -1, range=0.5),
ConVar('.*MAXAMMO', -1),
ConVar('.*AMOUNT', -1),

'.*_DMG': {'difficulty': 0}, # not sure if this affects enemies too or just the player?
ConVar('.*_DMG', 0), # not sure if this affects enemies too or just the player?

'.*_HEALTH': {'difficulty': 1},
}
ConVar('.*_HEALTH', 1),
]
})

AddConSettings('Duke Nukem 3D', conFiles = {
'USER.CON': {
'SWEARFREQUENCY': {'difficulty': 0},
'.*HEALTH': {'difficulty': -1},
'MAX.*AMMO': {'difficulty': -1},
'.*AMMOAMOUNT': {'difficulty': -1},
'.*_AMOUNT': {'difficulty': -1},
'HANDBOMBBOX': {'difficulty': -1},
'.*_WEAPON_STRENGTH': {'difficulty': -1},

'.*\wSTRENGTH': {'difficulty': 1},
'PIG_SHIELD_AMOUNT\d': {'difficulty': 1},
'USER.CON': [
ConVar('SWEARFREQUENCY', 0),
ConVar('.*HEALTH', -1, range=0.5),
ConVar('MAX.*AMMO', -1),
ConVar('.*AMMOAMOUNT', -1),
ConVar('.*_AMOUNT', -1),
ConVar('HANDBOMBBOX', -1),
ConVar('.*_WEAPON_STRENGTH', -1),

ConVar('.*\wSTRENGTH', 1),
ConVar('PIG_SHIELD_AMOUNT\d', 1),

# idk what these do
'OCTASCRATCHINGPLAYER': {'difficulty': 0},
'LIZGETTINGDAZEDAT': {'difficulty': 0},
'LIZEATINGPLAYER': {'difficulty': 0},
'NEWBEASTSCRATCHAMOUNT': {'difficulty': 0},
}
ConVar('OCTASCRATCHINGPLAYER', 0),
ConVar('LIZGETTINGDAZEDAT', 0),
ConVar('LIZEATINGPLAYER', 0),
ConVar('NEWBEASTSCRATCHAMOUNT', 0),
]
})
26 changes: 13 additions & 13 deletions BuildLibs/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ def ReadSettings(self):
settings['MapFile.chanceDupeItem'] = {'Few': 0.4, 'Some': 0.55, 'Many': 0.7, 'Extreme': 0.9}[self.enemiesVar.get()]
settings['MapFile.chanceDeleteItem'] = {'Few': 0.4, 'Some': 0.25, 'Many': 0.15, 'Extreme': 0.1}[self.enemiesVar.get()]

settings['MapFile.chanceDupeEnemy'] = {'Few': 0.4, 'Some': 0.55, 'Many': 0.7, 'Extreme': 0.9}[self.enemiesVar.get()]
settings['MapFile.chanceDeleteEnemy'] = {'Few': 0.4, 'Some': 0.25, 'Many': 0.15, 'Extreme': 0.1}[self.enemiesVar.get()]
settings['MapFile.chanceDupeEnemy'] = {'Few': 0.4, 'Some': 0.55, 'Many': 0.6, 'Extreme': 0.75}[self.enemiesVar.get()]
settings['MapFile.chanceDeleteEnemy'] = {'Few': 0.4, 'Some': 0.25, 'Many': 0.2, 'Extreme': 0.15}[self.enemiesVar.get()]

settings['MapFile.itemVariety'] = {'Normal': 0, 'Increased': 0.2, 'Extreme': 0.5, unavail: 0}[self.itemVarietyVar.get()]
settings['MapFile.enemyVariety'] = {'Normal': 0, 'Increased': 0.2, 'Extreme': 0.5, unavail: 0}[self.enemyVarietyVar.get()]

settings['conFile.range'] = {'Low': 0.5, 'Medium': 1, 'High': 1.5, 'Extreme': 2.0, unavail: 1}[self.rangeVar.get()]
settings['conFile.range'] = {'Low': 0.5, 'Medium': 1, 'High': 1.3, 'Extreme': 1.6, unavail: 1}[self.rangeVar.get()]
settings['conFile.scale'] = 1.0
settings['conFile.difficulty'] = {'Easy': 0.3, 'Medium': 0.5, 'Difficult': 0.7, 'Extreme': 0.9, unavail: 0.5}[self.difficultyVar.get()]
settings['conFile.difficulty'] = {'Easy': 0.2, 'Medium': 0.4, 'Difficult': 0.6, 'Extreme': 0.75, unavail: 0.4}[self.difficultyVar.get()]

settings['grp.reorderMaps'] = enabled[self.reorderMapsVar.get()]
settings['useRandomizerFolder'] = enabled[self.randomizerFolderVar.get()]
Expand Down Expand Up @@ -220,45 +220,45 @@ def initWindow(self):
infoLabel.grid(column=0,row=row,columnspan=2,rowspan=1)
row+=1

self.seedEntry = self.newInput(Entry, 'Seed: ', 'RNG Seed. Each seed is a different game!\nLeave blank for a random seed.', row)
self.seedEntry:Entry = self.newInput(Entry, 'Seed: ', 'RNG Seed. Each seed is a different game!\nLeave blank for a random seed.', row)
row+=1

# items add/reduce? maybe combine them into presets so it's simpler to understand
self.itemsVar = StringVar(self.win, 'Some')
items = self.newInput(OptionMenu, 'Items: ', 'How many items.\n"Some" is a similar amount to vanilla.', row, self.itemsVar, 'Few', 'Some', 'Many', 'Extreme')
items:OptionMenu = self.newInput(OptionMenu, 'Items: ', 'How many items.\n"Some" is a similar amount to vanilla.', row, self.itemsVar, 'Few', 'Some', 'Many', 'Extreme')
row+=1

# enemies add/reduce?
self.enemiesVar = StringVar(self.win, 'Some')
enemies = self.newInput(OptionMenu, 'Enemies: ', 'How many enemies.\n"Some" is a similar amount to vanilla.', row, self.enemiesVar, 'Few', 'Some', 'Many', 'Extreme')
enemies:OptionMenu = self.newInput(OptionMenu, 'Enemies: ', 'How many enemies.\n"Some" is a similar amount to vanilla.', row, self.enemiesVar, 'Few', 'Some', 'Many', 'Extreme')
row+=1

# values range
self.rangeVar = StringVar(self.win, 'Medium')
self.range = self.newInput(OptionMenu, 'Randomization Range: ', 'How wide the range of values can be randomized.\nThis affects the values in CON files.', row, self.rangeVar, 'Low', 'Medium', 'High', 'Extreme')
self.range:OptionMenu = self.newInput(OptionMenu, 'Randomization Range: ', 'How wide the range of values can be randomized.\nThis affects the values in CON files.', row, self.rangeVar, 'Low', 'Medium', 'High', 'Extreme')
row+=1

# difficulty? values difficulty?
self.difficultyVar = StringVar(self.win, 'Medium')
self.difficulty = self.newInput(OptionMenu, 'Difficulty: ', 'Increase the difficulty for more challenge.\nThis affects the values in CON files.', row, self.difficultyVar, 'Easy', 'Medium', 'Difficult', 'Extreme')
self.difficulty:OptionMenu = self.newInput(OptionMenu, 'Difficulty: ', 'Increase the difficulty for more challenge.\nThis affects the values in CON files.', row, self.difficultyVar, 'Easy', 'Medium', 'Difficult', 'Extreme')
row+=1

self.itemVarietyVar = StringVar(self.win, 'Normal')
self.itemVariety = self.newInput(OptionMenu, 'Item Variety: ', 'Chance to add items that shouldn\'t be on the map.', row, self.itemVarietyVar, 'Normal', 'Increased', 'Extreme')
self.itemVariety:OptionMenu = self.newInput(OptionMenu, 'Item Variety: ', 'Chance to add items that shouldn\'t be on the map.', row, self.itemVarietyVar, 'Normal', 'Increased', 'Extreme')
row+=1

self.enemyVarietyVar = StringVar(self.win, 'Normal')
self.enemyVariety = self.newInput(OptionMenu, 'Enemy Variety: ', 'Chance to add enemies that shouldn\'t be on the map.\nThis can create difficult situations.', row, self.enemyVarietyVar, 'Normal', 'Increased', 'Extreme')
self.enemyVariety:OptionMenu = self.newInput(OptionMenu, 'Enemy Variety: ', 'Chance to add enemies that shouldn\'t be on the map.\nThis can create difficult situations.', row, self.enemyVarietyVar, 'Normal', 'Increased', 'Extreme')
row+=1

self.reorderMapsVar = StringVar(self.win, 'Disabled')
reorderMaps = self.newInput(OptionMenu, 'Reorder Maps: ', 'Shuffle the order of the maps.', row, self.reorderMapsVar, 'Disabled', 'Enabled')
reorderMaps:OptionMenu = self.newInput(OptionMenu, 'Reorder Maps: ', 'Shuffle the order of the maps.', row, self.reorderMapsVar, 'Disabled', 'Enabled')
row+=1

# TODO: option to enable/disable loading external files?

self.randomizerFolderVar = StringVar(self.win, '')
self.randomizerFolder = self.newInput(OptionMenu, 'Use Randomizer Folder: ', 'Put randomized files inside Randomizer folder.\nWorks great with EDuke32, doesn\'t work with voidsw or Ion Fury.\nJust use the default setting.', row, self.randomizerFolderVar, 'Disabled', 'Enabled')
self.randomizerFolder:OptionMenu = self.newInput(OptionMenu, 'Use Randomizer Folder: ', 'Put randomized files inside Randomizer folder.\nWorks great with EDuke32, doesn\'t work with voidsw or Ion Fury.\nJust use the default setting.', row, self.randomizerFolderVar, 'Disabled', 'Enabled')
row+=1

#self.progressbar = Progressbar(self.win, maximum=1)
Expand Down

0 comments on commit a92ce53

Please sign in to comment.