Re: [hlcoders] Sending entities to the client that only a bot can see
What you need to do is merge the PVS/PAS of the bot and the player. SetupVisibility() is where the server DLL can set the PVS to be used in AddToFullPack(). The default implementation just asks the engine to calculate the PVS for the current view entitity. You could ask the engine to calculate the PVS for two viewpoints, but if the engine's implementation of SV_SetFatPVS() is the same as Quake's then this won't work: the PVS is cleared at the start of each call. What you can do is memcopy() the PVS calculated into a buffer and bitwise-or each additional PVS you need, then return a pointer to the buffer. I'm almost certain this would work, although I haven't tested it :) Something like this (again, untested): void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ) { Vector org; edict_t *pView = pClient; static unsigned char visBuffer[MAX_MAP_LEAFS / 8]; // Find the client's PVS if ( pViewEntity ) { pView = pViewEntity; } org = pView-v.origin + pView-v.view_ofs; if ( pView-v.flags FL_DUCKING ) { org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN ); } *pvs = ENGINE_SET_PVS ( (float *)org ); *pas = ENGINE_SET_PAS ( (float *)org ); memcpy( visBuffer, pvs, MAX_MAP_LEAFS / 8 ); for (/* each additional viewpoint */) { *pvs = ENGINE_SET_PVS( /* viewpoint */ ); for (int i = 0; i sizeof pvsBuffer; i++) pvsBuffer[i] |= pvs[i]; } *pvs = pvsBuffer; } From: TheLazy1 [EMAIL PROTECTED] What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders - Email sent from www.ntlworld.com Virus-checked using McAfee(R) Software Visit www.ntlworld.com/security for more information ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
Thanks for that info but the additional viewpoint code causes a crash. Maybe I could send all the entities anyway and filter out the non visible ones client-side? [EMAIL PROTECTED] wrote: What you need to do is merge the PVS/PAS of the bot and the player. SetupVisibility() is where the server DLL can set the PVS to be used in AddToFullPack(). The default implementation just asks the engine to calculate the PVS for the current view entitity. You could ask the engine to calculate the PVS for two viewpoints, but if the engine's implementation of SV_SetFatPVS() is the same as Quake's then this won't work: the PVS is cleared at the start of each call. What you can do is memcopy() the PVS calculated into a buffer and bitwise-or each additional PVS you need, then return a pointer to the buffer. I'm almost certain this would work, although I haven't tested it :) Something like this (again, untested): void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ) { Vector org; edict_t *pView = pClient; static unsigned char visBuffer[MAX_MAP_LEAFS / 8]; // Find the client's PVS if ( pViewEntity ) { pView = pViewEntity; } org = pView-v.origin + pView-v.view_ofs; if ( pView-v.flags FL_DUCKING ) { org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN ); } *pvs = ENGINE_SET_PVS ( (float *)org ); *pas = ENGINE_SET_PAS ( (float *)org ); memcpy( visBuffer, pvs, MAX_MAP_LEAFS / 8 ); for (/* each additional viewpoint */) { *pvs = ENGINE_SET_PVS( /* viewpoint */ ); for (int i = 0; i sizeof pvsBuffer; i++) pvsBuffer[i] |= pvs[i]; } *pvs = pvsBuffer; } From: TheLazy1 [EMAIL PROTECTED] What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders - Email sent from www.ntlworld.com Virus-checked using McAfee(R) Software Visit www.ntlworld.com/security for more information ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
On Wednesday 29 November 2006 1:36 pm, TheLazy1 wrote: Thanks for that info but the additional viewpoint code causes a crash. Maybe I could send all the entities anyway and filter out the non visible ones client-side? That would sort of negate the whole point of PVS in: 1. Reducing bandwidth requirements. 2. Cheating prevention. ;-) -John Sheu ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
Well, split screen play would be limited to listenservers and not allow more than one real client to be connected. Another issue is that if player one is underwater, the second viewport will get the underwater fog effect applied to it. I assume that is being done by the engine so I don't know if it's possible to fix that or not. I might have better luck with HL2 but my computer can barely handle 1 viewport :) John Sheu wrote: On Wednesday 29 November 2006 1:36 pm, TheLazy1 wrote: Thanks for that info but the additional viewpoint code causes a crash. Maybe I could send all the entities anyway and filter out the non visible ones client-side? That would sort of negate the whole point of PVS in: 1. Reducing bandwidth requirements. 2. Cheating prevention. ;-) -John Sheu ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
-- [ Picked text/plain from multipart/alternative ] Thanks for bringing this function to my attention, I was able to add another origin point to the PVS system however i still get some minor flickers. I'd still like to find a way to enter individual entities into the list of displayed entities, clientside if possible, since theres no possible cheating that can be done by displaying the entity I want. On 11/29/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What you need to do is merge the PVS/PAS of the bot and the player. SetupVisibility() is where the server DLL can set the PVS to be used in AddToFullPack(). The default implementation just asks the engine to calculate the PVS for the current view entitity. You could ask the engine to calculate the PVS for two viewpoints, but if the engine's implementation of SV_SetFatPVS() is the same as Quake's then this won't work: the PVS is cleared at the start of each call. What you can do is memcopy() the PVS calculated into a buffer and bitwise-or each additional PVS you need, then return a pointer to the buffer. I'm almost certain this would work, although I haven't tested it :) Something like this (again, untested): void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ) { Vector org; edict_t *pView = pClient; static unsigned char visBuffer[MAX_MAP_LEAFS / 8]; // Find the client's PVS if ( pViewEntity ) { pView = pViewEntity; } org = pView-v.origin + pView-v.view_ofs; if ( pView-v.flags FL_DUCKING ) { org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN ); } *pvs = ENGINE_SET_PVS ( (float *)org ); *pas = ENGINE_SET_PAS ( (float *)org ); memcpy( visBuffer, pvs, MAX_MAP_LEAFS / 8 ); for (/* each additional viewpoint */) { *pvs = ENGINE_SET_PVS( /* viewpoint */ ); for (int i = 0; i sizeof pvsBuffer; i++) pvsBuffer[i] |= pvs[i]; } *pvs = pvsBuffer; } From: TheLazy1 [EMAIL PROTECTED] What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders - Email sent from www.ntlworld.com Virus-checked using McAfee(R) Software Visit www.ntlworld.com/security for more information ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
I tried again and managed to get that code working but only when I used a cheap hack. For some reason I cannot just do pvsBuffer[ x ] |= *pvs[ x ] since it'll just crash, I can however memcpy it into a buffer and do the bitwise OR later. Should I do this with PAS aswell? [EMAIL PROTECTED] wrote: What you need to do is merge the PVS/PAS of the bot and the player. SetupVisibility() is where the server DLL can set the PVS to be used in AddToFullPack(). The default implementation just asks the engine to calculate the PVS for the current view entitity. You could ask the engine to calculate the PVS for two viewpoints, but if the engine's implementation of SV_SetFatPVS() is the same as Quake's then this won't work: the PVS is cleared at the start of each call. What you can do is memcopy() the PVS calculated into a buffer and bitwise-or each additional PVS you need, then return a pointer to the buffer. I'm almost certain this would work, although I haven't tested it :) Something like this (again, untested): void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ) { Vector org; edict_t *pView = pClient; static unsigned char visBuffer[MAX_MAP_LEAFS / 8]; // Find the client's PVS if ( pViewEntity ) { pView = pViewEntity; } org = pView-v.origin + pView-v.view_ofs; if ( pView-v.flags FL_DUCKING ) { org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN ); } *pvs = ENGINE_SET_PVS ( (float *)org ); *pas = ENGINE_SET_PAS ( (float *)org ); memcpy( visBuffer, pvs, MAX_MAP_LEAFS / 8 ); for (/* each additional viewpoint */) { *pvs = ENGINE_SET_PVS( /* viewpoint */ ); for (int i = 0; i sizeof pvsBuffer; i++) pvsBuffer[i] |= pvs[i]; } *pvs = pvsBuffer; } From: TheLazy1 [EMAIL PROTECTED] What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders - Email sent from www.ntlworld.com Virus-checked using McAfee(R) Software Visit www.ntlworld.com/security for more information ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] Sending entities to the client that only a bot can see
What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
-- [ Picked text/plain from multipart/alternative ] I too have been looking for something similar. I have entities that I render on the client that aren't in the client's view according to the server so the entity model flickers in and out when it drags just out of my view and back in. I need to set it to be shown even if its not in the PVS. On 11/28/06, TheLazy1 [EMAIL PROTECTED] wrote: What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
You guys should take a look at how the camera/monitor code does it, as that adds another viewpoint to be rendered that is potentially far from the client. I haven't looked myself, so I can't offer any more than that suggestion right now. From: Joel R. [EMAIL PROTECTED] Reply-To: hlcoders@list.valvesoftware.com To: hlcoders@list.valvesoftware.com Subject: Re: [hlcoders] Sending entities to the client that only a bot can see Date: Tue, 28 Nov 2006 13:48:01 -0600 -- [ Picked text/plain from multipart/alternative ] I too have been looking for something similar. I have entities that I render on the client that aren't in the client's view according to the server so the entity model flickers in and out when it drags just out of my view and back in. I need to set it to be shown even if its not in the PVS. On 11/28/06, TheLazy1 [EMAIL PROTECTED] wrote: What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _ Get free, personalized commercial-free online radio with MSN Radio powered by Pandora http://radio.msn.com/?icid=T002MSN03A07001 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
-- [ Picked text/plain from multipart/alternative ] You can add a point to the player's PVS. The render target camera does it so you can see what it sees. It's serverside and it's something really simple. On 11/28/06, Joel R. [EMAIL PROTECTED] wrote: -- [ Picked text/plain from multipart/alternative ] I too have been looking for something similar. I have entities that I render on the client that aren't in the client's view according to the server so the entity model flickers in and out when it drags just out of my view and back in. I need to set it to be shown even if its not in the PVS. On 11/28/06, TheLazy1 [EMAIL PROTECTED] wrote: What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Sending entities to the client that only a bot can see
I should have mentioned earlier that this is for Half-Life 1, however, if what you said still applies are there any docs outlining that? Garry Newman wrote: -- [ Picked text/plain from multipart/alternative ] You can add a point to the player's PVS. The render target camera does it so you can see what it sees. It's serverside and it's something really simple. On 11/28/06, Joel R. [EMAIL PROTECTED] wrote: -- [ Picked text/plain from multipart/alternative ] I too have been looking for something similar. I have entities that I render on the client that aren't in the client's view according to the server so the entity model flickers in and out when it drags just out of my view and back in. I need to set it to be shown even if its not in the PVS. On 11/28/06, TheLazy1 [EMAIL PROTECTED] wrote: What I'm trying to do is add split screen play to half-life deathmatch, currently I have the client rendering from the view of a bot which in the future will be controlled by additional players through player 1. The problem is that once player one leaves the area of the player two bot, the entities in the bot's view disappear. // Ignore if not the host and not touching a PVS/PAS leaf // If pSet is NULL, then the test will always succeed and the entity will be added to the update if ( ent != host ) { if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) ) { return 0; } } Commenting that code fixes the problem but also causes the client to render every entity in the level causing a noticable drop in performance. Are there any ways around this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders