1
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: make the intail jump stronger

+21 -16
+15 -11
physics_engine.vhd
··· 52 52 -- Physics tuning 53 53 constant GRAVITY : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(1, 10); 54 54 constant IMPULSE : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(3, 10); 55 - constant SLAM_FORCE : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(4, 10); 56 - -- Jump: base force at zero velocity, tapers off as |vel_y| rises. 55 + constant SLAM_FORCE : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(4, 10); 56 + -- Initial jump: full force at zero velocity, tapers off as |vel_y| rises. 57 57 -- Piecewise lookup approximates: max(JUMP_MIN, JUMP_BASE*JUMP_SCALE/(JUMP_SCALE+|vy|)) 58 - constant JUMP_BASE : integer := 6; -- force at zero velocity 59 - constant JUMP_VEL_THR1 : integer := 3; -- |vy| <= 3 → force 6 60 - constant JUMP_VEL_THR2 : integer := 8; -- |vy| <= 8 → force 4 61 - constant JUMP_VEL_THR3 : integer := 16; -- |vy| <= 16 → force 3 62 - constant JUMP_MIN_FORCE : integer := 2; -- floor at high velocity 58 + constant JUMP_BASE : integer := 14; -- force at zero velocity 59 + constant JUMP_VEL_THR1 : integer := 3; -- |vy| <= 3 → force 14 60 + constant JUMP_VEL_THR2 : integer := 10; -- |vy| <= 10 → force 8 61 + constant JUMP_VEL_THR3 : integer := 20; -- |vy| <= 20 → force 6 62 + constant JUMP_MIN_FORCE : integer := 4; -- floor at high velocity 63 + -- Trampoline: fixed additive boost on each ground contact while W held. 64 + -- No inverse scaling so energy accumulates each bounce. 65 + constant JUMP_BOUNCE : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(6, 10); 63 66 constant MAX_VEL_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(32, 10); 64 67 65 68 -- World bounds (11-bit) ··· 157 160 -- == INPUT == 158 161 if key_w = '0' then jump_pressed <= '0'; end if; 159 162 160 - -- Scaled jump: full force at low velocity, tapers as |vy| increases 163 + -- Initial jump: force tapers as |vy| increases (inverse scaling) 161 164 if vy(9) = '1' then abs_vy_int := CONV_INTEGER((not vy) + 1); 162 165 else abs_vy_int := CONV_INTEGER(vy); end if; 163 166 if abs_vy_int <= JUMP_VEL_THR1 then jforce_int := JUMP_BASE; 164 - elsif abs_vy_int <= JUMP_VEL_THR2 then jforce_int := 4; 165 - elsif abs_vy_int <= JUMP_VEL_THR3 then jforce_int := 3; 167 + elsif abs_vy_int <= JUMP_VEL_THR2 then jforce_int := 8; 168 + elsif abs_vy_int <= JUMP_VEL_THR3 then jforce_int := 6; 166 169 else jforce_int := JUMP_MIN_FORCE; 167 170 end if; 168 171 jforce_slv := CONV_STD_LOGIC_VECTOR(jforce_int, 10); ··· 173 176 jump_pressed <= '1'; 174 177 end if; 175 178 179 + -- Trampoline: fixed boost (no inverse scaling) so energy accumulates each bounce 176 180 if key_w = '1' and jump_pressed = '1' and on_ground = '1' then 177 - vy := vy - jforce_slv; 181 + vy := vy - JUMP_BOUNCE; 178 182 end if; 179 183 180 184 if key_s = '1' and on_ground = '0' then vy := vy + SLAM_FORCE; end if;
+6 -5
visualizer.py
··· 25 25 IMPULSE = 3 26 26 SLAM_FORCE = 4 27 27 AIR_CONTROL = 2 28 - JUMP_FORCE = 6 # base jump force at zero velocity 29 - JUMP_VEL_SCALE = 12 # velocity magnitude at which jump force is halved 30 - JUMP_MIN_FORCE = 2 # floor: minimum jump force regardless of velocity 28 + JUMP_FORCE = 14 # initial jump force at zero velocity (scales down with |vel_y|) 29 + JUMP_VEL_SCALE = 12 # velocity magnitude at which initial jump force is halved 30 + JUMP_MIN_FORCE = 4 # floor for inverse-scaled initial jump 31 + JUMP_BOUNCE = 6 # fixed additive boost on each ground contact while W held (trampoline) 31 32 MAX_VEL_X = 32 32 33 SIZE = 7 33 34 BOUNCE_SHIFT = 3 # energy loss = vel >> 3 (keep 87.5%) ··· 140 141 vy = (vy - scaled_jump()) & MASK 141 142 jump_pressed = True 142 143 elif keys_held['w'] and jump_pressed and on_ground: 143 - # Holding W while bouncing: boost each ground contact 144 - vy = (vy - scaled_jump()) & MASK 144 + # Holding W while bouncing: fixed boost so trampoline accumulates each contact 145 + vy = (vy - JUMP_BOUNCE) & MASK 145 146 146 147 # S: slam (air only) 147 148 if keys_held['s'] and not on_ground: