A task that would benefit everyone.

Discuss thug2 modding, post your own, share your ideas, ask questions.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

A task that would benefit everyone.

Postby Anteara » Sat Oct 15, 2011 10:21 am

In my opinion, any modder with some spare time should look for a way to do, what I think, would benefit everyone. Simply put, I, and I think many others should try to look for the way the game broadcasts composite objects.

I'll give some examples,

-My mod, story mode vehicles and THUG1 vehicles - if I could broadcast these composite objects on the server everyone could see them.

-Mortens level editor, I know that his level editor is client side, and I'm pretty sure that Morten would love to have this functionality in his mod so others on the server could enjoy the fun of the custom level.

There are probably some more examples, but these are all I can think about right now.

In THUG1, it's possible to use vehicles in online mode, and have those vehicles broadcasted. It uses a function called $BroadcastEnterVehicle$. In THUG2, scavenger hunt uses $ReportObjectPlacement$ and $BroadcastObjectPlacements$ to broadcast the placement of the coins. Firefight might even use a similar function. There is a broadcast in projectiles, too. It's called $BroadcastProjectile$.

But guess what? All of these functions are stored in the EXE. That gives us almost no room to try and figure this out. I think some people might be able to disassemble the exe and find out vaguely how it works, however, I'm still not sure if that would be enough.

Quazz and I have decided that we are going to try and figure out how to broadcast something online. Please, if anyone else is willing to help, we would greatly appreciate it.

back on to the coding... since it's impossible for me to see inside any of the functions listed above, I'll need to guess as to how it works.

Code: Select all

   :i call $ReportObjectPlacement$ arguments
      $objId$ = %GLOBAL%$objId$$pos$ = %GLOBAL%$new_pos$


Code: Select all

                  :i $BroadcastObjectPlacements$
                  :i call $change$ arguments
                     $SentObjectPlacements$ = %i(1,00000001)


I'm going to assume that first the client must report the object has been placed, and then it must broadcast it to the players in the server. There is only one single entry of $BroadcastObjectPlacements$ inside the entire scripts folder.

Under the function ReportObjectPlacement, I'm going to assume that $objId$ would be the composite objects name. Pos could simply be the skater pos and the other player on the server could stand on you and tell you if he sees the spawned composite object.

I've tried to do that, but still, Quazz didn't see it.

Please guys, I believe that if we can pull this off, the THUG2 modding experience will increase tenfold. Honestly, just IMAGINE what you could do with something like this. Possibilities would be endless. This would be the next chapter in THUG2 modding, in my opinion.

Please, if you have the time, help with this project, it would be amazing if we could do this.

Thanks.
quazz
Posts: 185
Joined: Sat May 01, 2010 5:57 pm
Contact:

Re: A task that would benefit everyone.

Postby quazz » Sat Oct 15, 2011 10:45 am

Anteara explained the whole thing pretty well but here's my two cents to add onto this.

the "ObjectPlacement' stuff looks like it would be very specific to the coin placement, might not be appropriate to the vehicle broadcasting. the way the vehicle broadcasting worked in THUG1 was the driving player "entered car" event would be sent to the other players, and the other players would have that skater hidden and the car would become a lockobj to that player and their constant relative position. I've never gotten $BroadcastVehicle$ to work, but in THUG1 Goal Attack online when there is a goal with a car control_type, it works.

THUG2 projectiles and THUG1/2 fireballs use $BroadcastProjectile$. It seems like projectiles were planned to be used in online play for THUG2, because the functions in projectiles.qb to handle it are there (also, the graffiti box Create-A-Park item). When ammo is enabled online through one of the many mods, the projectile models are visible and work perfectly when thrown by anyone.

I think thug2amx might be of use but I'd rather prefer to try all in-game script methods first to keep it cleaner. I'll try some stuff tomorrow myself but I'm sure this can be figured out eventually. (y)
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: A task that would benefit everyone.

Postby Anteara » Sat Oct 15, 2011 3:26 pm

I found a function called $BroadcastEvent$ that's not stored in the exe so if I can find where it's stored it might provide some insight.

Edit: all it does is call $LaunchEvent$ and that's stored in the exe.

Edit again: I removed this from the fireball function

Code: Select all

               :i call $BroadcastProjectile$ arguments
                  $objID$ = %GLOBAL%$objID$$type$ = $fireball$$scale$ = %GLOBAL%$scale$$radius$ = %GLOBAL%$radius$$pos$ =  (%GLOBAL%$x$ * %vec3(1.000000,0.000000,0.000000) + %GLOBAL%$new_y$ * %vec3(0.000000,1.000000,0.000000) + %GLOBAL%$z$ * %vec3(0.000000,0.000000,1.000000)) $vel$ =  (%GLOBAL%$scaled_x$ * %vec3(1.000000,0.000000,0.000000) + %GLOBAL%$scaled_y$ * %vec3(0.000000,1.000000,0.000000) + %GLOBAL%$scaled_z$ * %vec3(0.000000,0.000000,1.000000))


And it successfully stopped broadcasting my releasing fireballs in a firefight to the other players on the server. I'm going to assume that each broadcast function will accept the same arguments and parameters. Also, I think it would be helpful if people could post what they have found, think might work, etc, it could allow us to track our progress if you all want to help out with this...

Edit 3: I was able to change it to launching Combo O's instead of fireballs.
quazz
Posts: 185
Joined: Sat May 01, 2010 5:57 pm
Contact:

Re: A task that would benefit everyone.

Postby quazz » Wed Oct 19, 2011 9:06 am

Got a very rough version of this working last night with Anteara. Left is Anteara, center is me, right is Frost. Making this post to mark the date.

Image
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: A task that would benefit everyone.

Postby Anteara » Thu Oct 20, 2011 7:54 am

Image

Quazz got it working today outside of create a goal. First person to do it on thug2, as far as i know.

Return to “THUG2 modding”

Who is online

Users browsing this forum: No registered users and 21 guests