A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE General Discussion »[Release] Perfect Host Detection Script

Page 2 of 2 Go to page: · 1 · [2] · Prev
Author Topic: [Release] Perfect Host Detection Script (52 messages, Page 2 of 2)
Moderators: Dennis

Nickster5000
Joined: Dec 11, 2010


Posted: Oct 26, 2011 06:16 PM    Msg. 36 of 52       
What does this script do? I know it's a HOST DETECTOR, but what does it benefit?
Edited by ODST_Nick on Oct 26, 2011 at 06:18 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Oct 26, 2011 07:28 PM    Msg. 37 of 52       
It lets you detect whether or not the local client is the host, so you can do stuff (such as spawning vehicles) without clients running specific parts of the code. With the vehicle spawning example, it eliminates the duplicate vehicles clients will get if you don't check whether they're host or not before you spawn them.

Yoyorast Island V2 has quite extensive use of this for example.
Edited by chrisk123999 on Oct 26, 2011 at 07:28 PM


Edit: Realized I messed up the script. Fixed now.
Edited by chrisk123999 on Oct 27, 2011 at 04:27 PM
Edited by chrisk123999 on Apr 15, 2015 at 04:30 PM


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 15, 2015 04:08 PM    Msg. 38 of 52       
Hope people don't mind me bumping this old topic and also hope that Chris is still around - the purpose of this bump is to revisit the host detection script and to maybe refine its behaviour.

