-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
156 lines (135 loc) · 8.42 KB
/
settings.py
File metadata and controls
156 lines (135 loc) · 8.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
"""
settings.py - Global constants and configuration.
"""
import os
# ── Display ──────────────────────────────────────────────────────────────────
NATIVE_WIDTH = 256
NATIVE_HEIGHT = 224
SCALE = 3
SCREEN_WIDTH = NATIVE_WIDTH * SCALE # 768
SCREEN_HEIGHT = NATIVE_HEIGHT * SCALE # 672
FPS = 60
TITLE = "ReThrive — The world will thrive again!"
# ── Tile grid ─────────────────────────────────────────────────────────────────
TILE_SIZE = 16 # pixels at native resolution
# Tile IDs
TILE_GRASS = 0
TILE_WALL = 1
TILE_WATER = 2
TILE_PATH = 3
TILE_TOWN = 4 # overworld town-entrance tile
TILE_ZONE_EXIT = 5 # transition to another overworld zone
TILE_DUNGEON = 6 # dungeon / boss arena entrance
TILE_HIDDEN = 7 # hidden interactable tile (e.g. Subterra secret wall)
TILE_CHEST = 8 # treasure chest (walkable, triggers chest event)
TILE_LORE = 9 # lore-book / readable object (walkable, triggers lore reader)
# ── Player ────────────────────────────────────────────────────────────────────
PLAYER_SPEED = 80 # pixels per second (native resolution)
PLAYER_SIZE = 16 # sprite size at native resolution
PLAYER_ANIM_FPS = 6.0 # animation playback speed in frames per second
# ── Player direction indices (also used as spritesheet row indices) ────────────
DIR_DOWN = 0
DIR_LEFT = 1
DIR_RIGHT = 2
DIR_UP = 3
# ── Colors (R, G, B) ──────────────────────────────────────────────────────────
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
DARK_GRAY = (40, 40, 40)
LIGHT_GRAY = (170, 170, 170)
GREEN = (34, 139, 34)
DARK_GREEN = (0, 80, 0)
BROWN = (101, 67, 33)
BLUE = (70, 130, 180)
YELLOW = (255, 215, 0)
RED = (200, 40, 40)
CYAN = (0, 200, 200)
DARK_BLUE = (20, 40, 100)
DARK_BROWN = (60, 40, 20)
WATER_BLUE = (30, 100, 180)
NPC_SKIN_COLOR = (220, 180, 140) # humanoid skin tone used for NPC placeholder sprites
PATH_TAN = (180, 155, 100)
# Tile colours (used until real tilesets are added)
TILE_COLORS = {
TILE_GRASS: (60, 120, 40),
TILE_WALL: (80, 60, 50),
TILE_WATER: (30, 100, 180),
TILE_PATH: (160, 140, 90),
TILE_TOWN: (160, 220, 100), # bright green — town entrance marker
TILE_ZONE_EXIT: (220, 220, 80), # pale yellow — zone transition
TILE_DUNGEON: (120, 30, 30), # dark red — dungeon entrance
TILE_HIDDEN: (80, 60, 50), # same as wall — visually blends in
TILE_CHEST: (180, 130, 40), # golden-brown — treasure chest
TILE_LORE: (160, 100, 200), # purple-blue — lore book / stone tablet
}
# ── Paths ─────────────────────────────────────────────────────────────────────
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_DIR = os.path.join(BASE_DIR, "data")
ASSETS_DIR = os.path.join(BASE_DIR, "assets")
MAPS_DIR = os.path.join(ASSETS_DIR, "maps")
# ── Battle ────────────────────────────────────────────────────────────────────
BASE_HIT_RATE = 0.90
PLAYER_CRIT_DIVISOR = 25 # player crit chance = lck / PLAYER_CRIT_DIVISOR (20% at lck 5, 60% at max lck 15)
ENEMY_CRIT_CHANCE = 0.01 # enemies and bosses always have a 1% crit chance
DAMAGE_VARIANCE = 0.10
BLIND_HIT_PENALTY = 0.50 # hit-rate reduction when attacker is blinded
UNARMED_ATTACK_POWER = 3 # default weapon power when no weapon is equipped
# ── Encounters ────────────────────────────────────────────────────────────────
ENCOUNTER_RATE_VARIANCE = 0.50 # ±50% of encounter_rate for threshold rolling
# ── Battle speed ─────────────────────────────────────────────────────────────
BATTLE_SPEED_NORMAL = 1.0 # animation duration multiplier at Normal speed
BATTLE_SPEED_FAST = 2.0 # animation duration multiplier at Fast speed
BATTLE_SPEED_INSTANT = 20.0 # animation duration multiplier at Instant speed
BATTLE_SPEED_LABELS = ["Normal", "Fast", "Instant"] # index maps to multiplier list
BATTLE_SPEED_VALUES = [BATTLE_SPEED_NORMAL, BATTLE_SPEED_FAST, BATTLE_SPEED_INSTANT]
# ── Options / config ──────────────────────────────────────────────────────────
CONFIG_PATH = os.path.join(DATA_DIR, "config.json")
# ── UI ────────────────────────────────────────────────────────────────────────
DIALOG_BOX_HEIGHT = 56 # native pixels
DIALOG_PADDING = 6
TYPEWRITER_SPEED = 2 # characters per frame
# Font settings
FONT_NAME = "monospace"
FONT_SIZE_LARGE = 14
FONT_SIZE_NORMAL = 8
FONT_SIZE_SMALL = 7
# UI colours
MENU_CURSOR_BG = (60, 60, 80)
TILE_GRID_COLOR = (0, 0, 0, 40)
# Title screen
TITLE_STAR_SEED = 42 # fixed seed for deterministic star field on title screen
TITLE_STAR_COUNT = 40
# ── Intro cutscene ────────────────────────────────────────────────────────────
INTRO_MOVE_SPEED = 50 # pixels/second for scripted character movement
INTRO_FADE_SPEED = 180 # alpha units/second for fade transitions
INTRO_OVERLAY_ALPHA = 160 # alpha for the semi-transparent dark overlay during scene narration
INTRO_HINT_COLOR = (100, 100, 140) # colour for the "[\\] Skip intro" hint
INTRO_ELDER_COLOR = (200, 150, 80) # colour for the Village Elder sprite
INTRO_SPRITE_FOOT_COLOR = (30, 30, 90) # colour for humanoid sprite feet
# ── Towns ─────────────────────────────────────────────────────────────────────
INN_COST = 50 # gold charged per night at the inn
TOWN_ENTRY_COOLDOWN = 0.5 # seconds before re-entering a town after exiting
TOWN_EVENT_COOLDOWN = 0.3 # seconds before a town event tile can re-trigger
# ── Mini-map / World map ──────────────────────────────────────────────────────
MINIMAP_TILE_SIZE = 3 # pixels per tile on the corner mini-map
MINIMAP_PADDING = 2 # gap between the mini-map frame and screen edge
MINIMAP_ALPHA = 200 # transparency of the corner mini-map overlay (0-255)
MINIMAP_PLAYER_COLOR = (255, 255, 0) # yellow dot for the player marker
MINIMAP_BORDER_COLOR = (180, 180, 180) # light-grey border around the mini-map
MINIMAP_UNVISITED_COLOR = (30, 30, 30) # dark fill for zones not yet visited
# World map layout: each zone has a grid position (col, row) for the full-screen view
WORLD_MAP_ZONE_POSITIONS = {
"verdant_plains": (1, 2),
"silverwood_forest": (1, 0),
"stormcrag_mountains": (2, 1),
"dark_lands": (3, 1),
"subterra_passage": (1, 1),
}
WORLD_MAP_ZONE_SIZE = (48, 36) # native pixels allocated per zone cell
NUM_SAVE_SLOTS = 5 # number of save-game slots available to the player
# ── Audio ─────────────────────────────────────────────────────────────────────
MUSIC_VOLUME = 0.5 # default BGM volume (0.0 – 1.0)
SFX_VOLUME = 0.7 # default SFX volume (0.0 – 1.0)
MUSIC_FADE_MS = 800 # crossfade duration in milliseconds
MUSIC_DIR = os.path.join(ASSETS_DIR, "music")
SFX_DIR = os.path.join(ASSETS_DIR, "sfx")