Page 1 of 1

Displaying images mid-game

Posted: Fri Oct 12, 2012 2:53 pm
by nichg
It seems like you can only start and end the game with cinematics. So if you want to do things like display a level heading as someone enters the level, or have 2D art displayed on screen, it seems like a different trick is needed.

My thought on this was to use the ability of the game to render a 'screenEffect' for certain spell effects. For instance, the full-screen flames you see when you're hit with a fireburst. So the idea is to make a new particle system for a screenEffect that would display text, and attach it to a spell effect that can produce a screenEffect (preferably without causing damage, but that can be gotten around using disable tricks or an OnDamage hook).

Here screen1.tga (screen1.dds) is a texture I've defined to display some text headings.

Code: Select all

defineParticleSystem{
   name = "flash_screen_1",
   emitters = {
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,2},
			boxMax = {0,0,2},
			sprayAngle = {60,60},
			velocity = {0,0},
			texture = "mod_assets/textures/screen1.tga",
			lifetime = {5.0, 5.0},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1.0,
			fadeIn = 1.0,
			fadeOut = 5.0,
			size = {2.3, 2.3},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Translucent",
			objectSpace = true,
		}
	}
}

defineObject{
	name = "textburst1",
	class = "BurstSpell",
	screenEffect = "flash_screen_1",
	particleSystem = "torch",
	lightColor = vec(0.75, 0.4, 0.25),
	lightBrightness = 40,
	lightRange = 4,
	sound = "fireburst",
	attackPower = 0,
	damageType = "fire",
	--cameraShake = true,
	tags = { "spell" },
}


So far so good, I've managed to render the custom screenEffect. The problem is, it always seems to occur at a random angle. This is true regardless of what I set sprayAngle to. Any idea how to pin down the angle and make it fixed, or is this a dead end?

Re: Displaying images mid-game

Posted: Sat Oct 20, 2012 5:38 pm
by Decayer
Has anyone found a solution to this?

Re: Displaying images mid-game

Posted: Sat Oct 20, 2012 6:26 pm
by Neikun
Can you post a screenshot of that particle in action?

Re: Displaying images mid-game

Posted: Sat Oct 20, 2012 7:04 pm
by Decayer
I didn't make the original post, but the texture is rotated randomly on creation, like if you picked one of the frames in this gif at random: http://www.fmsinc.com/microsoftaccess/c ... g-text.gif

Re: Displaying images mid-game

Posted: Sun Oct 21, 2012 4:25 pm
by nichg
Yeah, sorry, didn't get to this till now. Here's a shot from the dungeon editor.

http://steamcommunity.com/sharedfiles/f ... =103953124

Edit: I've made some progress. There's an undocumented function playScreenEffect in Party that you can use to directly display a screen-space particle system without requiring e.g. a burst spell to cause damage. Its still rotated though. Another interesting effect is if you turn off objectSpace, you can have text that floats in the air right between two tiles. Would be good for shimmering curtains of runes if we could get the orientation correct.