I just released the final version of a map that I have been working on for a very long time (http://www.realworldce.com/viewtopic.php?f=39&t=4365&p=41238#p41238).

It includes the perfect host detection script (and the setup in the map that makes it all work) and a vehicle spawning script.

Let me describe the set up...

I have a (very) large room well away from the actual map. This room contains a trigger volume which is very nearly as big as the room itself. Inside the room and therefore inside the trigger volume I have placed all of the vehicles that spawn in the map and have placed the race vehicle netgame flags.

also in this room is a small warthog size box that contains a warthog that is set to NOT spawn by default on any gametypes. There is also a camera placed near this warthog. There is a trigger volume that fits almost exactly around that warthog.

The vehicles in the globals are the default settings - the custom vehicles that are in the map are placed via sapien (ofc i hear you mumble).

Here is the script that handles the host detection and vehicle respawning...


(global bool is_host false)

(global bool is_dedicated false)

(global bool is_race false)

(global short plyrnum 0)

(global unit playercurrent
(unit
(list_get
(players) plyrnum)))

(script startup void barriers
(begin
(begin
(object_set_collideable barrier1 false)
(object_set_collideable barrier2 false))))

(script startup void host_detect
(begin
(if
(=
(list_count
(players)) 0)
(set is_dedicated true))
(object_pvs_set_camera host_cam)
(object_create_anew host_hog)
(sleep 30)
(if
(=
(volume_test_object host_vol host_hog) true)
(begin
(set is_host true)))))

(script startup void vehicle_spawn
(begin
(begin
(sleep_until
(= is_host true))
(if
(= is_host true)
(begin
(object_create_anew veh_red_1)
(object_create_anew veh_red_2)
(object_create_anew veh_red_3)
(object_create_anew veh_red_4)
(object_create_anew veh_red_5)
(object_create_anew veh_red_6)
(object_create_anew veh_blue_1)
(object_create_anew veh_blue_2)
(object_create_anew veh_blue_3)
(object_create_anew veh_blue_4)
(object_create_anew veh_blue_5)
(object_create_anew veh_blue_6)
(object_create_anew veh_extra_1)
(object_create_anew veh_extra_2)
(object_create_anew goose_1)
(object_create_anew goose_2)
(object_create_anew goose_3)
(object_create_anew goose_4)
(object_create_anew goose_5)
(object_create_anew goose_6))))))

(script continuous void vehicle_respawn
(begin
(begin
(if
(= is_host true)
(begin
(if
(=
(volume_test_object syncbox veh_red_1) true)
(begin
(object_teleport veh_red_1 veh_redbase_1)
(object_set_facing veh_red_1 veh_redbase_1)))
(if
(=
(volume_test_object syncbox veh_red_2) true)
(begin
(object_teleport veh_red_2 veh_redbase_2)
(object_set_facing veh_red_2 veh_redbase_2)))
(if
(=
(volume_test_object syncbox veh_red_3) true)
(begin
(object_teleport veh_red_3 veh_redbase_3)
(object_set_facing veh_red_3 veh_redbase_3)))
(if
(=
(volume_test_object syncbox veh_red_4) true)
(begin
(object_teleport veh_red_4 veh_redbase_4)
(object_set_facing veh_red_4 veh_redbase_4)))
(if
(=
(volume_test_object syncbox veh_red_5) true)
(begin
(object_teleport veh_red_5 veh_redbase_5)
(object_set_facing veh_red_5 veh_redbase_5)))
(if
(=
(volume_test_object syncbox veh_red_6) true)
(begin
(object_teleport veh_red_6 veh_redbase_6)
(object_set_facing veh_red_6 veh_redbase_6)))
(if
(=
(volume_test_object syncbox veh_blue_1) true)
(begin
(object_teleport veh_blue_1 veh_bluebase_1)
(object_set_facing veh_blue_1 veh_bluebase_1)))
(if
(=
(volume_test_object syncbox veh_blue_2) true)
(begin
(object_teleport veh_blue_2 veh_bluebase_2)
(object_set_facing veh_blue_2 veh_bluebase_2)))
(if
(=
(volume_test_object syncbox veh_blue_3) true)
(begin
(object_teleport veh_blue_3 veh_bluebase_3)
(object_set_facing veh_blue_3 veh_bluebase_3)))
(if
(=
(volume_test_object syncbox veh_blue_4) true)
(begin
(object_teleport veh_blue_4 veh_bluebase_4)
(object_set_facing veh_blue_4 veh_bluebase_4)))
(if
(=
(volume_test_object syncbox veh_blue_5) true)
(begin
(object_teleport veh_blue_5 veh_bluebase_5)
(object_set_facing veh_blue_5 veh_bluebase_5)))
(if
(=
(volume_test_object syncbox veh_blue_6) true)
(begin
(object_teleport veh_blue_6 veh_bluebase_6)
(object_set_facing veh_blue_6 veh_bluebase_6)))
(if
(=
(volume_test_object syncbox veh_extra_1) true)
(begin
(object_teleport veh_extra_1 veh_police_1)
(object_set_facing veh_extra_1 veh_police_1)))
(if
(=
(volume_test_object syncbox veh_extra_2) true)
(begin
(object_teleport veh_extra_2 veh_police_2)
(object_set_facing veh_extra_2 veh_police_2)))
(if
(=
(volume_test_object syncbox goose_1) true)
(begin
(object_teleport goose_1 veh_goose_1)
(object_set_facing goose_1 veh_goose_1)))
(if
(=
(volume_test_object syncbox goose_2) true)
(begin
(object_teleport goose_2 veh_goose_2)
(object_set_facing goose_2 veh_goose_2)))
(if
(=
(volume_test_object syncbox goose_3) true)
(begin
(object_teleport goose_3 veh_goose_3)
(object_set_facing goose_3 veh_goose_3)))
(if
(=
(volume_test_object syncbox goose_4) true)
(begin
(object_teleport goose_4 veh_goose_4)
(object_set_facing goose_4 veh_goose_4)))
(if
(=
(volume_test_object syncbox goose_5) true)
(begin
(object_teleport goose_5 veh_goose_5)
(object_set_facing goose_5 veh_goose_5)))
(if
(=
(volume_test_object syncbox goose_6) true)
(begin
(object_teleport goose_6 veh_goose_6)
(object_set_facing goose_6 veh_goose_6))))))))

(script startup void titles
(begin
(cinematic_set_title cgtitle)))

(script continuous void increment
(begin
(begin
(set plyrnum
(+ plyrnum 1.00)))
(if
(=
(> plyrnum 15) true)
(begin
(set plyrnum 0)))
(set playercurrent
(unit
(list_get
(players) plyrnum)))))

(script continuous void outofbounds
(begin
(if
(volume_test_object drown playercurrent)
(unit_kill playercurrent))))


Note : All the scripts in the map have been included.

For the most part the vehicle spawning works perfectly on all gametypes (including race), but ocassionally it fails and a player can see duplicate vehicles that they cannot interact with. The issue can be resolved by rejoining the server. I have observed that this seems to happen mostly when the same map is loaded again and players are already in the server - ie at the start of the game.

I wonder if anyone has any more to add to this and perhaps have a look at the scripts and pick out anything that might be causing this to happen - any fix will be too late for my map which is already released, but perhaps we can get a better situation for mappers further down the line.

Sorry for the massively long post;

regards,

Crypt.
Edited by Black Crypt on Apr 15, 2015 at 04:22 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 15, 2015 04:19 PM    Msg. 39 of 52       
It's been a very long time since I've worked with Halo CE, but what you can do is get your players who have the duplicate vehicles check if they were accidentally detected as the host. They can do this by enabling developer mode (through a 3rd party program since it's online) then using a command to check what is_host returns.

inspect is_host


If it returns true, there their may be an issue with the script or possibly the vehicle isn't given enough time to bounce off the host vehicle.
Edited by chrisk123999 on Apr 15, 2015 at 04:20 PM


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 15, 2015 04:59 PM    Msg. 40 of 52       
inspect is_host returns true when the duplicate vehicles appear.

The host vehicle is placed in a very tight box designed to make it easy for the other hog to fall away easily with the host trigger volume very tight to the host hog...



Is there a way to give the other hog time to fall away?

Also, I think maybe the issue is when the same map is reloaded - when the same map is played over and over - like in a test server. It seems to do this only when I am already in the server when the map loads.
Edited by Black Crypt on Apr 15, 2015 at 05:04 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 15, 2015 05:02 PM    Msg. 41 of 52       
Increase the sleep time in the host detection part of the script. It's 30 ticks in the default script. Also the vehicle can be safely put on top of a box without worry about it getting pushed out from the duplicated vehicle (since the client vehicle doesn't exist on the server so it can never really gets moved). Try making the warthog's tires level with the top of that platform thing you have instead of it sitting in it.

Edit: When you say reloaded, are you using sv_reset or loading the map again? (Loading screen shows up).
Edited by chrisk123999 on Apr 15, 2015 at 05:04 PM
Edited by chrisk123999 on Apr 15, 2015 at 05:06 PM
Edited by chrisk123999 on Apr 15, 2015 at 05:08 PM


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 15, 2015 05:11 PM    Msg. 42 of 52       
Added to my last post.

Won't the host hog simply fall into the box anyway?

I will try out the sleep time adjustment.

sv_map_next. If I use sv_map_reset no vehicles appear at all.
Edited by Black Crypt on Apr 15, 2015 at 05:12 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 15, 2015 05:16 PM    Msg. 43 of 52       
The thing is, the client vehicle isn't spawning on top of the host vehicle; it spawns in the same exact spot (inside it) and gets pushed out do to the physics of the game. It doesn't always get pushed upward and possibly can be getting pushed down / sideways.

Just know that when you adjust the sleep time on host detection that it comes at the cost of all your scripts not knowing who the host is until that time is up.

Edit: If you meant the host vehicle falling into the box, I meant change it so there is no box and instead it's sitting on a pedestal.
Edited by chrisk123999 on Apr 15, 2015 at 05:20 PM


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 15, 2015 05:19 PM    Msg. 44 of 52       
So my well designed box might actually be causing the problem? Could I place the host hog on the ground and move the camera and host trigger volume - I dont want to go back in max!


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 15, 2015 05:22 PM    Msg. 45 of 52       
You could always use scenery if you don't want to mess with the terrain again.

At any rate, try to set it up to look sort of like this:



[Vehicle]
_______| |_______


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 17, 2015 03:54 PM    Msg. 46 of 52       
I recorded a video of the host hog on it's new platform. Seems that all of the vehicles are respawning at the location of the first vehicle in the vehicle list and as you will see, those vehicles are moving the host hog from its position.

https://www.youtube.com/watch?v=1SSPWfSeOZk&feature=youtu.be


Edited by Black Crypt on Apr 17, 2015 at 05:12 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 17, 2015 03:56 PM    Msg. 47 of 52       
Quote: --- Original message by: Black Crypt
https://www.youtube.com/watch?v=1SSPWfSeOZk&feature=youtu.be


Says the video is private.


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 17, 2015 04:02 PM    Msg. 48 of 52       
About the video:

Only the host hog should be spawning at the position. All the other vehicles should be spawning on the ground below. They are spawning at the location of the first vehicle in the vehicle list and the trigger volume / script are moving them to the flags set in the map - this still leaves me puzzled as to why they are spawning where they shouldn't be spawning.
Edited by Black Crypt on Apr 17, 2015 at 05:11 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 18, 2015 05:50 PM    Msg. 49 of 52       
Quote: --- Original message by: Black Crypt

About the video:

Only the host hog should be spawning at the position. All the other vehicles should be spawning on the ground below. They are spawning at the location of the first vehicle in the vehicle list and the trigger volume / script are moving them to the flags set in the map - this still leaves me puzzled as to why they are spawning where they shouldn't be spawning.
Edited by Black Crypt on Apr 17, 2015 at 05:11 PM


What gamemode are you in? I think I remember this being an issue with the race gamemode in certain conditions. If I remember right it's when you reset the map .


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 19, 2015 02:19 PM    Msg. 50 of 52       
I've made a video for each gametype. Notice that Race gametype is NOT the only gametype that all the vehicles spawn at the host hog. In fact I think the race gametype is the only one that behaves somewhat normally!

CTF : https://youtu.be/YijGonBBeNw

KOTH : https://youtu.be/CIdfkI4OnWA

Oddball : https://youtu.be/bxA-0VAzn_0

Race : https://youtu.be/bhu45DO7NMU

Slayer : https://youtu.be/50H3MDuXQR4

Here's all of the videos in one playlist : https://www.youtube.com/watch?v=50H3MDuXQR4&list=PLrRW30uHZn49OwOQR76_X-oQc_IgjJE8A
Edited by Black Crypt on Apr 19, 2015 at 02:29 PM


chrisk123999
Joined: Aug 10, 2008

=CE= Chris [Captain] [=]


Posted: Apr 19, 2015 02:24 PM    Msg. 51 of 52       
I think what most people did to fix this was to have the first vehicle in the list in a separate room. Then you just teleport the vehicles to their proper starting spot when they are detected in there.


Black Crypt
Joined: Jun 30, 2008

Xfire : blackcrypt


Posted: Apr 19, 2015 02:31 PM    Msg. 52 of 52       
I think having the host hog trigger volume inside the vehicle spawn trigger volume is the only thing that is stopping the whole thing from screwing up completely.

If you watch the race video, you can see the other vehicles spawning at what is the race vehicle netgame flags. Blink and you will miss it xD.
Edited by Black Crypt on Apr 19, 2015 at 02:34 PM

 
Page 2 of 2 Go to page: · 1 · [2] · Prev

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 4:19 PM 156 ms.
A Halo Maps Website