formatting

This commit is contained in:
jacob 2026-01-22 03:47:58 -06:00
parent 0c9dd684af
commit 5ad14b2dfd
15 changed files with 199 additions and 203 deletions

View File

@ -1,25 +1,5 @@
// Project-wide configurable constants // Project-wide configurable constants
#define WRITE_DIR "power_play"
// Window title
#if IsRtcEnabled
#if IsDeveloperModeEnabled
#define WINDOW_TITLE "Debug (Developer Build)"
#else
#define WINDOW_TITLE "Debug"
#endif
#else
#if IsDeveloperModeEnabled
#define WINDOW_TITLE "Power Play (Developer Build)"
#else
#define WINDOW_TITLE "Power Play"
#endif
#endif
#define DEFAULT_CAMERA_WIDTH (16)
#define DEFAULT_CAMERA_HEIGHT ((f64)DEFAULT_CAMERA_WIDTH / (16.0 / 9.0))
// Rendered texture size + extra room for off-screen light falloff // Rendered texture size + extra room for off-screen light falloff
#define RENDER_WIDTH (640 + 250) #define RENDER_WIDTH (640 + 250)
#define RENDER_HEIGHT (360 + 250) #define RENDER_HEIGHT (360 + 250)
@ -32,13 +12,6 @@
#define USER_INTERP_RATIO 1.2 #define USER_INTERP_RATIO 1.2
#define USER_INTERP_ENABLED 1 #define USER_INTERP_ENABLED 1
// 64^2 = 4096 bins
#define SPACE_CELL_BINS_SQRT (64)
#define SPACE_CELL_SIZE (1)
#define SIM_TILES_PER_UNIT_SQRT (4)
#define SIM_TILES_PER_CHUNK_SQRT (16)
#define SIM_MAX_PING 5.0 #define SIM_MAX_PING 5.0
#define SIM_TICKS_PER_SECOND 64 #define SIM_TICKS_PER_SECOND 64
#define SIM_TICK_INTERVAL_NS (NsFromSeconds(1) / SIM_TICKS_PER_SECOND) #define SIM_TICK_INTERVAL_NS (NsFromSeconds(1) / SIM_TICKS_PER_SECOND)

View File

@ -594,7 +594,6 @@ G_ResourceHandle G_PushResource(G_ArenaHandle arena, G_CommandListHandle cl, G_R
} \ } \
) )
//- Index buffer helpers //- Index buffer helpers
#define G_IdxBuff16(_res) ((G_IndexBufferDesc) { .resource = (_res), .index_size = 2, .index_count = (G_CountBuffer((_res), i16)) }) #define G_IdxBuff16(_res) ((G_IndexBufferDesc) { .resource = (_res), .index_size = 2, .index_count = (G_CountBuffer((_res), i16)) })

View File

