Jump to content


Photo

Theme: Light


  • Please log in to reply
45 replies to this topic

#1 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 14 February 2008 - 05:30 PM

How are you getting along? What are you up to?

I started my mutator yesterday, and aim to have it finished on Monday or Tuesday, time allowing, as I'm really busy at work at the moment.

I took an obvious approach to my mutator, but I'm also using a number of more advanced UnrealScript features. I decided to use post processing in my mutator. Now, whenever you kill an enemy, the screen will flash bright white, blinding you, for a split second before fading away. LEt's see you double kill now!

It's very nearly there. I'm just having trouble getting the post processing to revert to normal after the flash.

Here's my code, for anyone who is interested in how I've attempted it:

class LP_Mutator_Flare extends UTMutator;

var class<GameRules> GRClass;

function bool MutatorIsAllowed()
{
	return (WorldInfo.NetMode == NM_Standalone);
}

function InitMutator(string Options, out string ErrorMessage)
{
	WorldInfo.Game.AddGameRules(GRClass);

	Super.InitMutator(Options, ErrorMessage);
}
	
DefaultProperties
{
	GRClass=class'MWLight.LP_Flare_Rules'
}

class LP_Flare_Rules extends GameRules;

var float FlashTime;
var localplayer LocalPlayer;
var PostProcessSettings FlareSettings, NormalSettings;

function ScoreKill(Controller Killer, Controller Killed)
{
	if ( PlayerController(Killer) != None )
	{
		LocalPlayer = LocalPlayer(PlayerController(Killer).Player);
		LocalPlayer.bOverridePostProcessSettings = true;
		
		NormalSettings.Scene_Highlights.X = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings.Scene_Highlights.X;
		NormalSettings.Scene_Highlights.Y = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings.Scene_Highlights.Y;
		NormalSettings.Scene_Highlights.Z = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings.Scene_Highlights.Z;
		
		FlareSettings.Scene_Highlights.X = 0.f;
		FlareSettings.Scene_Highlights.Y = 0.f;
		FlareSettings.Scene_Highlights.Z = 0.f;

		SetTimer(FlashTime, false);
	}
	if ( NextGameRules != None )
	{
		NextGameRules.ScoreKill(Killer,Killed);
	}
}

function timer()
{
	GotoState('rampup');
}

state Rampup
{
	function Tick(float DeltaTime)
	{
		if(DeltaTime > (FlashTime / 2))
		{
			//LocalPlayer.ClearPostProcessSettingsOverride();
			LocalPlayer.PostProcessSettingsOverride = NormalSettings;
			GotoState('');
		}
		else
		{
			FlareSettings.Scene_Highlights.X -= 0.001f;
			FlareSettings.Scene_Highlights.Y -= 0.001f;
			FlareSettings.Scene_Highlights.Z -= 0.001f;
			LocalPlayer.PostProcessSettingsOverride = FlareSettings;
		}
	}
}

DefaultProperties
{
	FlashTime = 0.5
}


#2 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 14 February 2008 - 10:02 PM

Sweet :good:

the problem of revert is not due to DeltaTime ??

DeltaTime is not elapsedTime

i think the condition below is not realised no ?

if(DeltaTime > (FlashTime / 2))


Just a thought, I have no way to test :p

#3 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 14 February 2008 - 10:51 PM

I also believe this is the problem - the trick is, what does one compare DeltaTime to, or failing that, how does one determine when the effect is ready to finish? I think I may have to resort to comparing the values of NormalSettings and FlareSettings and hoping for the best.

#4 Darknet

Darknet
  • Members
  • 75 posts

Posted 14 February 2008 - 11:10 PM

you should log time and event to show up in the consle output to see what happen to the event when tirgger or not trigger when it not use.
JP - Darknet

#5 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 15 February 2008 - 08:02 AM

