tweaking
This commit is contained in:
parent
32938a9abe
commit
a3455e07e3
@ -39,7 +39,8 @@
|
|||||||
#define SIM_TILES_PER_UNIT_SQRT (4)
|
#define SIM_TILES_PER_UNIT_SQRT (4)
|
||||||
#define SIM_TILES_PER_CHUNK_SQRT (16)
|
#define SIM_TILES_PER_CHUNK_SQRT (16)
|
||||||
|
|
||||||
#define SIM_TICKS_PER_SECOND 100
|
// #define SIM_TICKS_PER_SECOND 100
|
||||||
|
#define SIM_TICKS_PER_SECOND 64
|
||||||
// Like USER_INTERP_RATIO, but applies to snapshots received by the local sim from the
|
// Like USER_INTERP_RATIO, but applies to snapshots received by the local sim from the
|
||||||
// master sim (how far back in time should the client render the server's state)
|
// master sim (how far back in time should the client render the server's state)
|
||||||
#define SIM_CLIENT_INTERP_RATIO 2.0
|
#define SIM_CLIENT_INTERP_RATIO 2.0
|
||||||
|
|||||||
@ -2900,8 +2900,6 @@ G_ResourceHandle G_PrepareBackbuffer(G_SwapchainHandle swapchain_handle, G_Forma
|
|||||||
hr = IDXGISwapChain1_QueryInterface(swapchain1, &IID_IDXGISwapChain3, (void **)&swapchain3);
|
hr = IDXGISwapChain1_QueryInterface(swapchain1, &IID_IDXGISwapChain3, (void **)&swapchain3);
|
||||||
IDXGISwapChain1_Release(swapchain1);
|
IDXGISwapChain1_Release(swapchain1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
swapchain->d3d_swapchain = swapchain3;
|
swapchain->d3d_swapchain = swapchain3;
|
||||||
swapchain->backbuffers_format = format;
|
swapchain->backbuffers_format = format;
|
||||||
|
|||||||
14
src/pp/pp.c
14
src/pp/pp.c
@ -1,5 +1,5 @@
|
|||||||
P_Ctx P = Zi;
|
P_Ctx P = Zi;
|
||||||
P_ThreadLocalCtx P_tl = Zi;
|
ThreadLocal P_ThreadLocalCtx P_tl = Zi;
|
||||||
|
|
||||||
Readonly P_Ent P_NilEnt = {
|
Readonly P_Ent P_NilEnt = {
|
||||||
.xf = CompXformIdentity,
|
.xf = CompXformIdentity,
|
||||||
@ -22,9 +22,6 @@ void P_Bootstrap(void)
|
|||||||
P_OutputState *output = &P.sim_output_states[i];
|
P_OutputState *output = &P.sim_output_states[i];
|
||||||
output->arena = AcquireArena(Gibi(64));
|
output->arena = AcquireArena(Gibi(64));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize thread state
|
|
||||||
P_tl.debug_arena = AcquireArena(Gibi(64));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -225,6 +222,15 @@ P_Shape P_LocalShapeFromEnt(P_Ent *ent)
|
|||||||
.radius = 0.3,
|
.radius = 0.3,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// f32 player_width = 0.6;
|
||||||
|
// f32 player_height = 0.3;
|
||||||
|
// result = P_ShapeFromDesc(
|
||||||
|
// .mass = 10,
|
||||||
|
// .count = 2,
|
||||||
|
// .points = { VEC2(-player_width / 2 + (player_height / 2), 0), VEC2(player_width / 2 - (player_height / 2), 0) },
|
||||||
|
// .radius = player_height / 2,
|
||||||
|
// );
|
||||||
|
|
||||||
// Rng2 test_rect = Zi;
|
// Rng2 test_rect = Zi;
|
||||||
// test_rect.p0 = VEC2(-1, -1);
|
// test_rect.p0 = VEC2(-1, -1);
|
||||||
// test_rect.p1 = VEC2(1, 1);
|
// test_rect.p1 = VEC2(1, 1);
|
||||||
|
|||||||
@ -22,6 +22,7 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
{
|
{
|
||||||
Arena *perm = PermArena();
|
Arena *perm = PermArena();
|
||||||
Arena *frame_arena = AcquireArena(Gibi(64));
|
Arena *frame_arena = AcquireArena(Gibi(64));
|
||||||
|
P_tl.debug_arena = AcquireArena(Gibi(64));
|
||||||
|
|
||||||
Arena *world_arena = AcquireArena(Gibi(64));
|
Arena *world_arena = AcquireArena(Gibi(64));
|
||||||
P_World *world = 0;
|
P_World *world = 0;
|
||||||
@ -29,6 +30,7 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
// TODO: Real per-client deltas
|
// TODO: Real per-client deltas
|
||||||
b32 has_sent_initial_tick = 0;
|
b32 has_sent_initial_tick = 0;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Sim loop
|
//- Sim loop
|
||||||
|
|
||||||
@ -344,8 +346,8 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
// TODO: Real masses
|
// TODO: Real masses
|
||||||
f32 inv_m0 = 10;
|
f32 inv_m0 = 10;
|
||||||
f32 inv_m1 = 10;
|
f32 inv_m1 = 10;
|
||||||
f32 inv_i0 = 10;
|
f32 inv_i0 = 0;
|
||||||
f32 inv_i1 = 10;
|
f32 inv_i1 = 0;
|
||||||
|
|
||||||
constraint->ent0 = ent0->key;
|
constraint->ent0 = ent0->key;
|
||||||
constraint->ent1 = ent1->key;
|
constraint->ent1 = ent1->key;
|
||||||
@ -775,12 +777,12 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
b32 apply_bias = 1;
|
b32 apply_bias = 1;
|
||||||
if (separation > 0.0)
|
if (separation > 0.0)
|
||||||
{
|
{
|
||||||
/* Speculative */
|
// Speculative
|
||||||
velocity_bias = separation / solver_dt;
|
velocity_bias = separation / solver_dt;
|
||||||
}
|
}
|
||||||
else if (apply_bias)
|
else if (apply_bias)
|
||||||
{
|
{
|
||||||
/* Soft constraint */
|
// Soft constraint
|
||||||
SoftSpring softness = MakeSpring(contact_spring_hz, contact_spring_damp, solver_dt);
|
SoftSpring softness = MakeSpring(contact_spring_hz, contact_spring_damp, solver_dt);
|
||||||
// f32 pushout_velocity = constraint->pushout_velocity;
|
// f32 pushout_velocity = constraint->pushout_velocity;
|
||||||
f32 pushout_velocity = 3.0;
|
f32 pushout_velocity = 3.0;
|
||||||
@ -795,7 +797,7 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
f32 k = contact->inv_normal_mass;
|
f32 k = contact->inv_normal_mass;
|
||||||
|
|
||||||
/* (to be applied along n) */
|
// (to be applied along n)
|
||||||
f32 vn = DotVec2(vrel, normal);
|
f32 vn = DotVec2(vrel, normal);
|
||||||
f32 j = ((k * mass_scale) * (vn - velocity_bias)) - (contact->solved_normal_impulse * impulse_scale);
|
f32 j = ((k * mass_scale) * (vn - velocity_bias)) - (contact->solved_normal_impulse * impulse_scale);
|
||||||
|
|
||||||
@ -825,7 +827,7 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
f32 k = contact->inv_tangent_mass;
|
f32 k = contact->inv_tangent_mass;
|
||||||
|
|
||||||
/* (to be applied along t) */
|
// (to be applied along t)
|
||||||
f32 vt = DotVec2(vrel, tangent);
|
f32 vt = DotVec2(vrel, tangent);
|
||||||
f32 j = vt * k;
|
f32 j = vt * k;
|
||||||
|
|
||||||
|
|||||||
@ -325,6 +325,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
{
|
{
|
||||||
Arena *perm = PermArena();
|
Arena *perm = PermArena();
|
||||||
G_ArenaHandle gpu_perm = G_PermArena();
|
G_ArenaHandle gpu_perm = G_PermArena();
|
||||||
|
P_tl.debug_arena = AcquireArena(Gibi(64));
|
||||||
|
|
||||||
const i32 world_pitch = P_WorldPitch;
|
const i32 world_pitch = P_WorldPitch;
|
||||||
const f32 zoom_rate = 1.50;
|
const f32 zoom_rate = 1.50;
|
||||||
@ -489,7 +490,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
while (!shutdown)
|
while (!shutdown)
|
||||||
{
|
{
|
||||||
shutdown = Atomic32Fetch(&V.shutdown);
|
shutdown = Atomic32Fetch(&V.shutdown);
|
||||||
P_tl.debug_draw_enabled = 1;
|
P_tl.debug_draw_enabled = TweakBool("Vis debug draw", 1);
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Begin frame
|
//- Begin frame
|
||||||
@ -584,7 +585,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
frame->window_restore = BB_ReadString(frame->arena, &br);
|
frame->window_restore = BB_ReadString(frame->arena, &br);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write swapout
|
//- Write swapout
|
||||||
if (swapout)
|
if (swapout)
|
||||||
{
|
{
|
||||||
WriteSwappedState(Lit("pp_vis.swp"), STRING(BB_GetNumBytesWritten(&bw), BB_GetWrittenRaw(&bw)));
|
WriteSwappedState(Lit("pp_vis.swp"), STRING(BB_GetNumBytesWritten(&bw), BB_GetWrittenRaw(&bw)));
|
||||||
@ -3053,6 +3054,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
last_debug_draw_node = P_tl.last_debug_draw_node;
|
last_debug_draw_node = P_tl.last_debug_draw_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Push draws
|
||||||
for (P_DebugDrawNode *n = first_debug_draw_node; n; n = n->next)
|
for (P_DebugDrawNode *n = first_debug_draw_node; n; n = n->next)
|
||||||
{
|
{
|
||||||
Vec4 color = Vec4FromU32(n->srgb32);
|
Vec4 color = Vec4FromU32(n->srgb32);
|
||||||
@ -3085,7 +3087,6 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
{
|
{
|
||||||
P_Shape ui_shape = P_MulXformShape(frame->xf.world_to_ui, n->shape);
|
P_Shape ui_shape = P_MulXformShape(frame->xf.world_to_ui, n->shape);
|
||||||
V_DrawShape(ui_shape, color, detail, V_DrawFlag_Line);
|
V_DrawShape(ui_shape, color, detail, V_DrawFlag_Line);
|
||||||
// V_DrawShape(ui_shape, color, detail, V_DrawFlag_None);
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user