@ -2689,9 +2689,9 @@ void G_Rasterize(
cmd->rasterize.ps = ps; cmd->rasterize.ps = ps;
cmd->rasterize.instances_count = instances_count; cmd->rasterize.instances_count = instances_count;
cmd->rasterize.index_buffer_desc = index_buffer; cmd->rasterize.index_buffer_desc = index_buffer;
for (u32 i = 0; i < MinU32(render_targets_count, G_MaxRenderTargets); ++i) for (u32 rt_idx = 0; rt_idx < MinU32(render_targets_count, G_MaxRenderTargets); ++rt_idx)
{ {
cmd->rasterize.render_target_descs[i] = render_targets[i]; cmd->rasterize.render_target_descs[rt_idx] = render_targets[rt_idx];
} }
cmd->rasterize.viewport = viewport; cmd->rasterize.viewport = viewport;
cmd->rasterize.scissor = scissor; cmd->rasterize.scissor = scissor;

View File

@ -164,8 +164,8 @@ P_Shape P_LocalShapeFromEnt(P_Ent *ent)
.radius = 0.3, .radius = 0.3,
); );
// f32 guy_width = 0.6; // f32 guy_width = 0.75;
// f32 guy_height = 0.3; // f32 guy_height = 0.4;
// result = P_ShapeFromDesc( // result = P_ShapeFromDesc(
// .mass = 10, // .mass = 10,
// .count = 2, // .count = 2,
@ -1568,10 +1568,10 @@ void P_StepFrame(P_Frame *frame)
Vec2 new_velocity = guy->solved_v; Vec2 new_velocity = guy->solved_v;
new_velocity = AddVec2(new_velocity, MulVec2(control.move, move_force * sim_dt)); new_velocity = AddVec2(new_velocity, MulVec2(control.move, move_force * sim_dt));
// if (Vec2Len(new_velocity) > max_speed) if (Vec2Len(new_velocity) > max_speed)
// { {
// new_velocity = Vec2WithLen(new_velocity, max_speed); new_velocity = Vec2WithLen(new_velocity, max_speed);
// } }
guy->solved_v = new_velocity; guy->solved_v = new_velocity;
} }
@ -1611,6 +1611,8 @@ void P_StepFrame(P_Frame *frame)
// TODO: Not like this // TODO: Not like this
if (!is_predicting)
{
for (P_Ent *ent0 = P_FirstEnt(frame); !P_IsEntNil(ent0); ent0 = P_NextEnt(ent0)) for (P_Ent *ent0 = P_FirstEnt(frame); !P_IsEntNil(ent0); ent0 = P_NextEnt(ent0))
{ {
if (ent0->is_guy) if (ent0->is_guy)
@ -1759,6 +1761,7 @@ void P_StepFrame(P_Frame *frame)
} }
} }
} }
}
@ -2276,8 +2279,8 @@ void P_StepFrame(P_Frame *frame)
f32 fire_rate = 50; f32 fire_rate = 50;
f32 bullets_per_fire = 1; f32 bullets_per_fire = 1;
// f32 spread = Tau * 0.05; f32 spread = Tau * 0.05;
f32 spread = Tau * 0.01; // f32 spread = Tau * 0.01;
f32 tweak_speed = TweakFloat("Bullet speed", 100, 1, 100); f32 tweak_speed = TweakFloat("Bullet speed", 100, 1, 100);
b32 can_fire = (firer->last_fire_ns + NsFromSeconds(1.0 / fire_rate)) <= frame->time_ns; b32 can_fire = (firer->last_fire_ns + NsFromSeconds(1.0 / fire_rate)) <= frame->time_ns;