In fact, it depends what you want to do:
- if it's a period of flash that you're trying to handle you need to take care of time (another timer() in the state ?, correct me if i'm wrong but UT3 accept one timer() in every state )
- if it's only rampup then stop. you could as Darknet said log "FlareSettings.Scene_Highlights.X" and take the value that you consider as enough, It will be the threshold that you can use as a condition in the tick (a bit empirical :p )

[Edit] about timer i was a bit wrong, in UT3 you can call a method different than timer() by specified the parameter inTimerFunc in setTimer method More details

Edited by xiongmao, 15 February 2008 - 12:24 PM.


#6 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 15 February 2008 - 05:08 PM

Yeah, I'm aware of all that, but I only need one timer at a time anyway. I am however still not getting it to lock down. It's almost as if when I revert the post processing, it's actually removing it entirely. The mutator now works on it's own - yay!

class LP_Flare_Rules extends GameRules;

var float FlashTime;
var localplayer LocalPlayer;
var PostProcessSettings FlareSettings, NormalSettings;

function ScoreKill(Controller Killer, Controller Killed)
{
	if ( PlayerController(Killer) != None )
	{
		LocalPlayer = LocalPlayer(PlayerController(Killer).Player);
		LocalPlayer.bOverridePostProcessSettings = true;
		
		NormalSettings.Scene_Highlights.X = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings.Scene_Highlights.X;
		NormalSettings.Scene_Highlights.Y = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings.Scene_Highlights.Y;
		NormalSettings.Scene_Highlights.Z = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings.Scene_Highlights.Z;
		
		FlareSettings.Scene_Highlights.X = 0.f;
		FlareSettings.Scene_Highlights.Y = 0.f;
		FlareSettings.Scene_Highlights.Z = 0.f;

		SetTimer(FlashTime, false);
	}
	if ( NextGameRules != None )
	{
		NextGameRules.ScoreKill(Killer,Killed);
	}
}

function timer()
{
	GotoState('rampup');
}

state Rampup
{
	function Tick(float DeltaTime)
	{
		if (NormalSettings.Scene_Highlights.X < 0)
		{
			if(FlareSettings.Scene_Highlights.X >= NormalSettings.Scene_Highlights.X)
			{
				LocalPlayer.ClearPostProcessSettingsOverride();// - make it compatible with other post process mutators!
				//LocalPlayer.PostProcessSettingsOverride = NormalSettings;
				GotoState('');
			}
			else
			{
				FlareSettings.Scene_Highlights.X -= 0.001f;
				FlareSettings.Scene_Highlights.Y -= 0.001f;
				FlareSettings.Scene_Highlights.Z -= 0.001f;
				LocalPlayer.PostProcessSettingsOverride = FlareSettings;
			}
		}
		else
		{
			if(FlareSettings.Scene_Highlights.X <= NormalSettings.Scene_Highlights.X)
			{
				LocalPlayer.ClearPostProcessSettingsOverride();// - make it compatible with other post process mutators!
				//LocalPlayer.PostProcessSettingsOverride = NormalSettings;
				GotoState('');
			}
			else
			{
				FlareSettings.Scene_Highlights.X += 0.001f;
				FlareSettings.Scene_Highlights.Y += 0.001f;
				FlareSettings.Scene_Highlights.Z += 0.001f;
				LocalPlayer.PostProcessSettingsOverride = FlareSettings;
			}
		}
	}
}

DefaultProperties
{
	FlashTime = 0.5
}

But! If I try to use it in conjunction with another mutator that also touches post processing, all goes to pot...

class LP_Mutator_Darkness extends UTMutator;

function ModifyPlayer(Pawn Other)
{
	local LocalPlayer LocalPlayer;
	local PostProcessSettings DarkSettings;
	
	LocalPlayer = LocalPlayer(PlayerController(Other.Controller).Player);
	LocalPlayer.bOverridePostProcessSettings = true;
	
	DarkSettings = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings;
	
	DarkSettings.bEnableDOF = true;
	DarkSettings.DOF_FocusInnerRadius = 1.f;
	DarkSettings.DOF_BlurKernelSize = 12.f;
	
	DarkSettings.DOF_MaxFarBlurAmount = 2.f;
	
	DarkSettings.Scene_Desaturation *= 0.5f;
	
	DarkSettings.Scene_HighLights.X -= 0.1f;
	DarkSettings.Scene_HighLights.Y -= 0.1f;
	DarkSettings.Scene_HighLights.Z -= 0.1f;
	
	DarkSettings.Scene_Midtones.X *= 2.5f;
	DarkSettings.Scene_Midtones.Y *= 2.5f;
	DarkSettings.Scene_Midtones.Z *= 2.5f;
	
	DarkSettings.Bloom_Scale *= 5.f;
	
	LocalPlayer.PostProcessSettingsOverride = DarkSettings;

	super.ModifyPlayer(Other);
}

DefaultProperties
{
}

The issue is likely the darkness mutator. I'll need to reset that every time the player spawns, not just modify the player - shouldn't be a big deal :)

