formatting
This commit is contained in:
parent
0c9dd684af
commit
5ad14b2dfd
27
src/config.h
27
src/config.h
@ -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)
|
||||||
|
|||||||
@ -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)) })
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
237
src/pp/pp.c
237
src/pp/pp.c
@ -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,86 +1611,31 @@ void P_StepFrame(P_Frame *frame)
|
|||||||
|
|
||||||
// TODO: Not like this
|
// TODO: Not like this
|
||||||
|
|
||||||
for (P_Ent *ent0 = P_FirstEnt(frame); !P_IsEntNil(ent0); ent0 = P_NextEnt(ent0))
|
if (!is_predicting)
|
||||||
{
|
{
|
||||||
if (ent0->is_guy)
|
for (P_Ent *ent0 = P_FirstEnt(frame); !P_IsEntNil(ent0); ent0 = P_NextEnt(ent0))
|
||||||
{
|
{
|
||||||
P_Shape shape0 = P_WorldShapeFromEnt(ent0);
|
if (ent0->is_guy)
|
||||||
for (P_Ent *ent1 = P_FirstEnt(frame); !P_IsEntNil(ent1); ent1 = P_NextEnt(ent1))
|
|
||||||
{
|
{
|
||||||
if (ent1->is_guy && ent1->key.v > ent0->key.v)
|
P_Shape shape0 = P_WorldShapeFromEnt(ent0);
|
||||||
|
for (P_Ent *ent1 = P_FirstEnt(frame); !P_IsEntNil(ent1); ent1 = P_NextEnt(ent1))
|
||||||
{
|
{
|
||||||
P_Shape shape1 = P_WorldShapeFromEnt(ent1);
|
if (ent1->is_guy && ent1->key.v > ent0->key.v)
|
||||||
|
|
||||||
// TODO: World query
|
|
||||||
P_CollisionResult collision = P_CollisionResultFromShapes(shape0, shape1);
|
|
||||||
if (collision.collision_points_count > 0)
|
|
||||||
{
|
{
|
||||||
// FIXME: Key lookup
|
P_Shape shape1 = P_WorldShapeFromEnt(ent1);
|
||||||
P_Constraint *constraint = 0;
|
|
||||||
|
// TODO: World query
|
||||||
|
P_CollisionResult collision = P_CollisionResultFromShapes(shape0, shape1);
|
||||||
|
if (collision.collision_points_count > 0)
|
||||||
{
|
{
|
||||||
b32 match = 0;
|
// FIXME: Key lookup
|
||||||
for (i64 constraint_idx = 0; constraint_idx < frame->constraints_count; ++constraint_idx)
|
P_Constraint *constraint = 0;
|
||||||
{
|
{
|
||||||
constraint = &frame->constraints[constraint_idx];
|
|
||||||
if (P_MatchKey(constraint->ent0, ent0->key) && P_MatchKey(constraint->ent1, ent1->key))
|
|
||||||
{
|
|
||||||
match = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!match)
|
|
||||||
{
|
|
||||||
if (frame->constraints_count < frame->constraints_cap)
|
|
||||||
{
|
|
||||||
constraint = &frame->constraints[frame->constraints_count];
|
|
||||||
frame->constraints_count += 1;
|
|
||||||
ZeroStruct(constraint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (constraint)
|
|
||||||
{
|
|
||||||
constraint->flags = P_ConstraintFlag_Gentle | P_ConstraintFlag_NoWarmStart;
|
|
||||||
constraint->last_touched_tick = frame->tick;
|
|
||||||
constraint->normal = collision.collision_normal;
|
|
||||||
// constraint->friction = SqrtF32(ent0->friction * ent1->friction);
|
|
||||||
constraint->friction = 0;
|
|
||||||
|
|
||||||
// TODO: Real masses
|
|
||||||
f32 inv_m0 = 10;
|
|
||||||
f32 inv_m1 = 10;
|
|
||||||
f32 inv_i0 = 0;
|
|
||||||
f32 inv_i1 = 0;
|
|
||||||
|
|
||||||
// Treat non-predicted guys as infinite-mass
|
|
||||||
if (is_predicting && ent0 != local_guy)
|
|
||||||
{
|
|
||||||
inv_m0 = 0;
|
|
||||||
}
|
|
||||||
if (is_predicting && ent1 != local_guy)
|
|
||||||
{
|
|
||||||
inv_m1 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
constraint->ent0 = ent0->key;
|
|
||||||
constraint->ent1 = ent1->key;
|
|
||||||
// constraint->static_center1 = shape1.center_of_mass;
|
|
||||||
|
|
||||||
constraint->inv_m0 = inv_m0;
|
|
||||||
constraint->inv_m1 = inv_m1;
|
|
||||||
constraint->inv_i0 = inv_i0;
|
|
||||||
constraint->inv_i1 = inv_i1;
|
|
||||||
|
|
||||||
// Delete old contacts that are no longer present
|
|
||||||
for (i32 contact_point_idx = 0; contact_point_idx < constraint->points_count; ++contact_point_idx)
|
|
||||||
{
|
|
||||||
P_ContactPoint *contact = &constraint->points[contact_point_idx];
|
|
||||||
u32 id = contact->id;
|
|
||||||
b32 match = 0;
|
b32 match = 0;
|
||||||
for (i32 collision_point_idx = 0; collision_point_idx < collision.collision_points_count; ++collision_point_idx)
|
for (i64 constraint_idx = 0; constraint_idx < frame->constraints_count; ++constraint_idx)
|
||||||
{
|
{
|
||||||
if (collision.collision_points[collision_point_idx].id == id)
|
constraint = &frame->constraints[constraint_idx];
|
||||||
|
if (P_MatchKey(constraint->ent0, ent0->key) && P_MatchKey(constraint->ent1, ent1->key))
|
||||||
{
|
{
|
||||||
match = 1;
|
match = 1;
|
||||||
break;
|
break;
|
||||||
@ -1698,60 +1643,118 @@ void P_StepFrame(P_Frame *frame)
|
|||||||
}
|
}
|
||||||
if (!match)
|
if (!match)
|
||||||
{
|
{
|
||||||
// Delete contact by replacing with last in array
|
if (frame->constraints_count < frame->constraints_cap)
|
||||||
*contact = constraint->points[constraint->points_count - 1];
|
{
|
||||||
constraint->points_count -= 1;
|
constraint = &frame->constraints[frame->constraints_count];
|
||||||
contact_point_idx -= 1;
|
frame->constraints_count += 1;
|
||||||
|
ZeroStruct(constraint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (constraint)
|
||||||
// Create / update contacts from collision
|
|
||||||
for (i32 collision_point_idx = 0; collision_point_idx < collision.collision_points_count; ++collision_point_idx)
|
|
||||||
{
|
{
|
||||||
P_CollisionPoint collision_point = collision.collision_points[collision_point_idx];
|
constraint->flags = P_ConstraintFlag_Gentle | P_ConstraintFlag_NoWarmStart;
|
||||||
|
constraint->last_touched_tick = frame->tick;
|
||||||
|
constraint->normal = collision.collision_normal;
|
||||||
|
// constraint->friction = SqrtF32(ent0->friction * ent1->friction);
|
||||||
|
constraint->friction = 0;
|
||||||
|
|
||||||
u32 id = collision_point.id;
|
// TODO: Real masses
|
||||||
P_ContactPoint *contact = 0;
|
f32 inv_m0 = 10;
|
||||||
|
f32 inv_m1 = 10;
|
||||||
|
f32 inv_i0 = 0;
|
||||||
|
f32 inv_i1 = 0;
|
||||||
|
|
||||||
|
// Treat non-predicted guys as infinite-mass
|
||||||
|
if (is_predicting && ent0 != local_guy)
|
||||||
{
|
{
|
||||||
for (i32 contact_point_idx = 0; contact_point_idx < constraint->points_count; ++contact_point_idx)
|
inv_m0 = 0;
|
||||||
|
}
|
||||||
|
if (is_predicting && ent1 != local_guy)
|
||||||
|
{
|
||||||
|
inv_m1 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
constraint->ent0 = ent0->key;
|
||||||
|
constraint->ent1 = ent1->key;
|
||||||
|
// constraint->static_center1 = shape1.center_of_mass;
|
||||||
|
|
||||||
|
constraint->inv_m0 = inv_m0;
|
||||||
|
constraint->inv_m1 = inv_m1;
|
||||||
|
constraint->inv_i0 = inv_i0;
|
||||||
|
constraint->inv_i1 = inv_i1;
|
||||||
|
|
||||||
|
// Delete old contacts that are no longer present
|
||||||
|
for (i32 contact_point_idx = 0; contact_point_idx < constraint->points_count; ++contact_point_idx)
|
||||||
|
{
|
||||||
|
P_ContactPoint *contact = &constraint->points[contact_point_idx];
|
||||||
|
u32 id = contact->id;
|
||||||
|
b32 match = 0;
|
||||||
|
for (i32 collision_point_idx = 0; collision_point_idx < collision.collision_points_count; ++collision_point_idx)
|
||||||
{
|
{
|
||||||
P_ContactPoint *tmp = &constraint->points[contact_point_idx];
|
if (collision.collision_points[collision_point_idx].id == id)
|
||||||
if (tmp->id == id)
|
|
||||||
{
|
{
|
||||||
contact = tmp;
|
match = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!contact)
|
if (!match)
|
||||||
{
|
{
|
||||||
contact = &constraint->points[constraint->points_count];
|
// Delete contact by replacing with last in array
|
||||||
constraint->points_count += 1;
|
*contact = constraint->points[constraint->points_count - 1];
|
||||||
ZeroStruct(contact);
|
constraint->points_count -= 1;
|
||||||
|
contact_point_idx -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contact->id = id;
|
|
||||||
|
|
||||||
Vec2 vcp0 = SubVec2(collision_point.p, shape0.center_of_mass);
|
// Create / update contacts from collision
|
||||||
Vec2 vcp1 = SubVec2(collision_point.p, shape1.center_of_mass);
|
for (i32 collision_point_idx = 0; collision_point_idx < collision.collision_points_count; ++collision_point_idx)
|
||||||
|
{
|
||||||
|
P_CollisionPoint collision_point = collision.collision_points[collision_point_idx];
|
||||||
|
|
||||||
contact->vcp0 = vcp0;
|
u32 id = collision_point.id;
|
||||||
contact->vcp1 = vcp1;
|
P_ContactPoint *contact = 0;
|
||||||
contact->starting_separation = collision_point.separation;
|
{
|
||||||
|
for (i32 contact_point_idx = 0; contact_point_idx < constraint->points_count; ++contact_point_idx)
|
||||||
|
{
|
||||||
|
P_ContactPoint *tmp = &constraint->points[contact_point_idx];
|
||||||
|
if (tmp->id == id)
|
||||||
|
{
|
||||||
|
contact = tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!contact)
|
||||||
|
{
|
||||||
|
contact = &constraint->points[constraint->points_count];
|
||||||
|
constraint->points_count += 1;
|
||||||
|
ZeroStruct(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contact->id = id;
|
||||||
|
|
||||||
// Debug draw
|
Vec2 vcp0 = SubVec2(collision_point.p, shape0.center_of_mass);
|
||||||
// {
|
Vec2 vcp1 = SubVec2(collision_point.p, shape1.center_of_mass);
|
||||||
// // P_Ent *ent0 = P_EntFromKey(frame, constraint->ent0);
|
|
||||||
// // P_Ent *ent1 = P_EntFromKey(frame, constraint->ent1);
|
contact->vcp0 = vcp0;
|
||||||
// Vec2 normal = constraint->normal;
|
contact->vcp1 = vcp1;
|
||||||
// Vec2 center0 = Zi;
|
contact->starting_separation = collision_point.separation;
|
||||||
// Vec2 center1 = Zi;
|
|
||||||
// if (!P_IsEntNil(ent0)) center0 = P_WorldShapeFromEnt(ent0).center_of_mass;
|
// Debug draw
|
||||||
// if (!P_IsEntNil(ent1)) center1 = P_WorldShapeFromEnt(ent1).center_of_mass;
|
// {
|
||||||
// Vec2 p0 = AddVec2(center0, vcp0);
|
// // P_Ent *ent0 = P_EntFromKey(frame, constraint->ent0);
|
||||||
// Vec2 p1 = AddVec2(center1, vcp1);
|
// // P_Ent *ent1 = P_EntFromKey(frame, constraint->ent1);
|
||||||
// P_DebugDrawPoint(p0, Color_Cyan);
|
// Vec2 normal = constraint->normal;
|
||||||
// P_DebugDrawLine(p0, AddVec2(p0, normal), Color_White);
|
// Vec2 center0 = Zi;
|
||||||
// }
|
// Vec2 center1 = Zi;
|
||||||
|
// if (!P_IsEntNil(ent0)) center0 = P_WorldShapeFromEnt(ent0).center_of_mass;
|
||||||
|
// if (!P_IsEntNil(ent1)) center1 = P_WorldShapeFromEnt(ent1).center_of_mass;
|
||||||
|
// Vec2 p0 = AddVec2(center0, vcp0);
|
||||||
|
// Vec2 p1 = AddVec2(center1, vcp1);
|
||||||
|
// P_DebugDrawPoint(p0, Color_Cyan);
|
||||||
|
// P_DebugDrawLine(p0, AddVec2(p0, normal), Color_White);
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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
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
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
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
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
BIN
src/pp/pp_res/sprite/palette2.ase
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -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);
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|||||||
@ -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,55 +3692,61 @@ 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_SetNext(Anchor, UI_Region_Top);
|
UI_PushCP(UI_NilKey);
|
||||||
UI_SetNext(Width, board_width);
|
|
||||||
UI_SetNext(Height, board_height);
|
|
||||||
UI_SetNext(FloatingPos, pos);
|
|
||||||
UI_SetNext(BackgroundColor, board_bg);
|
|
||||||
UI_SetNext(Flags, UI_BoxFlag_Floating);
|
|
||||||
UI_PushCP(UI_BuildColumnEx(board_key));
|
|
||||||
{
|
{
|
||||||
UI_BuildSpacer(spacing_sz, Axis_Y);
|
UI_Push(Tint, VEC4(1, 1, 1, opacity));
|
||||||
for (BoardRow *board_row = first_board_row; board_row; board_row = board_row->next)
|
UI_SetNext(Anchor, UI_Region_Top);
|
||||||
|
UI_SetNext(Width, board_width);
|
||||||
|
UI_SetNext(Height, board_height);
|
||||||
|
UI_SetNext(FloatingPos, pos);
|
||||||
|
UI_SetNext(BackgroundColor, board_bg);
|
||||||
|
UI_SetNext(Flags, UI_BoxFlag_Floating);
|
||||||
|
UI_PushCP(UI_BuildColumnEx(board_key));
|
||||||
{
|
{
|
||||||
UI_SetNext(Width, UI_GROW(1, 1));
|
UI_BuildSpacer(spacing_sz, Axis_Y);
|
||||||
UI_SetNext(Height, UI_FNT(2.5, 0));
|
for (BoardRow *board_row = first_board_row; board_row; board_row = board_row->next)
|
||||||
UI_SetNext(Tint, 0);
|
|
||||||
UI_SetNext(ChildAlignment, UI_Region_Left);
|
|
||||||
UI_PushCP(UI_BuildRow()); // Scoreboard row
|
|
||||||
{
|
{
|
||||||
UI_BuildSpacer(spacing_sz, Axis_X);
|
UI_SetNext(Width, UI_GROW(1, 1));
|
||||||
UI_SetNext(Width, name_sz);
|
UI_SetNext(Height, UI_FNT(2.5, 0));
|
||||||
UI_PushCP(UI_BuildColumn()); // Player name column
|
UI_SetNext(Tint, 0);
|
||||||
|
UI_SetNext(ChildAlignment, UI_Region_Left);
|
||||||
|
UI_PushCP(UI_BuildRow()); // Scoreboard row
|
||||||
{
|
{
|
||||||
UI_SetNext(FontSize, UI_Top(FontSize) * theme.h2);
|
UI_BuildSpacer(spacing_sz, Axis_X);
|
||||||
UI_BuildLabelF("Player: \"%F\"", FmtString(board_row->name));
|
UI_SetNext(Width, name_sz);
|
||||||
|
UI_PushCP(UI_BuildColumn()); // Player name column
|
||||||
|
{
|
||||||
|
UI_SetNext(FontSize, UI_Top(FontSize) * theme.h2);
|
||||||
|
UI_BuildLabelF("Player: \"%F\"", FmtString(board_row->name));
|
||||||
|
}
|
||||||
|
UI_PopCP(UI_TopCP());
|
||||||
|
|
||||||
|
UI_BuildSpacer(spacing_sz, Axis_X);
|
||||||
|
UI_SetNext(Width, ping_sz);
|
||||||
|
UI_PushCP(UI_BuildColumn()); // Ping column
|
||||||
|
{
|
||||||
|
UI_SetNext(FontSize, UI_Top(FontSize) * theme.h2);
|
||||||
|
UI_BuildLabelF("Ping: %F ", FmtFloat(board_row->ping, .p = 2));
|
||||||
|
}
|
||||||
|
UI_PopCP(UI_TopCP());
|
||||||
}
|
}
|
||||||
UI_PopCP(UI_TopCP());
|
UI_PopCP(UI_TopCP());
|
||||||
|
|
||||||
UI_BuildSpacer(spacing_sz, Axis_X);
|
if (board_row->next)
|
||||||
UI_SetNext(Width, ping_sz);
|
|
||||||
UI_PushCP(UI_BuildColumn()); // Ping column
|
|
||||||
{
|
{
|
||||||
UI_SetNext(FontSize, UI_Top(FontSize) * theme.h2);
|
UI_BuildDivider(UI_PIX(1, 1), theme.col.divider, Axis_Y);
|
||||||
UI_BuildLabelF("Ping: %F ", FmtFloat(board_row->ping, .p = 2));
|
|
||||||
}
|
}
|
||||||
UI_PopCP(UI_TopCP());
|
|
||||||
}
|
|
||||||
UI_PopCP(UI_TopCP());
|
|
||||||
|
|
||||||
if (board_row->next)
|
|
||||||
{
|
|
||||||
UI_BuildDivider(UI_PIX(1, 1), theme.col.divider, Axis_Y);
|
|
||||||
}
|
}
|
||||||
|
UI_BuildSpacer(spacing_sz, Axis_Y);
|
||||||
}
|
}
|
||||||
UI_BuildSpacer(spacing_sz, Axis_Y);
|
UI_PopCP(UI_TopCP());
|
||||||
}
|
}
|
||||||
UI_PopCP(UI_TopCP());
|
UI_PopCP(UI_TopCP());
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user