BIN
src/pp/pp_res/sprite/bla.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
src/pp/pp_res/sprite/bla2.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
src/pp/pp_res/sprite/bla3.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
src/pp/pp_res/sprite/palette.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
src/pp/pp_res/sprite/palette2.ase (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -88,7 +88,7 @@ void S_TickForever(WaveLaneCtx *lane)
while (!shutdown) while (!shutdown)
{ {
shutdown = Atomic32Fetch(&S.shutdown); shutdown = Atomic32Fetch(&S.shutdown);
P_tl.debug_draw_enabled = TweakBool("Simulation debug draw", 1); P_tl.debug_draw_enabled = TweakBool("Simulation debug draw", 0);
ResetArena(frame_arena); ResetArena(frame_arena);
////////////////////////////// //////////////////////////////

View File

@ -345,7 +345,7 @@ void V_TickForever(WaveLaneCtx *lane)
const f32 zoom_rate = 1.50; const f32 zoom_rate = 1.50;
const f32 min_zoom = 0.03; const f32 min_zoom = 0.03;
const f32 max_zoom = 15.0; const f32 max_zoom = 15.0;
const f32 meters_per_draw_width = 18; const f32 meters_per_draw_width = 16;
NET_PipeHandle net_pipe = NET_AcquirePipe(); NET_PipeHandle net_pipe = NET_AcquirePipe();
BB_Buff packer_bb = BB_AcquireDynamicBuff(Gibi(64)); BB_Buff packer_bb = BB_AcquireDynamicBuff(Gibi(64));
@ -1306,8 +1306,8 @@ void V_TickForever(WaveLaneCtx *lane)
{ {
// How many buffered commands of ours we'd like the server to have // How many buffered commands of ours we'd like the server to have
i64 target_buffered_controls_count = 1; i64 target_buffered_controls_count = 1;
f64 rtt_bias_factor = 10.0;
f64 rtt_bias_factor = 5.0;
f64 dilation_factor = SmoothstepF64( f64 dilation_factor = SmoothstepF64(
-(SIM_TICKS_PER_SECOND * smoothed_rtt * rtt_bias_factor), -(SIM_TICKS_PER_SECOND * smoothed_rtt * rtt_bias_factor),
(SIM_TICKS_PER_SECOND * smoothed_rtt * rtt_bias_factor), (SIM_TICKS_PER_SECOND * smoothed_rtt * rtt_bias_factor),
@ -3615,7 +3615,7 @@ void V_TickForever(WaveLaneCtx *lane)
} }
UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y); UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y);
{ {
UI_BuildLabelF("Ping: %F", FmtFloat(smoothed_rtt * 1000, .p = 3)); UI_BuildLabelF("RTT: %Fms", FmtFloat(smoothed_rtt * 1000, .p = 3));
UI_BuildLabelF("Client send: %F MiB", FmtFloat(CeilF64((f64)vis_pipe_stats.total_bytes_sent / 1024) / 1024, .p = 3)); UI_BuildLabelF("Client send: %F MiB", FmtFloat(CeilF64((f64)vis_pipe_stats.total_bytes_sent / 1024) / 1024, .p = 3));
UI_BuildLabelF("Client recv: %F MiB", FmtFloat(CeilF64((f64)vis_pipe_stats.total_bytes_received / 1024) / 1024, .p = 3)); UI_BuildLabelF("Client recv: %F MiB", FmtFloat(CeilF64((f64)vis_pipe_stats.total_bytes_received / 1024) / 1024, .p = 3));
UI_BuildLabelF("Server send: %F MiB", FmtFloat(CeilF64((f64)sim_pipe_stats.total_bytes_sent / 1024) / 1024, .p = 3)); UI_BuildLabelF("Server send: %F MiB", FmtFloat(CeilF64((f64)sim_pipe_stats.total_bytes_sent / 1024) / 1024, .p = 3));
@ -3692,12 +3692,16 @@ void V_TickForever(WaveLaneCtx *lane)
UI_Key board_key = UI_KeyF("scoreboard"); UI_Key board_key = UI_KeyF("scoreboard");
Vec4 board_bg = VEC4(0, 0, 0, 0.50); Vec4 board_bg = VEC4(0, 0, 0, 1);
f32 opacity = 0.75;
UI_Size board_width = UI_FNT(50, 0); UI_Size board_width = UI_FNT(50, 0);
UI_Size board_height = UI_FNT(20, 0); UI_Size board_height = UI_FNT(20, 0);
Vec2 pos = VEC2(frame->ui_dims.x / 2, 50); Vec2 pos = VEC2(frame->ui_dims.x / 2, 50);
UI_PushCP(UI_NilKey);
{
UI_Push(Tint, VEC4(1, 1, 1, opacity));
UI_SetNext(Anchor, UI_Region_Top); UI_SetNext(Anchor, UI_Region_Top);
UI_SetNext(Width, board_width); UI_SetNext(Width, board_width);
UI_SetNext(Height, board_height); UI_SetNext(Height, board_height);
@ -3744,6 +3748,8 @@ void V_TickForever(WaveLaneCtx *lane)
} }
UI_PopCP(UI_TopCP()); UI_PopCP(UI_TopCP());
} }
UI_PopCP(UI_TopCP());
}
////////////////////////////// //////////////////////////////
//- Build console UI //- Build console UI
@ -4315,12 +4321,12 @@ void V_TickForever(WaveLaneCtx *lane)
// FIXME: Remove this (testing) // FIXME: Remove this (testing)
if (frame->held_buttons[Button_R] && !prev_frame->held_buttons[Button_R]) // if (frame->held_buttons[Button_R] && !prev_frame->held_buttons[Button_R])
{ // {
LogDebugF("Sending test payload"); // LogDebugF("Sending test payload");
NET_Send(net_pipe, frame->sim_key, STRING(P_TilesCount, predict_world->tiles), NET_SendFlag_None); // NET_Send(net_pipe, frame->sim_key, STRING(P_TilesCount, predict_world->tiles), NET_SendFlag_None);
// NET_Send(net_pipe, frame->sim_key, Lit("Hello there!"), NET_SendFlag_None); // // NET_Send(net_pipe, frame->sim_key, Lit("Hello there!"), NET_SendFlag_None);
} // }

View File

@ -63,7 +63,7 @@ ComputeShader(V_ClearParticlesCS, 64)
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Backdrop shaders //~ Backdrop
ComputeShader2D(V_BackdropCS, 8, 8) ComputeShader2D(V_BackdropCS, 8, 8)
{ {
@ -270,7 +270,7 @@ ComputeShader2D(V_BackdropCS, 8, 8)
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Quad shaders //~ Quads
////////////////////////////// //////////////////////////////
//- Vertex shader //- Vertex shader
@ -311,7 +311,7 @@ PixelShader(V_DQuadPS, V_DQuadPSOutput, V_DQuadPSInput input)
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Particle simulation shaders //~ Particle simulation
////////////////////////////// //////////////////////////////
//- Particle emitter shader //- Particle emitter shader
@ -461,7 +461,7 @@ ComputeShader(V_SimParticlesCS, 64)
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Shape shaders //~ Shapes
////////////////////////////// //////////////////////////////
//- Vertex shader //- Vertex shader
@ -493,7 +493,7 @@ PixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input)
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Overlay shaders //~ Overlay
////////////////////////////// //////////////////////////////
//- Vertex shader //- Vertex shader

View File

@ -53,21 +53,21 @@ Vec4 V_DryColor(Vec4 color, f32 dryness);
ComputeShader2D(V_ClearCellsCS, 8, 8); ComputeShader2D(V_ClearCellsCS, 8, 8);
ComputeShader(V_ClearParticlesCS, 64); ComputeShader(V_ClearParticlesCS, 64);
//- Backdrop shaders //- Backdrop
ComputeShader2D(V_BackdropCS, 8, 8); ComputeShader2D(V_BackdropCS, 8, 8);
//- Quad shaders //- Quads
VertexShader(V_DQuadVS, V_DQuadPSInput); VertexShader(V_DQuadVS, V_DQuadPSInput);
PixelShader(V_DQuadPS, V_DQuadPSOutput, V_DQuadPSInput input); PixelShader(V_DQuadPS, V_DQuadPSOutput, V_DQuadPSInput input);
//- Particle simulation shaders //- Particle simulation
ComputeShader(V_EmitParticlesCS, 64); ComputeShader(V_EmitParticlesCS, 64);
ComputeShader(V_SimParticlesCS, 64); ComputeShader(V_SimParticlesCS, 64);
//- Shape shaders //- Shapes
VertexShader(V_DVertVS, V_DVertPSInput); VertexShader(V_DVertVS, V_DVertPSInput);
PixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input); PixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input);
//- Overlay shaders //- Overlay
VertexShader(V_OverlayVS, V_OverlayPSInput); VertexShader(V_OverlayVS, V_OverlayPSInput);
PixelShader(V_OverlayPS, V_OverlayPSOutput, V_OverlayPSInput input); PixelShader(V_OverlayPS, V_OverlayPSOutput, V_OverlayPSInput input);

View File

@ -1,5 +1,5 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Rect shaders //~ Rects
////////////////////////////// //////////////////////////////
//- Vertex shader //- Vertex shader
@ -115,7 +115,7 @@ PixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input)
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Blit shaders //~ Blit
////////////////////////////// //////////////////////////////
//- Vertex shader //- Vertex shader

View File

@ -35,7 +35,7 @@ Struct(UI_BlitPSOutput)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Shaders //~ Shaders
//- Rect //- Rects
VertexShader(UI_DRectVS, UI_DRectPSInput); VertexShader(UI_DRectVS, UI_DRectPSInput);
PixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input); PixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input);