#7 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 16 February 2008 - 03:45 PM

Is your state only rampup ?? :)

anyway nice job :) .

#8 Bob Chatman

Bob Chatman
  • New Members
  • 4 posts

Posted 16 February 2008 - 06:17 PM

Is there a way to pick up the system time in a mutator?

#9 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 16 February 2008 - 07:23 PM

i found this thread here it seems that you can't get the current time :) .
In previous UT you can find this information in a Subclass of Info (levelinfo if i remember well)

#10 Bob Chatman

Bob Chatman
  • New Members
  • 4 posts

Posted 16 February 2008 - 07:35 PM

heh, noted. Thank you.

#11 datguru

datguru
  • New Members
  • 2 posts

Posted 16 February 2008 - 10:39 PM

Ahhh didn't know we had even started! Nice idea ambershee id better get working on mine! Havnt even finished your tutorials yet havnt had the time, but what ill do is il give it a go at creating a small mutator ;). Anyways ill drop back when ive started making something :p.

Edited by datguru, 16 February 2008 - 10:39 PM.


#12 Grobi

Grobi
  • Members
  • 40 posts
  • Location:North West England
  • Projects:It's all hush hush.
  •  A goblin in the works

Posted 17 February 2008 - 04:22 PM

I haven't started my mutator yet but I have been reading through a programming book. It's just had me programming simple triggers under the actor class browser to generate messages on screen and stuff like that.

I'm not too sure if I'll be able to do a mutator by the hand in date, I've still got to work through all the ambershee tutorials so I have an idea of where to begin.

I've got a number of ideas for the theme so we'll just have to see where they lead.

That small wall of code you posted is fairly intimidating to ambershee! I understand most of it though which is re-assuring.

#13 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 17 February 2008 - 11:30 PM

Is your state only rampup ?? :lol:

anyway nice job :p .


The name is a bit misleading, I'll admit. I originally wanted to fade the flash in and out. I didn't like it, so I changed it so that now it only fades out. So it's more a 'rampdown' instead.

Is there a way to pick up the system time in a mutator?


Not yet, although I believe this is coming in a future patch.

That small wall of code you posted is fairly intimidating to ambershee! I understand most of it though which is re-assuring.


It's not too complex. Basically, when a player kills someone (scorekill), I get the post processing information for the killer. I then set a timer and go into the rampup (flash) state - where I alter the post processing values every tick. Before the timer finishes, I exit the state and reset the post processing back to normal.

#14 BoomerET

BoomerET
  • Members
  • 10 posts
  • Location:Northern California

Posted 18 February 2008 - 05:01 PM

Just thought I'd provide a simple update.

I am working on something to submit. Nothing nearly as fancy as AmberShee's

In fact, since I'm just learning, right now all I'm doing is changing some default properties
in UTPawn.

Playing around, seeing what does what, and generally experimenting.

Is our submission due by this coming Friday?


Dave aka BoomerET
Inspire by Example
Posted Image

#15 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 18 February 2008 - 05:08 PM

In fact, since I'm just learning, right now all I'm doing is changing some default properties in UTPawn.

Playing around, seeing what does what, and generally experimenting.


That's the way to do it, the ModifyPlayer function is great for this.

Is our submission due by this coming Friday?


That's the plan, although whether we'll have many submissions this first week is difficult to say, as it would seem people are largely learning the ropes. I should hope there's a couple of others frittering in the background though.

#16 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 18 February 2008 - 07:27 PM

As I told Ambershee, I can't run UT3 due to my poor computer, I think I can get all components in the 2 next weeks. That's a pity i can't participate to the first challenge :)

Anyway i try my best to help others ;)

The most important aspect of Mutator Week is that you help each other out.


so feel free to post any piece of code

