Announcement

Collapse
No announcement yet.

Resizing troubles

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Resizing troubles

    I've made a mutator that resizes tons of stuff to make the map look either bigger or smaller. Things resized include player pawns, vehicles, weapons, pickups, you name it.

    I run into the following problems:
    1. Karma collision boxes will not resize if I change a vehicle's DrawScale.
    2. The mutator's CheckReplacement seems to totally ignore projectiles.
    3. Some things aren't resized online. For example, an xPawn's DrawScale is resized, but the CollisionHeight is not.

    Using the set command sometimes works better than my code. Is there a way to mimic its effects in code? How exactly does it work anyway?

    I tried to set properties directly in the classes but couldn't get that to work. Is there a way to do that?

    Are there any other ways of resizing stuff?

    #2
    I've also encountered the following difficulties:
    • If you crouch then stand, or enter then leave a vehicle, your feet sink into the floor. The game seems to return you to standard collision even though you still look big.
    • It seems CheckReplacement also ignores xEmitters.
    Any hints?

    Comment


      #3
      1. Hmm, I seem to remember that karma collision does not resize on the fly, so if its not set in the default properties (and then set at object instantiation) you're out of luck (I'd love to be proven wrong on this one)

      2. Yes, the checkreplacement function does totally ignore projectiles (just as it did in UT) and a lot of high capacity actors. IIRC the reasoning was that projectiles (& emitters) could be spawning at a much higher rate than everything else so they (Epic) decided to not include the call in the native game spawn notification code. However back in UT you had the SpawnNotify class that could handle it aside from mutators, no such class exists for UT2k4

      3. The collision height/radius is resizeable online (the replication statement shows that it should be and I have done so in my mod), but are you properly calling the SetCollisionSize function on the server copy of the actor?

      The native pawn code will always return pawns to their default size when crouching/uncrouching. Only work around is to overwrite the pawn class and crouching functionality.

      Comment


        #4
        As far as I can tell karma sizes are locked at the spawn point of the actor, I could be wrong about this, but by the time CheckReplacment is called it's already too late.

        Comment


          #5
          Originally posted by meowcat View Post
          karma collision does not resize on the fly, so if its not set in the default properties (and then set at object instantiation) you're out of luck
          It would appear that it even has to be compiled. The console command set onshoverbike drawscale 2 neither resizes the collision of currently existing Mantas nor that of newly spawned Mantas. However, setting the property in code and then compiling will cause the collision boxes to resize accordingly.

          Originally posted by meowcat View Post
          the checkreplacement function does totally ignore projectiles
          Oh, wonderful. For some reason I don't feel like rewriting every single weapon.

          Originally posted by meowcat View Post
          The collision height/radius is resizeable online (the replication statement shows that it should be and I have done so in my mod), but are you properly calling the SetCollisionSize function on the server copy of the actor?
          I'm a netcode n00b but I have tried:
          • Making all functions simulated.
          • Other.CollisionHeight*= Scale and Other.default.CollisionHeight*= Scale. Compile error, can't adjust Const variables.
          • Other.SetCollision(Other.CollisionHeight* Scale). Works, until Other crouches or gets into a vehicle.
          • Other.default.SetCollision(Other.CollisionHeight* Scale). Compile error.
          • Other.DrawScale *= Scale and Other.default.DrawScale *= Scale. Compile error, can't adjust Const variables.
          • Other.SetDrawScale(Other.DrawScale * Scale). Works but does not resize karma collision boxes (even though increasing DrawScale in code and then recompiling does).
          • Other.default.SetDrawScale(Other.DrawScale * Scale). Compile error.
          • Other.SetPropertyText("DrawScale", string(Other.DrawScale)) in addition to the above. No difference.
          • Other.SetPropertyText("CollisionHeight", string(Other.CollisionHeight)) in addition to the above. No difference.
          Originally posted by meowcat View Post
          The native pawn code will always return pawns to their default size when crouching/uncrouching. Only work around is to overwrite the pawn class and crouching functionality.
          Yay. Especially since I cannot modify the default values because these things are Consts. I wonder why Epic bothered making DrawScale and CollisionHeight/Radius Consts...

          Anyway, thanks for the information.

          Is there a way to alter the properties (or propertytext) of classes before objects are spawned?

          Comment


            #6
            I believe you can alter the default properties before spawn, but not without possibly 'breaking' UT2004 code. Mysterial did this in his Superbots mutator when he had to change the default AIController class to his own special one. He did this in the PostBeginPlay function of the mutator, by searching for (ForEach AllObjects) and changing the pawn class default controllerclass property itself. He then spawned a playerInteraction on the server controlled player that he used to changed everything back when a the current map ended (only the interactions received NotifyLevelChange events.

            And yes, the "Other.SetCollisionSize(h,r)" called on the server is the way to accomplish what you want, but obviously for pawns you might have to consider making a special subclass to do what you want (overridng the crouching, leaving vehicle code)

            Comment


              #7
              Originally posted by meowcat View Post
              He did this in the PostBeginPlay function of the mutator, by searching for (ForEach AllObjects) and changing the pawn class default controllerclass property itself.
              Did he change this in the class or in Pawn object? Any idea where I could get a little source code glimpse of the syntax?

              Thing is, since CollisionHeight/Radius and DrawScale are Consts (argh), I can't alter the TheObject.default.TheProperty values...

              Originally posted by meowcat View Post
              the "Other.SetCollisionSize(h,r)" called on the server is the way to accomplish what you want
              That is what my code does, though I could be wrong:
              Code:
              simulated function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
              {
                  bSuperRelevant = 0;
              
                  if(ONSPowerCoreShield(Other) != none)
                  {
                      ScaleONSPowerCoreShield(ONSPowerCoreShield(Other));
                  }
              
                  return true;
              }
              
              simulated function ScaleONSPowerCoreShield(ONSPowerCoreShield Other)
              {
                  ScaleDrawScale(Other);
                  ScaleCollisionCylinder(Other);
              }
              
              simulated function ScaleDrawScale(Actor Other)
              {
                  Other.SetDrawScale(Other.DrawScale * Scale);
              }
              
              simulated function ScaleCollisionCylinder(Actor Other)
              {
                  Other.SetCollisionSize(Other.CollisionRadius * Scale, Other.CollisionHeight * Scale);
              }
              Simply making every function simulated should cause them to be executed on both server and client, right?

              This example only affects powernode shields, but another similar version affects players, vehicles, weapons, pickups... you name it. I'm posting this example because it is more to the point.

              Originally posted by meowcat View Post
              but obviously for pawns you might have to consider making a special subclass to do what you want (overridng the crouching, leaving vehicle code)
              I'm trying to put together a generic solution. I wouldn't want to replace xPawn, every vehicle class and the classes of a dozen other game objects.

              Comment


                #8
                Originally posted by Xyx
                Simply making every function simulated should cause them to be executed on both server and client, right?
                Not exactly. But in this case it should work like that, provided the mutator is actually initialized on clients in any way. Don't know about that. However, what would you need this for to be executed client-side? Collision sizes etc. are replicated anyway, so setting them on server should suffice.

                In worst case, when every other method fails, you could use tick instead of replacing pawns - adjusting their col. sizes whenever they change. Same for the projectiles - make a custom function similar to CheckReplacement, but using the tick. It's believed that using AllActors iteration in tick will kill the game, but if you do that only in one object on the map (the mutator), it should work well enough.

                Comment


                  #9
                  If you're going to do that, use DynamicActors.

                  Comment


                    #10
                    Originally posted by Xyx View Post
                    I wonder why Epic bothered making DrawScale and CollisionHeight/Radius Consts...
                    So they can change other things that need changing when you modify one of those properties with Set*() functions. If you're desperate you can unconst those properties by hexediting relevant .u packages. There may be side effects tho and loss of whatever extra functionality the Set*() functions provide. You don't need modified packages to run such fishy code, they're needed just for compilation.

                    Comment


                      #11
                      Originally posted by Farseer View Post
                      in this case it should work like that
                      But doesn't, unfortunately.

                      Originally posted by Farseer View Post
                      what would you need this for to be executed client-side? Collision sizes etc. are replicated anyway, so setting them on server should suffice.
                      Collision sizes won't have to be simulated, then. I'll see if any of the others (DrawScale, movement rates, offsets) need simulation. Good tip!

                      Originally posted by Farseer View Post
                      In worst case, when every other method fails, you could use tick instead of replacing pawns - adjusting their col. sizes whenever they change.
                      Good suggestion, will try!

                      Originally posted by Angel_Mapper View Post
                      If you're going to do that, use DynamicActors.
                      Instead of AllActors? Will do, thanks!

                      Originally posted by Switch` View Post
                      So they can change other things that need changing when you modify one of those properties with Set*() functions.
                      Figures. Silly me. That's what you get from working with .NET languages and the "set and get property" concept.

                      Comment


                        #12
                        Checking xPawns and Projectiles in Tick yields the desired results. No more problems there. The only real problems that remain are:
                        • DrawScale doesn't get resized online. I have no idea why. It's unreliably replicated.
                        • Vehicle karma collision boxes won't resize at all.
                        Is there a way to alter aspects of a class instead of an object?

                        Comment


                          #13
                          mh, normally it should if you use SetDrawScale(). Try to look up the code of Admin Plus v14. It has a command to change the size of players which works online.

                          Comment


                            #14
                            Nope, doesn't work online. You're floating in-air, or your body goes through the BSP. At least, that's my experience.

                            Comment


                              #15
                              I've encountered another problem: scaling movement.

                              If I scale Pawn.GroundSpeed, nothing happens. If I also scale Pawn.default.GroundSpeed, the player has properly scaled movement, but the bots have varying degrees of stronger scaled movement.

                              It would appear that each time a Pawn is spawned, the Pawn.default.GroundSpeed is further scaled on top of any previous scaling. However, if I only scale Pawn.default.GroundSpeed once, movement is not scaled at all.

                              Using the console command set pawn groundspeed 100 works properly. Any way I could mimic that in code?

                              Comment

                              Working...
                              X