Forum Discussion

biggmackk17's avatar
8 months ago

Having some game breaking horizon bugs for my comp game, any advice?

Im running into some really frustrating bugs that seem to be on horizon's side. Curious if anyone has any suggestions or workarounds, as the due date is soon. 

1. Only players added as collaborators are able to join my published world. If they are not added to the world, they just get stuck in an infinite loading screen. I'm worried this will keep people from being able to play my game. The world is NOT set to private. 

2. Jump is breaking over time. It has been fine until today, once getting 5+ people in the world. It seems like a compounding downwards gravity is getting added. Within 5 mins, players could not jump, and going onto objects that are supposed to launch the player stop working. Given that jumping is one of the main mechanics of my game, its a pretty brutal bug which makes the game unplayable. I assume it has to do with me adding force to the player on certain collisions, but adding force in 1 frame should not be constantly adding downwards force (especially with there never being any downwards force added to begin with)

3. Adding force to objects/player seems not work consistently. 
The first time I add force to an object, it loses all momentum after 5 feet or so, and drops. All subsequent launches work as expected. I have tried prewarming the physics with their collision and visuals off, but that doesnt work unfortunately. Adding player force seems to behave erratically,  

13 Replies

  • Ben.SH's avatar
    Ben.SH
    Community Manager

    I'm sorry you're running into these issues.

     

    For #1, can you send a screenshot of your publish settings window to make sure it hasn't been set to members only? You can also try unpublishing and republishing the world with it set to public visibility.

     

    For #2 and #3, could you share any scripts that may be associated with the jump mechanic that could be leading to the degradation of its functionality? Difficult to debug this issue without an example.

      • Ben.SH's avatar
        Ben.SH
        Community Manager

        Thank you for the link. I have flagged your world ID to the team investigating this issue.

        Some troubleshooting steps you can try as a workaround for this issue:
        1. Unpublishing and republishing the world
        2. Toggling the comfort rating and tags for the world
        3. Creating a clone of the world and publishing it.

    • biggmackk17's avatar
      biggmackk17
      Member

      The only things I have that ever modify player forces are the following. They all are 1 time events, which is why I cant pinpoint why force would be getting added over time, and downward at that. The bouncers are all set to 0,10,0 for their force. 

      in my bouncer controller:  
      start() {
          this.connectCodeBlockEvent(this.props.triggerEntity!, hz.CodeBlockEvents.OnPlayerEnterTrigger, (player) => {
            const force = new hz.Vec3(0, this.props.BounceForce, 0);
            player.velocity.set(force);
            this.props.bounceSFXEntity?.as(hz.AudioGizmo)?.play();
          });
        }

          In my gun controller: 

          this.playerCollisonEventSubscription = this.connectCodeBlockEvent(this.props.physicsEntity!, hz.CodeBlockEvents.OnPlayerCollision, (player) => {
            const players = this.world.getPlayers();
            //make sure we are not hitting ourselves
            if(player === this.entity.owner.get()) {
              return;
            }

            const direction = this.props.physicsEntity!.forward.get().normalize();
            let force = direction?.mul(10);
            force.y = 10;

            player.applyForce(force);
          });






      • biggmackk17's avatar
        biggmackk17
        Member

        Managed to solve the jump issue. I attach some object at the end as hats. Somehow these hats collision all got turned turned on, when they were set to off. The hats would then attached to the players head, which would then force them downwards every frame. The reason it felt like it was happening over time was you don't get a hat until the match ends.

        What it doesn't explain is how the collision got turned back on for these objects. They have been off and working correctly all week and I am the only one working in this world. I could see it accidently being turned on if it was 1 object. But theres 8 of them I would of had to individually go through and toggle. I also had all the scripts become unattached from all 8 of my guns around the same time the "jump bug" was introduced so something odd is definitely going on in horizon. 


    • biggmackk17's avatar
      biggmackk17
      Member

       

      for the physics entity projectile, this works every time, except for the first time, where monentum just dies. Nothing diffrent happened between calls.

      fire() {
          if (!this.isLoaded) {
            return;
          }


          this.props.loadedEntity?.visible.set(false);
          this.isLoaded = false;
          const direction = this.entity?.forward.get().normalize();
          const force = direction?.mul(30)
          this.physicalEntity!.collidable.set(true);
          this.physicalEntity!.visible.set(true);
          this.physicalEntity!.position.set(this.props.loadedEntity!.position.get());
          this.physicalEntity!.rotation.set(this.props.loadedEntity!.rotation.get());
          this.physicalEntity!.zeroVelocity();
          this.physicalEntity!.locked.set(false);
          //bridge calls are not instant, so lets wait before applying the force
          this.async.setTimeout(() => {
            this.physicalEntity!.applyForce(force!, hz.PhysicsForceMode.VelocityChange);
          }, 50);
          this.shootSFX?.play();
          if (!this.props.debugGun) {
            this.sendLocalBroadcastEvent(Events.OnPlayerFired, { player: this.entity.owner.get() });
          }
        }




      • PigeonNo12's avatar
        PigeonNo12
        Partner

        Is this a local script? If it is, it would explain the reason why it doesn't work the first time. Basically, all worlds are by default owned by the Server Player. If the momentum starts with the object being owned by the Server Player, but then the ownership is transferred to a client (either with a script or a collision), the momentum will stop making the object freeze in place. The workaround is to either keep the object as a Server owned entity, or to transfer the ownership to the player before the player interacts with it (when player enters world, when player enters trigger and such).