Thanks for the constructive critics comrade!
well ill tell the animator to do some nice TwoHanded weapon animations.
Thanks for the constructive critics comrade!
well ill tell the animator to do some nice TwoHanded weapon animations.
Oh~ The arena is very nice! ^^
Your project is making a good impression of ‘Spartacus: Blood and Sand’.
I DO NOT think there is a big difference in the quality of UE3 (UDK) or UE4.
A game engine is just a tool. I think that a tool that is convenient for developers is a good tool.
Guy gets sliced in two. Wow. I’m badly lagging behind you guys. Nice work!
More blood on the blades and the guys screaming in agony. Some of them running away?
Otherwise great work, I’m jealous
oh snipe don’t be jelous please it’s not good my friend : /
Is the tree the KActorSpawnable? Or when the tree crashes, I assumed those were particle meshes. Are those KActors?
The tree it’s a KActorASpawnable, the particles idk they are random , i used them in the PhysichalMaterial and these black thingies happend.
wow, that’s impressive with the tree kactors!
Nice, are you using matinee or scripts? I had to switch to script because the updatecomponent in each tick ruin the framerate.
Lemme post the code
//-----------------------------------------------------------
//By Neongho
//Description applies day night ingame
//credits to tutorial of day nihgth system, of UDK " write name when you has time"
//REWRITE THIS WITH ONLY DAY AND NIGTH
//-----------------------------------------------------------
class GOTAMP2DayNigthDominantLight extends DominantDirectionalLightMovable
ClassGroup(Lights,DirectionalLights)
placeable;
var () float DayNightFreq;
var () int DayNightStep;
var () float Correction;
//for rotation purposes
var rotator R;
var rotator SunRotation;
//Time vars
var int Days;
var int Hours;
var int Minutes;
//assets to modify for lighting
var() InterpActor SkyActor;
var() SkyLightToggleable SkyLight;
var() exponentialheightFog FogAsset;
//Basic colors of the MIC of the Sky
var() const linearColor HorizonColor[2], ZenithColor[2], SunColor[2], RimColor[2];
//other miscellenous values of the MIC
var() const float skyBrightness[2], CloudOpacity[2], CloudDarkness[2], CloudBrightness[2], Desaturation[2], RimBrightness[2];
//Directional, fog , skylight , directional light colours
var() const color DirectionalLightColor[2], FogOppositeColor[2], FogInscatteringColor[2], SkyLightColor[2], StarColor[2];
//Brigthnesses and scales of the 6 stages for SKY LIGHT AND DIRECTIONAL LIght
var() const float DirectionalLightBrigthnesses[2], SkyLightBrightnesses[2], SkyLightLowerBrightnesses[2];
//ShaftsVariablesvariables
var() const float BloomScale[5], RadialBlurrPercent[2], OcclusionBloomDarkness[2], OcculusionDepthRange[2];
var() const color BloomTint[5];
//Fog variables
var() const float Density[2], FogMaxFallOf[2], FogAngle[2], FogOppositeBrightness[2], FogInscatteringBrightness[2];
var() const int StagesStarts[2], StagesEnds[2];
var() bool bIsDay;
//Dyamic variables**********************
//Horizon zenith sun
var linearColor ActualColourHorizon;
var linearColor ActualColourZenith;
var linearColor ActualColourSun;
var linearColor ActualColourCloudSide;
var linearColor ActualStarsColor;
//float variables from the day night system
var float ActualCloudBrightness;
var float ActualCloudOpacity;
var float ActualDesaturation;
var float ActualCloudDarkness;
var float ActualRimBrightness;
var float ActualSkyBrightness;
Var color ActualDirColor;
var float ActualDirColorX, ActualDirColorY, ActualDirColorZ;
Var color ActualFogColor;
var float ActualFogColorX, ActualFogColorY, ActualFogColorZ;
Var color ActualFogInscatteringColor;
var float ActualFogInscatteringColorX, ActualFogInscatteringColorY, ActualFogInscatteringColorZ;
Var color ActualSkyLightColor;
var float ActualSkyLightColorX, ActualSkyLightColorY, ActualSkyLightColorZ;
Var color ActualSkyLowLightColor;
var float ActualSkyLowLightColorX, ActualSkyLowLightColorY, ActualSkyLowLightColorZ;
//Fog properties
var float ActualFogInscaBrighness;
var float ActualFogOppositeBrighness;
var float ActualFogDensity;
var float ActualFogMaxFellOff;
var float ActualFogAngle;
//Shaft Bloom properties
var float ActualBloomScale;
var color ActualBloomColor;
var float ActualBloomColorX, ActualBloomColorY, ActualBloomColorZ;
var float ActualRadialBlurrPercent;
var float ActualMaskOcclusion;
var float ActualOcclusionBloomDarkness;
var float ActualOcculusionDepthRange;
var float ActualstarBrightness;
//Lighting vars " Sky light and DomDir"
var float SLBrigthness;
var float SLLBrigthness;
var float DLBrigthness;
//material instance information
var float TimeStamp;
var bool MatInstanced;
var int ActualStage; //0 Mroning Hori //1 Morning
replication
{
if(bNetDirty)
ActualStage;
}
simulated event PostBeginPlay()
{
local LinearColor OutVector;
local float OutFloat;
local MaterialInstance CurrentMaterial;
//Instance the mateiral
if (!MatInstanced){
CurrentMaterial=SkyActor.StaticMeshComponent.CreateAndSetMaterialInstanceConstant(0);
MatInstanced=true;
}
else
CurrentMaterial=MaterialInstance(SkyActor.StaticMeshComponent.GetMaterial(0));
super.PostBeginPlay();
//GOTAGameInfo(WorldInfo.game).TheDayNightLight = self;
//Dyamic variables**********************
//Horizon zenith sun
CurrentMaterial.GetVectorParameterValue('HorizonColor',OutVector);
ActualColourHorizon = OutVector;
CurrentMaterial.GetVectorParameterValue('ZenithColor',OutVector);
ActualColourZenith = OutVector;
CurrentMaterial.GetVectorParameterValue('Sun',OutVector);
ActualColourSun = OutVector;
CurrentMaterial.GetVectorParameterValue('RimColor',OutVector);
ActualColourCloudSide = OutVector;
CurrentMaterial.GetVectorParameterValue('StarColor', OutVector);
ActualStarsColor = OutVector;
//float variables from the day night system
CurrentMaterial.GetScalarParameterValue('CloudBrightness', OutFloat);
ActualCloudBrightness = OutFloat;
CurrentMaterial.GetScalarParameterValue('CloudOpacity', OutFloat);
ActualCloudOpacity = OutFloat;
CurrentMaterial.GetScalarParameterValue('Desaturation', OutFloat);
ActualDesaturation = OutFloat;
CurrentMaterial.GetScalarParameterValue('CloudDarkness', OutFloat);
ActualCloudDarkness = OutFloat;
CurrentMaterial.GetScalarParameterValue('RimBrightness', OutFloat);
ActualRimBrightness = OutFloat;
CurrentMaterial.GetScalarParameterValue('SkyBrightness', OutFloat);
ActualSkyBrightness = OutFloat;
//Fog asset
ActualFogInscatteringColor = FogAsset.Component.LightInscatteringColor;
ActualFogInscatteringColorX = FogAsset.Component.LightInscatteringColor.R; ActualFogInscatteringColorY = FogAsset.Component.LightInscatteringColor.G; ActualFogInscatteringColorZ = FogAsset.Component.LightInscatteringColor.B;
ActualFogColor = FogAsset.Component.OppositeLightColor;
ActualFogColorX = ActualFogColor.R; ActualFogColorY = ActualFogColor.G; ActualFogColorZ = ActualFogColor.B;
//Non color fog properties
ActualFogInscaBrighness = FogAsset.Component.LightInscatteringBrightness;
ActualFogOppositeBrighness = FogAsset.Component.OppositeLightBrightness;
ActualFogDensity = FogAsset.Component.FogDensity;
ActualFogMaxFellOff = FogAsset.Component.FogHeightFalloff;
ActualFogAngle = FogAsset.Component.LightTerminatorAngle;
ActualBloomScale = LightComponent.BloomScalE;
ActualOcculusionDepthRange = LightComponent.OcclusionDepthRange;
ActualBloomColor = LightComponent.BloomTint;
ActualRadialBlurrPercent = LightComponent.RadialBlurPercent;
ActualOcclusionBloomDarkness = LightComponent.OcclusionMaskDarkness;
ActualDirColor = LightComponent.LightColor;
ActualDirColorX = ActualDirColor.R;
ActualDirColorY = ActualDirColor.G;
ActualDirColorZ = ActualDirColor.B;
ActualSkyLightColor = SkyLight.LightComponent.LightColor;
ActualSkyLightColorX = ActualSkyLightColor.R;
ActualSkyLightColorY = ActualSkyLightColor.G;
ActualSkyLightColorZ = ActualSkyLightColor.B;
SLLBrigthness = SkyLightComponent ( SkyLight.LightComponent ).LowerBrightness;
DLBrigthness = LightComponent.Brightness;
SLBrigthness = SkyLight.LightComponent.Brightness;
/*
//Shaft Bloom properties
ActualBloomScale;
ActualBloomColor;
ActualBloomColorX, ActualBloomColorY, ActualBloomColorZ;
ActualRadialBlurrPercent;
ActualMaskOcclusion;
ActualOcclusionBloomDarkness;
ActualOcculusionDepthRange;
ActualstarBrightness;
*/
//TimeStamp = WorldInfo.TimeSeconds;
SetTimer(DayNightFreq, true, 'DayNightTimer');
SetTimer(1, true, 'DisableAllLigthComponentsForPawns');
}
simulated function DayNightTimer()
{
local MaterialInstance CurrentMaterial;
//local float deltaTime;
//worldInfo.game.broadcast(Self, Hours);
//`log("FROM GOTAMP2DayNigthDominantLigth "@Hours@"Rotation "@Rotation@" The stage is "@ActualStage@" the DomLigth Brigthness is "@self.LightComponent.Brightness@"the actual Dom brigthness is "@DLBrigthness); //Extremely laggy
//DeltaTime=WorldInfo.TimeSeconds-TimeStamp;
TimeStamp = WorldInfo.TimeSeconds;
R=self.rotation;
R.Pitch += DayNightStep;
SunRotation=R;
if (Role == Role_Authority){
SunRotation=R;
}
//Instance the mateiral
if (!MatInstanced){
CurrentMaterial=SkyActor.StaticMeshComponent.CreateAndSetMaterialInstanceConstant(0);
MatInstanced=true;
}
else
CurrentMaterial=MaterialInstance(SkyActor.StaticMeshComponent.GetMaterial(0));
Days = (Rotation.Pitch + Correction*(65536/24)) / 65536 ;
Hours = ( ( (Rotation.Pitch - (Days*65536) ) / 65536.) * 24.)+Correction ;
Minutes = ( ( (Rotation.Pitch+(Correction*(65536/24)) - (Days*65536) ) ) - (Hours*(65536/24) ) ) / 45.51 ;
if(ROLE == ROLE_Authority)
{
GOTAMP2GameInfo( worldinfo.game ).Days = Days;
GOTAMP2GameInfo( worldinfo.game ).Hours = Hours;
GOTAMP2GameInfo( worldinfo.game ).Minutes = Minutes;
}
//Change colours change environment***********************
//Lights interpolating
SLBrigthness = lerp(SLBrigthness, SkyLightBrightnesses[ActualStage] , 0.0005);
SLLBrigthness = lerp(SLLBrigthness, SkyLightLowerBrightnesses[ActualStage] , 0.005);
DLBrigthness = lerp(DLBrigthness, DirectionalLightBrigthnesses[ActualStage] , 0.0005);
//Directional light color and brightness
ActualDirColorX = Lerp(ActualDirColorX, DirectionalLightColor[ActualStage].R, 0.005); ActualDirColorY = Lerp(ActualDirColorY, DirectionalLightColor[ActualStage].G, 0.005); ActualDirColorZ = Lerp(ActualDirColorZ, DirectionalLightColor[ActualStage].B, 0.005);
ActualDirColor.R = ActualDirColorX; ActualDirColor.G = ActualDirColorY; ActualDirColor.B = ActualDirColorZ;
ActualSkyLightColorX = Lerp(ActualSkyLightColorX, SkyLightColor[ActualStage].R, 0.005); ActualSkyLightColorY = Lerp(ActualSkyLightColorY, SkyLightColor[ActualStage].G, 0.005); ActualSkyLightColorZ = Lerp(ActualSkyLightColorZ, SkyLightColor[ActualStage].B, 0.005);
ActualSkyLightColor.R = ActualSkyLightColorX; ActualSkyLightColor.G = ActualSkyLightColorY; ActualSkyLightColor.B = ActualSkyLightColorZ;
ActualFogColorX = Lerp(ActualFogColorX, FogOppositeColor[ActualStage].R, 0.002) ; ActualFogColorY = Lerp(ActualFogColorY, FogOppositeColor[ActualStage].G, 0.002); ActualFogColorZ = Lerp(ActualFogColorZ, FogOppositeColor[ActualStage].B, 0.002);
ActualFogColor.R = ActualFogColorX; ActualFogColor.G = ActualFogColorY; ActualFogColor.B = ActualFogColorZ;
ActualFogInscatteringColorX = Lerp(ActualFogInscatteringColorX, FogInscatteringColor[ActualStage].R, 0.002) ; ActualFogInscatteringColorY = Lerp(ActualFogInscatteringColorY, FogInscatteringColor[ActualStage].G, 0.002); ActualFogInscatteringColorZ = Lerp(ActualFogInscatteringColorZ, FogInscatteringColor[ActualStage].B, 0.002);
ActualFogInscatteringColor.R = ActualFogInscatteringColorX; ActualFogInscatteringColor.G = ActualFogInscatteringColorY; ActualFogInscatteringColor.B = ActualFogInscatteringColorZ;
//Interpolations /////////////////////////////////////////////////
ActualColourZenith.R = lerp(ActualColourZenith.R, ZenithColor[ActualStage].R ,0.003); ActualColourZenith.B = lerp(ActualColourZenith.B, ZenithColor[ActualStage].B,0.003); ActualColourZenith.G = lerp(ActualColourZenith.G, ZenithColor[ActualStage].G, 0.003);
ActualColourHorizon.R = lerp(ActualColourHorizon.R, HorizonColor[ActualStage].R ,0.003); ActualColourHorizon.B = lerp(ActualColourHorizon.B, HorizonColor[ActualStage].B, 0.003); ActualColourHorizon.G = lerp(ActualColourHorizon.G, HorizonColor[ActualStage].G, 0.003);
ActualColourCloudSide.R = lerp(ActualColourCloudSide.R, RimColor[ActualStage].R ,0.01); ActualColourCloudSide.B = lerp(ActualColourCloudSide.B, RimColor[ActualStage].B,0.01); ActualColourCloudSide.G = lerp(ActualColourCloudSide.G, RimColor[ActualStage].G, 0.01); ActualColourCloudSide.A = lerp(ActualColourCloudSide.A, RimColor[ActualStage].A, 0.1);
ActualColourSun.R = lerp(ActualColoursun.R, SunColor[ActualStage].R ,0.01); ActualColourSun.B = lerp(ActualColoursun.B, SunColor[ActualStage].B, 0.01); ActualColourSun.G = lerp(ActualColourSun.G, SunColor[ActualStage].G, 0.01); ActualColourSun.A = lerp(ActualColourSun.A, SunColor[ActualStage].A, 0.1);
ActualStarsColor.R = lerp(ActualStarsColor.R, StarColor[ActualStage].R ,0.01); ActualStarsColor.B = lerp(ActualStarsColor.B, StarColor[ActualStage].B ,0.01); ActualStarsColor.G = lerp(ActualStarsColor.G, StarColor[ActualStage].G ,0.01);
ActualSkyBrightness = lerp(ActualSkyBrightness, skyBrightness[ActualStage] , 0.0025);
ActualRimBrightness = lerp(ActualRimBrightness, RimBrightness[ActualStage] , 0.0025);
ActualCloudDarkness = lerp(ActualCloudDarkness, CloudDarkness[ActualStage] , 0.0025);
ActualDesaturation = lerp(ActualDesaturation, Desaturation[ActualStage] , 0.0025);
ActualCloudOpacity = lerp(ActualCloudOpacity, CloudOpacity[ActualStage] , 0.0025);
ActualCloudBrightness = lerp(ActualCloudBrightness, CloudBrightness[ActualStage] , 0.0025);
ActualFogInscaBrighness = Lerp(ActualFogInscaBrighness, FogInscatteringBrightness[ActualStage], 0.002) ;
ActualFogOppositeBrighness = Lerp(ActualFogOppositeBrighness, FogOppositeBrightness[ActualStage] , 0.002) ; //Opposite fog bright...
ActualFogDensity = Lerp(ActualFogDensity, Density[ActualStage], 0.001) ;
ActualFogMaxFellOff = Lerp(ActualFogMaxFellOff, FogMaxFallOf[ActualStage], 0.004) ;
ActualFogAngle = Lerp(ActualFogAngle ,FogAngle[ActualStage] , 0.05) ;
ActualBloomScale = Lerp(ActualBloomScale, BloomScale[ActualStage], 0.005);
ActualBloomColorX = Lerp(ActualBloomColorX, BloomTint[ActualStage].R, 0.002) ; ActualBloomColorY = Lerp(ActualBloomColorY, BloomTint[ActualStage].G, 0.002); ActualBloomColorZ = Lerp(ActualBloomColorZ, BloomTint[ActualStage].B, 0.002);
ActualBloomColor.R = ActualBloomColorX; ActualBloomColor.G = ActualBloomColorY; ActualBloomColor.B = ActualBloomColorZ;
ActualRadialBlurrPercent = Lerp(ActualRadialBlurrPercent, RadialBlurrPercent[ActualStage], 0.005);
ActualMaskOcclusion = Lerp(ActualMaskOcclusion, RadialBlurrPercent[ActualStage], 0.005);
ActualOcclusionBloomDarkness = Lerp(ActualOcclusionBloomDarkness, OcclusionBloomDarkness[ActualStage], 0.005);
ActualOcculusionDepthRange = Lerp(ActualOcculusionDepthRange, OcculusionDepthRange[ActualStage], 0.005);
//Setters ////////////////////////////////////////////***********
//4 colours of sky
CurrentMaterial.SetVectorParameterValue('ZenithColor',ActualColourZenith);
CurrentMaterial.SetVectorParameterValue('HorizonColor',ActualColourHorizon);
CurrentMaterial.SetVectorParameterValue('Sun',ActualColourSun);
CurrentMaterial.SetVectorParameterValue('RimColor',ActualColourCloudSide);
CurrentMaterial.SetVectorParameterValue('StarColor',ActualStarsColor);
CurrentMaterial.SetScalarParameterValue('CloudBrightness',ActualCloudBrightness);
CurrentMaterial.SetScalarParameterValue('CloudOpacity',ActualCloudOpacity);
CurrentMaterial.SetScalarParameterValue('Desaturation',ActualDesaturation);
CurrentMaterial.SetScalarParameterValue('CloudDarkness',ActualCloudDarkness);
CurrentMaterial.SetScalarParameterValue('RimBrightness',ActualRimBrightness);
CurrentMaterial.SetScalarParameterValue('SkyBrightness',ActualSkyBrightness);
LightComponent.SetLightProperties(DLBrigthness, ActualDirColor );
SkyLightComponent ( SkyLight.LightComponent ).LowerBrightness = SLLBrigthness; //So no need for to change engine classes
SkyLight.LightComponent.SetLightProperties(SLBrigthness, ActualSkyLightColor);
//SkyLight.LightComponent.ForceUpdate(false);
//SkyLight.LightComponent.UpdateColorAndBrightness();
//SkyLight.LightComponent.SetEnabled(false);
//Shaft updating
//LightComponent.BloomScale = ActualBloomScale;
//LightComponent.OcclusionDepthRange = ActualOcculusionDepthRange;
//LightComponent.BloomTint = ActualBloomColor;
//LightComponent.RadialBlurPercent = ActualRadialBlurrPercent;
//LightComponent.OcclusionMaskDarkness = ActualOcclusionBloomDarkness;
//LightComponent.UpdateLightShaftParameters();
LightComponent.UpdateColorAndBrightness();
//Fog asset
FogAsset.Component.LightInscatteringColor = ActualFogInscatteringColor;
FogAsset.Component.OppositeLightColor = ActualFogColor;
//Non color fog properties
//FogAsset.Component.LightInscatteringBrightness = ActualFogInscaBrighness;
//FogAsset.Component.OppositeLightBrightness = ActualFogOppositeBrighness;
//FogAsset.Component.FogDensity = ActualFogDensity;
//FogAsset.Component.FogHeightFalloff = ActualFogMaxFellOff;
//FogAsset.Component.LightTerminatorAngle = ActualFogAngle;
FogAsset.Component.ForceUpdate(false);
self.SetRotation(R);
//worldInfO.GAME.BROADCAST(self,"FROM Day nigth skyLigth BRIGTHNESS IS is "@SLBrigthness@" the sky light lower is "@SLLBrigthness@" DL brigthness is "@DLBrigthness);
//Setters ////////////////////////////////////////////***********
//0 day 1 is nigth
//Nigth To day transition
if(Hours >= StagesStarts[0] && Hours < StagesEnds[0] )
{
//commented because it doesent do much
/*if(!SkyLight.LightComponent.bEnabled && DLBrigthness > 0.1)
{
//LightComponent.setEnabled(true);
SkyLight.LightComponent.SetEnabled(true);
WorldInfo.game.broadcast(Self,"FROM DayNight turning light on");
} */
if(Role == ROLE_Authority)
{
if(!bIsDay)
{
ActualStage = 0;
bIsDay = true;
}
}
}
//Day to nigth transition
if(Hours >= StagesStarts[1] && Hours < StagesEnds[1] )
{
//worldInfo.game.Broadcast(self, "FROM DayNigth is Skylight turned on "@SkyLight.LightComponent.bEnabled@"Whats the dl brigthness"@DLBrigthness);
//SkyLight.LightComponent.SetEnabled(true);
/*
if(SkyLight.LightComponent.bEnabled && DLBrigthness < 4)
{
WorldInfo.game.broadcast(Self,"FROM DayNight turning light off");
//LightComponent.setEnabled(False);
SkyLight.LightComponent.SetEnabled(false);
} */
if(Role == ROLE_Authority)
{
if(bIsDay)
{
ActualStage = 1;
bIsDay = false;
}
}
}
}
//set time specific of the sun
function SetNewTime(int NewHour, int NewMinute)
{
local float FloatMinutesAddition;
local float FloatHours;
local float ConstantHourRota;
FloatMinutesAddition =( ( (NewMinute*100) / 60 ) /100);
FloatHours = NewHour + FloatMinutesAddition;
ConstantHourRota = 65536/24;
R.pitch = (FloatHours+3)*ConstantHourRota;
self.SetRotation(R);
}
simulated function DisableAllLigthComponentsForPawns()
{
local GOTAMP2pawn RecollectedPawn;
foreach WorldInfo.AllPawns(class'GOTAMP2Pawn', RecollectedPawn)
{
RecollectedPawn.LightEnvironment.SetEnabled(false);
}
}
DefaultProperties
{
bHidden=FALSE //REPLICATION NEEDS THIS
bNoDelete=TRUE
bRouteBeginPlayEvenIfStatic=FALSE
bEdShouldSnap=FALSE
Begin Object name=DominantDirectionalLightComponent0
ModShadowFadeoutExponent=3.0
bRenderLightShafts=True
LightAffectsClassification=LAC_DYNAMIC_AND_STATIC_AFFECTING
CastShadows=TRUE
CastStaticShadows=TRUE
CastDynamicShadows=TRUE
bForceDynamicLight=FALSE
UseDirectLightMap=FALSE
bAllowPreShadow=TRUE
LightingChannels=(BSP=TRUE,Static=TRUE,Dynamic=TRUE,bInitialized=TRUE)
LightmassSettings=(LightSourceAngle=.2)
End Object
bStatic=FALSE
bHardAttach=TRUE
bMovable=TRUE
Physics=PHYS_Interpolating
RemoteRole=ROLE_SimulatedProxy
Role=ROLE_Authority
bNetInitialRotation=TRUE
bUpdateSimulatedPosition=TRUE
bReplicateMovement=TRUE
bAlwaysRelevant = true
bIsDay = true;
}
//-----------------------------------------------------------
//By Neongho
//Description applies day night ingame
//credits to tutorial of day nihgth system, of UDK " write name when you has time"
//REWRITE THIS WITH ONLY DAY AND NIGTH
//-----------------------------------------------------------
class GOTAMP2DayNigthDominantLight extends DominantDirectionalLightMovable
ClassGroup(Lights,DirectionalLights)
placeable;
var () float DayNightFreq;
var () int DayNightStep;
var () float Correction;
//for rotation purposes
var rotator R;
var rotator SunRotation;
//Time vars
var int Days;
var int Hours;
var int Minutes;
//assets to modify for lighting
var() InterpActor SkyActor;
var() SkyLightToggleable SkyLight;
var() exponentialheightFog FogAsset;
//Basic colors of the MIC of the Sky
var() const linearColor HorizonColor[2], ZenithColor[2], SunColor[2], RimColor[2];
//other miscellenous values of the MIC
var() const float skyBrightness[2], CloudOpacity[2], CloudDarkness[2], CloudBrightness[2], Desaturation[2], RimBrightness[2];
//Directional, fog , skylight , directional light colours
var() const color DirectionalLightColor[2], FogOppositeColor[2], FogInscatteringColor[2], SkyLightColor[2], StarColor[2];
//Brigthnesses and scales of the 6 stages for SKY LIGHT AND DIRECTIONAL LIght
var() const float DirectionalLightBrigthnesses[2], SkyLightBrightnesses[2], SkyLightLowerBrightnesses[2];
//ShaftsVariablesvariables
var() const float BloomScale[5], RadialBlurrPercent[2], OcclusionBloomDarkness[2], OcculusionDepthRange[2];
var() const color BloomTint[5];
//Fog variables
var() const float Density[2], FogMaxFallOf[2], FogAngle[2], FogOppositeBrightness[2], FogInscatteringBrightness[2];
var() const int StagesStarts[2], StagesEnds[2];
var() bool bIsDay;
//Dyamic variables**********************
//Horizon zenith sun
var linearColor ActualColourHorizon;
var linearColor ActualColourZenith;
var linearColor ActualColourSun;
var linearColor ActualColourCloudSide;
var linearColor ActualStarsColor;
//float variables from the day night system
var float ActualCloudBrightness;
var float ActualCloudOpacity;
var float ActualDesaturation;
var float ActualCloudDarkness;
var float ActualRimBrightness;
var float ActualSkyBrightness;
Var color ActualDirColor;
var float ActualDirColorX, ActualDirColorY, ActualDirColorZ;
Var color ActualFogColor;
var float ActualFogColorX, ActualFogColorY, ActualFogColorZ;
Var color ActualFogInscatteringColor;
var float ActualFogInscatteringColorX, ActualFogInscatteringColorY, ActualFogInscatteringColorZ;
Var color ActualSkyLightColor;
var float ActualSkyLightColorX, ActualSkyLightColorY, ActualSkyLightColorZ;
Var color ActualSkyLowLightColor;
var float ActualSkyLowLightColorX, ActualSkyLowLightColorY, ActualSkyLowLightColorZ;
//Fog properties
var float ActualFogInscaBrighness;
var float ActualFogOppositeBrighness;
var float ActualFogDensity;
var float ActualFogMaxFellOff;
var float ActualFogAngle;
//Shaft Bloom properties
var float ActualBloomScale;
var color ActualBloomColor;
var float ActualBloomColorX, ActualBloomColorY, ActualBloomColorZ;
var float ActualRadialBlurrPercent;
var float ActualMaskOcclusion;
var float ActualOcclusionBloomDarkness;
var float ActualOcculusionDepthRange;
var float ActualstarBrightness;
//Lighting vars " Sky light and DomDir"
var float SLBrigthness;
var float SLLBrigthness;
var float DLBrigthness;
//material instance information
var float TimeStamp;
var bool MatInstanced;
var int ActualStage; //0 Mroning Hori //1 Morning
replication
{
if(bNetDirty)
ActualStage;
}
simulated event PostBeginPlay()
{
local LinearColor OutVector;
local float OutFloat;
local MaterialInstance CurrentMaterial;
//Instance the mateiral
if (!MatInstanced){
CurrentMaterial=SkyActor.StaticMeshComponent.CreateAndSetMaterialInstanceConstant(0);
MatInstanced=true;
}
else
CurrentMaterial=MaterialInstance(SkyActor.StaticMeshComponent.GetMaterial(0));
super.PostBeginPlay();
//GOTAGameInfo(WorldInfo.game).TheDayNightLight = self;
//Dyamic variables**********************
//Horizon zenith sun
CurrentMaterial.GetVectorParameterValue('HorizonColor',OutVector);
ActualColourHorizon = OutVector;
CurrentMaterial.GetVectorParameterValue('ZenithColor',OutVector);
ActualColourZenith = OutVector;
CurrentMaterial.GetVectorParameterValue('Sun',OutVector);
ActualColourSun = OutVector;
CurrentMaterial.GetVectorParameterValue('RimColor',OutVector);
ActualColourCloudSide = OutVector;
CurrentMaterial.GetVectorParameterValue('StarColor', OutVector);
ActualStarsColor = OutVector;
//float variables from the day night system
CurrentMaterial.GetScalarParameterValue('CloudBrightness', OutFloat);
ActualCloudBrightness = OutFloat;
CurrentMaterial.GetScalarParameterValue('CloudOpacity', OutFloat);
ActualCloudOpacity = OutFloat;
CurrentMaterial.GetScalarParameterValue('Desaturation', OutFloat);
ActualDesaturation = OutFloat;
CurrentMaterial.GetScalarParameterValue('CloudDarkness', OutFloat);
ActualCloudDarkness = OutFloat;
CurrentMaterial.GetScalarParameterValue('RimBrightness', OutFloat);
ActualRimBrightness = OutFloat;
CurrentMaterial.GetScalarParameterValue('SkyBrightness', OutFloat);
ActualSkyBrightness = OutFloat;
//Fog asset
ActualFogInscatteringColor = FogAsset.Component.LightInscatteringColor;
ActualFogInscatteringColorX = FogAsset.Component.LightInscatteringColor.R; ActualFogInscatteringColorY = FogAsset.Component.LightInscatteringColor.G; ActualFogInscatteringColorZ = FogAsset.Component.LightInscatteringColor.B;
ActualFogColor = FogAsset.Component.OppositeLightColor;
ActualFogColorX = ActualFogColor.R; ActualFogColorY = ActualFogColor.G; ActualFogColorZ = ActualFogColor.B;
//Non color fog properties
ActualFogInscaBrighness = FogAsset.Component.LightInscatteringBrightness;
ActualFogOppositeBrighness = FogAsset.Component.OppositeLightBrightness;
ActualFogDensity = FogAsset.Component.FogDensity;
ActualFogMaxFellOff = FogAsset.Component.FogHeightFalloff;
ActualFogAngle = FogAsset.Component.LightTerminatorAngle;
ActualBloomScale = LightComponent.BloomScalE;
ActualOcculusionDepthRange = LightComponent.OcclusionDepthRange;
ActualBloomColor = LightComponent.BloomTint;
ActualRadialBlurrPercent = LightComponent.RadialBlurPercent;
ActualOcclusionBloomDarkness = LightComponent.OcclusionMaskDarkness;
ActualDirColor = LightComponent.LightColor;
ActualDirColorX = ActualDirColor.R;
ActualDirColorY = ActualDirColor.G;
ActualDirColorZ = ActualDirColor.B;
ActualSkyLightColor = SkyLight.LightComponent.LightColor;
ActualSkyLightColorX = ActualSkyLightColor.R;
ActualSkyLightColorY = ActualSkyLightColor.G;
ActualSkyLightColorZ = ActualSkyLightColor.B;
SLLBrigthness = SkyLightComponent ( SkyLight.LightComponent ).LowerBrightness;
DLBrigthness = LightComponent.Brightness;
SLBrigthness = SkyLight.LightComponent.Brightness;
/*
//Shaft Bloom properties
ActualBloomScale;
ActualBloomColor;
ActualBloomColorX, ActualBloomColorY, ActualBloomColorZ;
ActualRadialBlurrPercent;
ActualMaskOcclusion;
ActualOcclusionBloomDarkness;
ActualOcculusionDepthRange;
ActualstarBrightness;
*/
//TimeStamp = WorldInfo.TimeSeconds;
SetTimer(DayNightFreq, true, 'DayNightTimer');
SetTimer(1, true, 'DisableAllLigthComponentsForPawns');
}
simulated function DayNightTimer()
{
local MaterialInstance CurrentMaterial;
//local float deltaTime;
//worldInfo.game.broadcast(Self, Hours);
//`log("FROM GOTAMP2DayNigthDominantLigth "@Hours@"Rotation "@Rotation@" The stage is "@ActualStage@" the DomLigth Brigthness is "@self.LightComponent.Brightness@"the actual Dom brigthness is "@DLBrigthness); //Extremely laggy
//DeltaTime=WorldInfo.TimeSeconds-TimeStamp;
TimeStamp = WorldInfo.TimeSeconds;
R=self.rotation;
R.Pitch += DayNightStep;
SunRotation=R;
if (Role == Role_Authority){
SunRotation=R;
}
//Instance the mateiral
if (!MatInstanced){
CurrentMaterial=SkyActor.StaticMeshComponent.CreateAndSetMaterialInstanceConstant(0);
MatInstanced=true;
}
else
CurrentMaterial=MaterialInstance(SkyActor.StaticMeshComponent.GetMaterial(0));
Days = (Rotation.Pitch + Correction*(65536/24)) / 65536 ;
Hours = ( ( (Rotation.Pitch - (Days*65536) ) / 65536.) * 24.)+Correction ;
Minutes = ( ( (Rotation.Pitch+(Correction*(65536/24)) - (Days*65536) ) ) - (Hours*(65536/24) ) ) / 45.51 ;
if(ROLE == ROLE_Authority)
{
GOTAMP2GameInfo( worldinfo.game ).Days = Days;
GOTAMP2GameInfo( worldinfo.game ).Hours = Hours;
GOTAMP2GameInfo( worldinfo.game ).Minutes = Minutes;
}
//Change colours change environment***********************
//Lights interpolating
SLBrigthness = lerp(SLBrigthness, SkyLightBrightnesses[ActualStage] , 0.0005);
SLLBrigthness = lerp(SLLBrigthness, SkyLightLowerBrightnesses[ActualStage] , 0.005);
DLBrigthness = lerp(DLBrigthness, DirectionalLightBrigthnesses[ActualStage] , 0.0005);
//Directional light color and brightness
ActualDirColorX = Lerp(ActualDirColorX, DirectionalLightColor[ActualStage].R, 0.005); ActualDirColorY = Lerp(ActualDirColorY, DirectionalLightColor[ActualStage].G, 0.005); ActualDirColorZ = Lerp(ActualDirColorZ, DirectionalLightColor[ActualStage].B, 0.005);
ActualDirColor.R = ActualDirColorX; ActualDirColor.G = ActualDirColorY; ActualDirColor.B = ActualDirColorZ;
ActualSkyLightColorX = Lerp(ActualSkyLightColorX, SkyLightColor[ActualStage].R, 0.005); ActualSkyLightColorY = Lerp(ActualSkyLightColorY, SkyLightColor[ActualStage].G, 0.005); ActualSkyLightColorZ = Lerp(ActualSkyLightColorZ, SkyLightColor[ActualStage].B, 0.005);
ActualSkyLightColor.R = ActualSkyLightColorX; ActualSkyLightColor.G = ActualSkyLightColorY; ActualSkyLightColor.B = ActualSkyLightColorZ;
ActualFogColorX = Lerp(ActualFogColorX, FogOppositeColor[ActualStage].R, 0.002) ; ActualFogColorY = Lerp(ActualFogColorY, FogOppositeColor[ActualStage].G, 0.002); ActualFogColorZ = Lerp(ActualFogColorZ, FogOppositeColor[ActualStage].B, 0.002);
ActualFogColor.R = ActualFogColorX; ActualFogColor.G = ActualFogColorY; ActualFogColor.B = ActualFogColorZ;
ActualFogInscatteringColorX = Lerp(ActualFogInscatteringColorX, FogInscatteringColor[ActualStage].R, 0.002) ; ActualFogInscatteringColorY = Lerp(ActualFogInscatteringColorY, FogInscatteringColor[ActualStage].G, 0.002); ActualFogInscatteringColorZ = Lerp(ActualFogInscatteringColorZ, FogInscatteringColor[ActualStage].B, 0.002);
ActualFogInscatteringColor.R = ActualFogInscatteringColorX; ActualFogInscatteringColor.G = ActualFogInscatteringColorY; ActualFogInscatteringColor.B = ActualFogInscatteringColorZ;
//Interpolations /////////////////////////////////////////////////
ActualColourZenith.R = lerp(ActualColourZenith.R, ZenithColor[ActualStage].R ,0.003); ActualColourZenith.B = lerp(ActualColourZenith.B, ZenithColor[ActualStage].B,0.003); ActualColourZenith.G = lerp(ActualColourZenith.G, ZenithColor[ActualStage].G, 0.003);
ActualColourHorizon.R = lerp(ActualColourHorizon.R, HorizonColor[ActualStage].R ,0.003); ActualColourHorizon.B = lerp(ActualColourHorizon.B, HorizonColor[ActualStage].B, 0.003); ActualColourHorizon.G = lerp(ActualColourHorizon.G, HorizonColor[ActualStage].G, 0.003);
ActualColourCloudSide.R = lerp(ActualColourCloudSide.R, RimColor[ActualStage].R ,0.01); ActualColourCloudSide.B = lerp(ActualColourCloudSide.B, RimColor[ActualStage].B,0.01); ActualColourCloudSide.G = lerp(ActualColourCloudSide.G, RimColor[ActualStage].G, 0.01); ActualColourCloudSide.A = lerp(ActualColourCloudSide.A, RimColor[ActualStage].A, 0.1);
ActualColourSun.R = lerp(ActualColoursun.R, SunColor[ActualStage].R ,0.01); ActualColourSun.B = lerp(ActualColoursun.B, SunColor[ActualStage].B, 0.01); ActualColourSun.G = lerp(ActualColourSun.G, SunColor[ActualStage].G, 0.01); ActualColourSun.A = lerp(ActualColourSun.A, SunColor[ActualStage].A, 0.1);
ActualStarsColor.R = lerp(ActualStarsColor.R, StarColor[ActualStage].R ,0.01); ActualStarsColor.B = lerp(ActualStarsColor.B, StarColor[ActualStage].B ,0.01); ActualStarsColor.G = lerp(ActualStarsColor.G, StarColor[ActualStage].G ,0.01);
ActualSkyBrightness = lerp(ActualSkyBrightness, skyBrightness[ActualStage] , 0.0025);
ActualRimBrightness = lerp(ActualRimBrightness, RimBrightness[ActualStage] , 0.0025);
ActualCloudDarkness = lerp(ActualCloudDarkness, CloudDarkness[ActualStage] , 0.0025);
ActualDesaturation = lerp(ActualDesaturation, Desaturation[ActualStage] , 0.0025);
ActualCloudOpacity = lerp(ActualCloudOpacity, CloudOpacity[ActualStage] , 0.0025);
ActualCloudBrightness = lerp(ActualCloudBrightness, CloudBrightness[ActualStage] , 0.0025);
ActualFogInscaBrighness = Lerp(ActualFogInscaBrighness, FogInscatteringBrightness[ActualStage], 0.002) ;
ActualFogOppositeBrighness = Lerp(ActualFogOppositeBrighness, FogOppositeBrightness[ActualStage] , 0.002) ; //Opposite fog bright...
ActualFogDensity = Lerp(ActualFogDensity, Density[ActualStage], 0.001) ;
ActualFogMaxFellOff = Lerp(ActualFogMaxFellOff, FogMaxFallOf[ActualStage], 0.004) ;
ActualFogAngle = Lerp(ActualFogAngle ,FogAngle[ActualStage] , 0.05) ;
ActualBloomScale = Lerp(ActualBloomScale, BloomScale[ActualStage], 0.005);
ActualBloomColorX = Lerp(ActualBloomColorX, BloomTint[ActualStage].R, 0.002) ; ActualBloomColorY = Lerp(ActualBloomColorY, BloomTint[ActualStage].G, 0.002); ActualBloomColorZ = Lerp(ActualBloomColorZ, BloomTint[ActualStage].B, 0.002);
ActualBloomColor.R = ActualBloomColorX; ActualBloomColor.G = ActualBloomColorY; ActualBloomColor.B = ActualBloomColorZ;
ActualRadialBlurrPercent = Lerp(ActualRadialBlurrPercent, RadialBlurrPercent[ActualStage], 0.005);
ActualMaskOcclusion = Lerp(ActualMaskOcclusion, RadialBlurrPercent[ActualStage], 0.005);
ActualOcclusionBloomDarkness = Lerp(ActualOcclusionBloomDarkness, OcclusionBloomDarkness[ActualStage], 0.005);
ActualOcculusionDepthRange = Lerp(ActualOcculusionDepthRange, OcculusionDepthRange[ActualStage], 0.005);
//Setters ////////////////////////////////////////////***********
//4 colours of sky
CurrentMaterial.SetVectorParameterValue('ZenithColor',ActualColourZenith);
CurrentMaterial.SetVectorParameterValue('HorizonColor',ActualColourHorizon);
CurrentMaterial.SetVectorParameterValue('Sun',ActualColourSun);
CurrentMaterial.SetVectorParameterValue('RimColor',ActualColourCloudSide);
CurrentMaterial.SetVectorParameterValue('StarColor',ActualStarsColor);
CurrentMaterial.SetScalarParameterValue('CloudBrightness',ActualCloudBrightness);
CurrentMaterial.SetScalarParameterValue('CloudOpacity',ActualCloudOpacity);
CurrentMaterial.SetScalarParameterValue('Desaturation',ActualDesaturation);
CurrentMaterial.SetScalarParameterValue('CloudDarkness',ActualCloudDarkness);
CurrentMaterial.SetScalarParameterValue('RimBrightness',ActualRimBrightness);
CurrentMaterial.SetScalarParameterValue('SkyBrightness',ActualSkyBrightness);
LightComponent.SetLightProperties(DLBrigthness, ActualDirColor );
SkyLightComponent ( SkyLight.LightComponent ).LowerBrightness = SLLBrigthness; //So no need for to change engine classes
SkyLight.LightComponent.SetLightProperties(SLBrigthness, ActualSkyLightColor);
//SkyLight.LightComponent.ForceUpdate(false);
//SkyLight.LightComponent.UpdateColorAndBrightness();
//SkyLight.LightComponent.SetEnabled(false);
//Shaft updating
//LightComponent.BloomScale = ActualBloomScale;
//LightComponent.OcclusionDepthRange = ActualOcculusionDepthRange;
//LightComponent.BloomTint = ActualBloomColor;
//LightComponent.RadialBlurPercent = ActualRadialBlurrPercent;
//LightComponent.OcclusionMaskDarkness = ActualOcclusionBloomDarkness;
//LightComponent.UpdateLightShaftParameters();
LightComponent.UpdateColorAndBrightness();
//Fog asset
FogAsset.Component.LightInscatteringColor = ActualFogInscatteringColor;
FogAsset.Component.OppositeLightColor = ActualFogColor;
//Non color fog properties
//FogAsset.Component.LightInscatteringBrightness = ActualFogInscaBrighness;
//FogAsset.Component.OppositeLightBrightness = ActualFogOppositeBrighness;
//FogAsset.Component.FogDensity = ActualFogDensity;
//FogAsset.Component.FogHeightFalloff = ActualFogMaxFellOff;
//FogAsset.Component.LightTerminatorAngle = ActualFogAngle;
FogAsset.Component.ForceUpdate(false);
self.SetRotation(R);
//worldInfO.GAME.BROADCAST(self,"FROM Day nigth skyLigth BRIGTHNESS IS is "@SLBrigthness@" the sky light lower is "@SLLBrigthness@" DL brigthness is "@DLBrigthness);
//Setters ////////////////////////////////////////////***********
//0 day 1 is nigth
//Nigth To day transition
if(Hours >= StagesStarts[0] && Hours < StagesEnds[0] )
{
//commented because it doesent do much
/*if(!SkyLight.LightComponent.bEnabled && DLBrigthness > 0.1)
{
//LightComponent.setEnabled(true);
SkyLight.LightComponent.SetEnabled(true);
WorldInfo.game.broadcast(Self,"FROM DayNight turning light on");
} */
if(Role == ROLE_Authority)
{
if(!bIsDay)
{
ActualStage = 0;
bIsDay = true;
}
}
}
//Day to nigth transition
if(Hours >= StagesStarts[1] && Hours < StagesEnds[1] )
{
//worldInfo.game.Broadcast(self, "FROM DayNigth is Skylight turned on "@SkyLight.LightComponent.bEnabled@"Whats the dl brigthness"@DLBrigthness);
//SkyLight.LightComponent.SetEnabled(true);
/*
if(SkyLight.LightComponent.bEnabled && DLBrigthness < 4)
{
WorldInfo.game.broadcast(Self,"FROM DayNight turning light off");
//LightComponent.setEnabled(False);
SkyLight.LightComponent.SetEnabled(false);
} */
if(Role == ROLE_Authority)
{
if(bIsDay)
{
ActualStage = 1;
bIsDay = false;
}
}
}
}
//set time specific of the sun
function SetNewTime(int NewHour, int NewMinute)
{
local float FloatMinutesAddition;
local float FloatHours;
local float ConstantHourRota;
FloatMinutesAddition =( ( (NewMinute*100) / 60 ) /100);
FloatHours = NewHour + FloatMinutesAddition;
ConstantHourRota = 65536/24;
R.pitch = (FloatHours+3)*ConstantHourRota;
self.SetRotation(R);
}
simulated function DisableAllLigthComponentsForPawns()
{
local GOTAMP2pawn RecollectedPawn;
foreach WorldInfo.AllPawns(class'GOTAMP2Pawn', RecollectedPawn)
{
RecollectedPawn.LightEnvironment.SetEnabled(false);
}
}
DefaultProperties
{
bHidden=FALSE //REPLICATION NEEDS THIS
bNoDelete=TRUE
bRouteBeginPlayEvenIfStatic=FALSE
bEdShouldSnap=FALSE
Begin Object name=DominantDirectionalLightComponent0
ModShadowFadeoutExponent=3.0
bRenderLightShafts=True
LightAffectsClassification=LAC_DYNAMIC_AND_STATIC_AFFECTING
CastShadows=TRUE
CastStaticShadows=TRUE
CastDynamicShadows=TRUE
bForceDynamicLight=FALSE
UseDirectLightMap=FALSE
bAllowPreShadow=TRUE
LightingChannels=(BSP=TRUE,Static=TRUE,Dynamic=TRUE,bInitialized=TRUE)
LightmassSettings=(LightSourceAngle=.2)
End Object
bStatic=FALSE
bHardAttach=TRUE
bMovable=TRUE
Physics=PHYS_Interpolating
RemoteRole=ROLE_SimulatedProxy
Role=ROLE_Authority
bNetInitialRotation=TRUE
bUpdateSimulatedPosition=TRUE
bReplicateMovement=TRUE
bAlwaysRelevant = true
bIsDay = true;
}
v
You have to go to content browser -> Actor classes , you search for this class and you place it in the map.
Well i would just write the rotation code to begin with, it fully works as multiplayer “error free”.
wait that means you replicate the rotation to all clients every frame?
I did the mine time ago, but thanks!
surviving with a artist that helps me, i know there’s a lot of bugs KActorSpawnable for resources ain’t an option but fixed it with staticMeshActor
Where is Spartacus? ^^ ;;;;;;