Xtra profiling blocks

main
Cameron Murphy Reikes 2 years ago
parent a8157f076b
commit 17cebee22e

@ -58,7 +58,6 @@
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<EnableASAN>false</EnableASAN>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug No Host|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug No Host|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>

Binary file not shown.

@ -2492,21 +2492,28 @@ void process(struct GameState *gs, double dt, bool is_subframe)
{ {
cpVect pos_rel_sun = (cpvsub(entity_pos(e), (entity_pos(i.sun)))); cpVect pos_rel_sun = (cpvsub(entity_pos(e), (entity_pos(i.sun))));
cpFloat sqdist = cpvlengthsq(pos_rel_sun); cpFloat sqdist = cpvlengthsq(pos_rel_sun);
if (!e->is_grid) // grids aren't damaged (this edge case sucks!) if (!e->is_grid) // grids aren't damaged (this edge case sucks!)
{ {
sqdist = cpvlengthsq(cpvsub((entity_pos(e)), (entity_pos(i.sun)))); PROFILE_SCOPE("Grid processing")
if (sqdist < (i.sun->sun_radius * i.sun->sun_radius))
{ {
e->damage += 10.0 * dt; sqdist = cpvlengthsq(cpvsub((entity_pos(e)), (entity_pos(i.sun))));
if (sqdist < (i.sun->sun_radius * i.sun->sun_radius))
{
e->damage += 10.0 * dt;
}
} }
} }
if (e->body != NULL) if (e->body != NULL)
{ {
cpVect accel = sun_gravity_accel_for_entity(e, i.sun); PROFILE_SCOPE("Body processing")
cpVect new_vel = entity_vel(gs, e); {
new_vel = cpvadd(new_vel, cpvmult(accel, dt)); cpVect accel = sun_gravity_accel_for_entity(e, i.sun);
cpBodySetVelocity(e->body, (new_vel)); cpVect new_vel = entity_vel(gs, e);
new_vel = cpvadd(new_vel, cpvmult(accel, dt));
cpBodySetVelocity(e->body, (new_vel));
}
} }
} }
} }

@ -1,4 +1,5 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Take flight // Take flight
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1559,8 +1560,6 @@ static void frame(void)
} }
} }
// dbg_rect(before_reprediction);
// gameplay // gameplay
ui(false, dt, width, height); // if ui button is pressed before game logic, set the pressed to ui(false, dt, width, height); // if ui button is pressed before game logic, set the pressed to
// false so it doesn't propagate from the UI modal/button // false so it doesn't propagate from the UI modal/button

@ -25,6 +25,7 @@
// started in a thread from host // started in a thread from host
void server(void *info_raw) void server(void *info_raw)
{ {
init_profiling_mythread(1);
ServerThreadInfo *info = (ServerThreadInfo *)info_raw; ServerThreadInfo *info = (ServerThreadInfo *)info_raw;
const char *world_save_name = info->world_save; const char *world_save_name = info->world_save;
#ifdef PROFILING #ifdef PROFILING
@ -38,7 +39,6 @@ void server(void *info_raw)
gs.server_side_computing = true; gs.server_side_computing = true;
Log("Allocated %zu bytes for entities\n", entities_size); Log("Allocated %zu bytes for entities\n", entities_size);
init_profiling_mythread(1);
create_initial_world(&gs); create_initial_world(&gs);

@ -52,7 +52,7 @@
#define SOLAR_ENERGY_PER_SECOND 0.09f #define SOLAR_ENERGY_PER_SECOND 0.09f
#define DAMAGE_TO_PLAYER_PER_BLOCK 0.1f #define DAMAGE_TO_PLAYER_PER_BLOCK 0.1f
#define BATTERY_CAPACITY 1.5f #define BATTERY_CAPACITY 1.5f
#define PLAYER_ENERGY_RECHARGE_PER_SECOND 0.2f #define PLAYER_ENERGY_RECHARGE_PER_SECOND 0.2
#define EXPLOSION_TIME 0.5f #define EXPLOSION_TIME 0.5f
#define EXPLOSION_DAMAGE_PER_SEC 10.0f #define EXPLOSION_DAMAGE_PER_SEC 10.0f
#define EXPLOSION_DAMAGE_THRESHOLD 0.2f // how much damage until it explodes #define EXPLOSION_DAMAGE_THRESHOLD 0.2f // how much damage until it explodes

Loading…
Cancel
Save