Page 1 of 1

player possition based skyboxes

Posted: Fri Aug 15, 2008 8:05 pm
by hell
hey was wonderin if it was possible to code in unreal for one of the versions a slightly more advanced skyzoneinfo system. by that i mean move the skyzone camera in a relative direction of the players movement. if anyone play's valve source games you will see in maps with skyboxes the suroundings move slightly when going through a map. this would be really great and make maps more realistic like.

Re: player possition based skyboxes

Posted: Fri Aug 15, 2008 8:38 pm
by PRIMEVAL
Kinda reminds me of the DOOM games. But I'm not seeing how that would be realistic since I would assume the mountains in the distance would remain stationary... :-?

Re: player possition based skyboxes

Posted: Fri Aug 15, 2008 10:01 pm
by hell
well say you had a mountain pass and you walked from one end to the other the one end would be different that the other cos of the gradual change

Re: player possition based skyboxes

Posted: Fri Aug 15, 2008 10:44 pm
by PRIMEVAL
Ah, ok, that makes sense. But would we notice while we're busy blowing up Skaarj, Brutes, and Titans? :P But yeah, thinking about it that is a neat idea. I wouldn't know how it would be done, though.

Re: player possition based skyboxes

Posted: Fri Aug 15, 2008 10:47 pm
by Chaos13
The thing is called "Parallax Skybox" actually...

Re: player possition based skyboxes

Posted: Sat Aug 16, 2008 7:56 am
by GreatEmerald
ZoneInfo attached to a mover? But then it doesn't follow the player.

Re: player possition based skyboxes

Posted: Sun Aug 17, 2008 11:06 am
by Raven
Here's code (changed U2 ParallaxSkyZoneInfo). Didn't test it in game, but it compiles fine.

Code: Select all

class ParallaxSkyZoneInfo extends SkyZoneInfo;

var() float RelativeMoveScale;
var Pawn Player;
var vector LastPlayerLocation;

//------------------------------------------------------------------------------
simulated function Tick( float DeltaTime )
{
      local Pawn iPawn;

      Super.Tick( DeltaTime );

      if( Player == None )
      {
            for( iPawn = Level.PawnList; iPawn != None; iPawn = iPawn.NextPawn )
                  if( PlayerPawn(iPawn) != None && PlayerPawn(iPawn).Player != None )
                        Player = PlayerPawn(iPawn);
            if( Player != None )
                  LastPlayerLocation = Player.Location;
      }
      else
      {
            SetLocation( Location + (Player.Location - LastPlayerLocation) * RelativeMoveScale );
            LastPlayerLocation = Player.Location;
      }
}

defaultproperties
{
      RelativeMoveScale=0.100000
      bStatic=False
}

Re: player possition based skyboxes

Posted: Sun Aug 17, 2008 11:35 am
by Chaos13
I dont like this code, because its only for SinglePlayer games and obviously wont work in network games.

Re: player possition based skyboxes

Posted: Sun Aug 17, 2008 3:12 pm
by GreatEmerald
The function is at least simulated :P

Re: player possition based skyboxes

Posted: Sun Aug 17, 2008 11:41 pm
by Pravin
That code could easily work online, by checking the role of the playerpawn being examined before setting the local player var..

Code: Select all

            for( iPawn = Level.PawnList; iPawn != None; iPawn = iPawn.NextPawn )
                  if( PlayerPawn(iPawn) != None && PlayerPawn(iPawn).Player != None && (iPawn.Role=Role_AutonomousProxy||Level.NetMode==NM_StandAlone))
                        Player = PlayerPawn(iPawn);
            if( Player != None )
                  LastPlayerLocation = Player.Location;
That would cover the case of a client - role is autonomous, or a singleplayer game - netmode is standalone. There should probably be prevention of the zone moving out of world bounds and such. This code seems to be largely for example purposes, but would be a great base.

Re: player possition based skyboxes

Posted: Mon Aug 18, 2008 1:24 am
by Chaos13
You sure simulated function that is not owned by playerpawn will be executed? Also it would be very good to make axis restrictions, warping and "infinite length surface" for perfect parallax :P All is easy to do ofc (think of setowner)