Jump to content


Photo

DataRun - Dynamic Skies


  • Please log in to reply
5 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 30 April 2008 - 01:54 PM

Ok, I started slapping about some DataRun code. The dynamic skies sounded interesting, so I'm working on that.

I'm extending StaticMeshActor to create a new DynamicEvilMesh actor - which can look at it's materials, and change a parameter within them, called Evil. The idea is, there is a linear interpolation between the 'Good' sky and the 'Evil' sky, that has a direct relationship with the player health. The class is generic, so we can use it for more than just skies, but I won't talk about those here. I find all the DynamicEvilMeshes in a map before the game begins, to make things easier.

Put simply, as the player health gets lower, the sky becomes increasingly evil. When the player health gets better, it gets less evil.

The trick is, any ideas on how to monitor health? We could add to all the take damage / healing functions, but I get a feeling there are a lot of them. Another option is to perhaps stick a timer in Pawn, to check every few seconds. This might be good, as we can then try and transition between skies.

Post Processing will also be code based (not volume based) - and will also depend heavily on the player health.

Here's the current code, anyway:
class DR_DynamicEvilMesh extends StaticMeshActor;

var MaterialInstanceConstant EvilMaterial;

function SetEvil(float Evil, int MaterialIndex)
{
	EvilMaterial = Material[MaterialIndex].CreateAndSetMaterialInstanceConstant( MaterialIndex );
	EvilMaterial.SetScalarParameterValue('Evil', Evil);
}

DefaultProperties
{
}

class DR_Game extends UTGame;

var array < DR_DynamicEvilMesh > DynamicEvilMeshes;
var array<Actor> out_Actors;

//Before the game begins, create an array of all meshes that dynamically change material with player health.
simulated function PostBeginPlay()
{
	local int i;
	
	Super.PostBeginPlay();

	if ( FindActorsOfClass(class'DataRun.DR_DynamicEvilMesh', out_Actors))
	{
		for (i = 0; i < out_Actors.Length; i++)
		{
			DynamicEvilMeshes[i] = DynamicEvilMeshes(out_Actors[i]);
		}
	}
}

DefaultProperties
{
	PlayerControllerClass=class'DataRun.DR_PlayerController'
	DefaultPawnClass=class'DataRun.DR_Pawn'
}


#2 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 30 April 2008 - 02:29 PM

Timer() sounds best, don't need to update DynamicEvilMesh in realtime. When DynamicEvilMesh have to be updated we could use another timer with a bigger rate to handle smooth transition ?

I'll check CameraVolume tonight after fixing scoreboard problem.

#3 ambershee

ambershee

    Nimbusfish Rawks

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

Posted 30 April 2008 - 02:57 PM

I'd continue working on making sure your Five Week volume code is all up to scratch before worrying about DataRun. You'll have plenty of time on the weekend and next week to muck around with dynamic camera systems :p

#4 ambershee

ambershee

    Nimbusfish Rawks

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

Posted 23 May 2008 - 12:14 PM

The promised screenies. I think the algorithm is finally totally right, it fades from a beautiful blue sky with a few white clouds, into a twilighty dark blue sky, then if the player is doing really badly, muddy brown and atmospheric red.


Player is doing well (100 seconds or more to go)
Posted Image

Player is starting to run out of time (50 seconds to go)
Posted Image

Player has run out of time (game over!)

Posted Image



Waddya think?

#5 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 23 May 2008 - 12:22 PM

Awesome !!! that's really stressFul :p

#6 Darknet

Darknet
  • Members
  • 75 posts

Posted 23 May 2008 - 02:22 PM

That really cool effect.
JP - Darknet




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users