[Edit] Computer Construction in progress ... graphic card found :)

Edited by xiongmao, 19 February 2008 - 12:43 PM.


#17 BoomerET

BoomerET
  • Members
  • 10 posts
  • Location:Northern California

Posted 21 February 2008 - 05:27 PM

GTS? I opted for the 8800GT and OC'd (Riva Tuner) it to achieve GTX performance.

Don't try this with stock cooling, you're asking for problems.

I decided it was time to update my 5yr old computer. Went w/ Asus Formula Maximus mobo/4GB RAM
(Yes, the RAM was under $100US for 4GB, so I pulled the trigger on that one.)

Had all the other components, so now the old box has been turned into a CentOS4 server.
It is mainly for my testing, such as Tomcat, Apache, Tapestry, SVN, UT3, etc, etc.

Anyways, I've posted my code for this week in Shee Labs SVN.

Now now, don't get excited, all I did was use ModifyPlayer to make the player invisible to bots
until which time you decide to either carry a flag or fire a weapon, or other things that I haven't
tested.


BoomerET
Inspire by Example
Posted Image

#18 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 21 February 2008 - 06:46 PM

Hmm

here is the definition of the method modifyPlayer

/* called by GameInfo.RestartPlayer()
change the players jumpz, etc. here
*/
function ModifyPlayer(Pawn Other)
{
if ( NextMutator != None )
NextMutator.ModifyPlayer(Other);
}


I'm not sure your player will ever become visible :thumbsupsmiley:
this method is usually called when game starts and when you die.

Moreover with your code, i think all pawns so all players (ai and human) will be invisible.
I don't know your level in Uscript but you must understand the difference between Pawn and Controller (AiController and PlayerController)
UTPawn is the 3D character you can see on the screen, the controller is you or the computer. a controller "posses" a pawn.

In Pawn class, you can see this method "IsPlayerPawn()"

if I modify your code it will looks like this:

function ModifyPlayer(Pawn P)
{
	if ( P!= None && P.isPlayerPawn() && UTPawn(P) != None )
	{
		UTPawn(P).SetInvisible(true);
	}
	super.ModifyPlayer(P)
}

Here is a useful link to navigate into Uscript hierarchy Uncodex (Javadoc Like)

Anyway, Good Start :)

Ps: i don't want an expensive computer so:
- Intel Q6600
- Asus P5K
- 2Gb Ram
- 8800 GTS 640
it should be enough for 2 years :good:

Edited by xiongmao, 21 February 2008 - 06:53 PM.


#19 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 21 February 2008 - 08:05 PM

Erwan is correct, in that the mutator function is only called when a player is spawned - after that it'll have no effect. It also does affect both players and pawns. The Pawn class is the player objects - they can be controlled by PlayerControllers (players) or AIControllers (computer) - the pawns will be changed in every case.

You can however add a GameRules class, like I did for my post processing, and use certain game rules functions to detect certain events - such as in the 'flash' mutator, when a player is killed.

Generally, it's often a good idea to give the bots any changes you give to players, as this means mutators can be happily played offline.


Finally, as it happens, the new 512mb GTS rev 2 can outperform the GTX, but there isn't really a huge difference between the GTS and GTX.

Edited by ambershee, 21 February 2008 - 08:05 PM.


#20 BoomerET

BoomerET
  • Members
  • 10 posts
  • Location:Northern California

Posted 21 February 2008 - 10:09 PM

Wow,

Interesting and completely relevant responses.

I love this, I'm going to learn a lot (and hopefully be able to teach as well).

I tested my code only by myself.

I was invisible each time after I got killed.

This is what I was trying to accomplish.

Thru my VERY limited testing, I could see all the bots, but they couldn't see me, unless I shot at them, in which case it was immediately apparant that they could see me, as they would then proceed to kill me.

Now then, it's possible I could only see them after they had fired their weapons?

I only tested this with bots, no other human players were involved.

If I grabbed the flag, I'm not sure if the bots saw me or not, I have more testing to do.


Lots more playing, er testing needs to be done, but I wanted to get something out there before the deadline.

Again, thanks so much for the criticism and advice, that is the ONLY way we're going to improve our abilities.


BoomerET
Inspire by Example
Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users