Physics: Freeze all non-clients
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Physics: Freeze all non-clients
DarkPlaces has a really cool cvar (sv_freezenonclients) that stops the physics and QuakeC for everything except players. Basically, the world freezes and the monsters stop and you can go around and tour and inspect the world. Particles stay where they are, falling things stop in mid-air, etc.
Sometimes when you are working on a single player mod, you just want everything to stop moving beyond what "notarget" and "god" and "noclip" have to offer.
Adding sv_freezenonclients...
1. Create and register the cvar sv_freezenonclients.
2. In sv_phys.c
Locate the SV_Physics function, we will be changing this ...
- Code: Select all
/*
================
SV_Physics
================
*/
void SV_Physics (void)
{
int i;
edict_t *ent;
.
.
.
3. Create an integer variable called entity_cap
void SV_Physics (void)
{
int i;
int entity_cap; // For sv_freezenonclients
edict_t *ent;
4. Conditionally run the physics on all the entities or just players + the world instead of all the entities.
// treat each object in turn
ent = sv.edicts;
if (sv_freezenonclients.value)
entity_cap = svs.maxclients + 1; // Only run physics on clients and the world
else
entity_cap = sv.num_edicts;
for (i=0 ; i<entity_cap ; i++, ent = NEXT_EDICT(ent))
//old was: for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
5. Don't advance the server time. Go to bottom of function and add the yellow.
if (!sv_freezenonclients.value)
sv.time += host_frametime;
}
6. Start a map. Run around and then do "sv_freezenonclients 1" in the console.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Ha ha.. thanks Baker.
The code is in quakespasm subversion - at least for the moment - as not sure how useful it is. Shame you can't have some fun and shoot them up while frozen.
svn co https://quakespasm.svn.sourceforge.net/ ... pasm/trunk -r 457
The code is in quakespasm subversion - at least for the moment - as not sure how useful it is. Shame you can't have some fun and shoot them up while frozen.
svn co https://quakespasm.svn.sourceforge.net/ ... pasm/trunk -r 457
- stevenaaus
- Posts: 23
- Joined: Fri Jan 08, 2010 10:15 am
3 posts
• Page 1 of 1
Return to Programming Tutorials
Who is online
Users browsing this forum: No registered users and 1 guest