Page 2 of 13

Re: Wyrmsun

Posted: Wed Dec 18, 2013 5:42 pm
by Kyran
b_o wrote:A lot of the AT sprites seem like they only need some repair (a few more shades and some slight adjustments, I might be able to help with that).
A lot of the AT sprites just need to be thrown away. :D

Re: Wyrmsun

Posted: Wed Dec 18, 2013 5:59 pm
by b_o
Kyran wrote:A lot of the AT sprites just need to be thrown away. :D
The ones with the wrong angle might be more work to fix than they are worth.. but some of the stuff seems salvageable:
atd.png
atd.png (1.91 KiB) Viewed 7287 times

Re: Wyrmsun

Posted: Wed Dec 18, 2013 9:13 pm
by Kyran
An interesting idea. The AT footman doesn't look quite right, but if it were scaled down a little on the Y axis to be the same pixel height of the Wargus footman, I think it would look much better. Put the AT and Wargus footmen side by side to see what I mean.

Re: Wyrmsun

Posted: Wed Dec 18, 2013 11:45 pm
by cybermind
Andrettin wrote:"big fire" and "small fire" effects
I think there is no need for that. Stratagus now has a particle system, so you can use it to create more beautiful effects for fire.

Re: Wyrmsun

Posted: Thu Dec 19, 2013 2:57 am
by Andrettin
b_o wrote:
Kyran wrote:A lot of the AT sprites just need to be thrown away. :D
The ones with the wrong angle might be more work to fix than they are worth.. but some of the stuff seems salvageable:
atd.png
Yes, it seems to me that many of the humanoid units in AT are in the wrong angle (many of them look isometric instead of having the angle WC2 units do). The mechanical units seem to be in a better state, and would probably take less work to improve. For instance, these two units:

Image

Image

They are both in a proper angle, and are in decent shape already, although they could be improved a bit (for instance: the ballista's "body" is a bit too small, both the strings and the team-colored parts are not shaded at all and maybe the coloring of the ballista could be improved; the ballista bolt in the unit's graphics is nice, but it doesn't match with the ballista bolt missile).

Re: Wyrmsun

Posted: Thu Dec 19, 2013 2:58 am
by Andrettin
cybermind wrote:
Andrettin wrote:"big fire" and "small fire" effects
I think there is no need for that. Stratagus now has a particle system, so you can use it to create more beautiful effects for fire.
Is there anywhere I can see an example of the particle system being used?

Re: Wyrmsun

Posted: Thu Dec 19, 2013 3:16 am
by cybermind
Andrettin wrote:Is there anywhere I can see an example of the particle system being used?
Currently there are 2 games on Stratagus which use particle system: Bos Wars and Doom Wars.
How it could be used:
1) define a particle:

Code: Select all

particle_building_smoke = {}
particle_building_smoke_light = {}

for i = 1, 4 do
  particle_building_smoke[i] = LoadGraphic("graphics/missiles/particles/buildingsmoke"..i..".png", 16, 15)
  particle_building_smoke_light[i] = LoadGraphic("graphics/missiles/particles/buildingsmoke"..(i + 4)..".png", 16, 15)
end

function addChunkParticles(amount, smokegraphic, debrisgraphic, ticksperframe1, ticksperframe2,
	x, y, minvel, maxvel, minangle, maxTTL, destroyparticle, ticksperframe3, dlDeb, dlSmok, dlDest)
	local smokeanimation = GraphicAnimation(smokegraphic, ticksperframe1)
	local debrisanimation = nil
	local destroyanimation = nil
	if (debrisgraphic ~= nil) then
		debrisanimation = GraphicAnimation(debrisgraphic, ticksperframe2)
	else
		debrisanimation = GraphicAnimation(nullgraphics, 1)
	end
	if (destroyparticle ~= nil) then
		destroyanimation = GraphicAnimation(destroyparticle, ticksperframe3)
	else
		destroyanimation = GraphicAnimation(nullgraphics, 1)
	end
	for i = 1, amount do
		local chunk = CChunkParticle(CPosition(x, y), smokeanimation, debrisanimation, destroyanimation, minvel, maxvel, minangle, maxTTL, dlDeb)
		chunk:setSmokeDrawLevel(dlSmok)
		chunk:setDestroyDrawLevel(dlDest)
		ParticleManager:add(chunk:clone())
	end
end

function addSmokeParticle(graphic, ticksperframe, x, y, speedx, speedy, drawlevel)
   local smokeanimation = GraphicAnimation(graphic, ticksperframe)
   local smoke = CSmokeParticle(CPosition(x, y), smokeanimation, speedx, speedy, drawlevel)
   ParticleManager:add(smoke:clone())
end
2) define a unit lua handler function:

Code: Select all

DefineUnitType("unit-tech-center", { 
................................
  OnEachCycle = SmokeControlTechCenter,
........................................
 } )
3) define that function and write whatever you want in it

Code: Select all

function ParticleBuildingSmoke(x, y)
	addSmokeParticle(pickRandom(particle_building_smoke_light), 150, x + math.random(4) - 2, y + math.random(4) - 2, 2 + math.random(8), -15 - math.random(15), drawLevels.DL_PartGround)
end

function SmokeControlTechCenter(slot)
	if (GetUnitVariable(slot,"HitPoints","Value") * 100 / GetUnitVariable(slot,"HitPoints","Max") <= 50) 
	 and GetUnitVariable(slot,"SmokeTime") > 0 then
		SetUnitVariable(slot,"SmokeBreak", GetUnitVariable(slot,"SmokeBreak") + 1)
		if GetUnitVariable(slot,"SmokeBreak") == 8 then
			SetUnitVariable(slot,"SmokeBreak", 0)
			local x = GetUnitVariable(slot, "PosX") * 32
			local y = GetUnitVariable(slot, "PosY") * 32
			ParticleBuildingSmoke(x + 85, y + 81)
			if math.random(100) >= 95 then
				addChunkParticles(1, pickRandom(particle_building_smoke), pickRandom(particle_building_parts), 150, 100, x + 85, y + 81, 0, 400, 77, 0, nil, 0, drawLevels.DL_PartGround, drawLevels.DL_PartLow, drawLevels.DL_PartLow)
			end
		end
	end
end

How that looks like in Doom Wars:
Image

Re: Wyrmsun

Posted: Thu Dec 19, 2013 3:29 am
by Andrettin
cybermind wrote:
Andrettin wrote:Is there anywhere I can see an example of the particle system being used?
Currently there are 2 games on Stratagus which use particle system: Bos Wars and Doom Wars.
How it could be used:
1) define a particle:

Code: Select all

particle_building_smoke = {}
particle_building_smoke_light = {}

for i = 1, 4 do
  particle_building_smoke[i] = LoadGraphic("graphics/missiles/particles/buildingsmoke"..i..".png", 16, 15)
  particle_building_smoke_light[i] = LoadGraphic("graphics/missiles/particles/buildingsmoke"..(i + 4)..".png", 16, 15)
end

function addChunkParticles(amount, smokegraphic, debrisgraphic, ticksperframe1, ticksperframe2,
	x, y, minvel, maxvel, minangle, maxTTL, destroyparticle, ticksperframe3, dlDeb, dlSmok, dlDest)
	local smokeanimation = GraphicAnimation(smokegraphic, ticksperframe1)
	local debrisanimation = nil
	local destroyanimation = nil
	if (debrisgraphic ~= nil) then
		debrisanimation = GraphicAnimation(debrisgraphic, ticksperframe2)
	else
		debrisanimation = GraphicAnimation(nullgraphics, 1)
	end
	if (destroyparticle ~= nil) then
		destroyanimation = GraphicAnimation(destroyparticle, ticksperframe3)
	else
		destroyanimation = GraphicAnimation(nullgraphics, 1)
	end
	for i = 1, amount do
		local chunk = CChunkParticle(CPosition(x, y), smokeanimation, debrisanimation, destroyanimation, minvel, maxvel, minangle, maxTTL, dlDeb)
		chunk:setSmokeDrawLevel(dlSmok)
		chunk:setDestroyDrawLevel(dlDest)
		ParticleManager:add(chunk:clone())
	end
end

function addSmokeParticle(graphic, ticksperframe, x, y, speedx, speedy, drawlevel)
   local smokeanimation = GraphicAnimation(graphic, ticksperframe)
   local smoke = CSmokeParticle(CPosition(x, y), smokeanimation, speedx, speedy, drawlevel)
   ParticleManager:add(smoke:clone())
end
2) define a unit lua handler function:

Code: Select all

DefineUnitType("unit-tech-center", { 
................................
  OnEachCycle = SmokeControlTechCenter,
........................................
 } )
3) define that function and write whatever you want in it

Code: Select all

function ParticleBuildingSmoke(x, y)
	addSmokeParticle(pickRandom(particle_building_smoke_light), 150, x + math.random(4) - 2, y + math.random(4) - 2, 2 + math.random(8), -15 - math.random(15), drawLevels.DL_PartGround)
end

function SmokeControlTechCenter(slot)
	if (GetUnitVariable(slot,"HitPoints","Value") * 100 / GetUnitVariable(slot,"HitPoints","Max") <= 50) 
	 and GetUnitVariable(slot,"SmokeTime") > 0 then
		SetUnitVariable(slot,"SmokeBreak", GetUnitVariable(slot,"SmokeBreak") + 1)
		if GetUnitVariable(slot,"SmokeBreak") == 8 then
			SetUnitVariable(slot,"SmokeBreak", 0)
			local x = GetUnitVariable(slot, "PosX") * 32
			local y = GetUnitVariable(slot, "PosY") * 32
			ParticleBuildingSmoke(x + 85, y + 81)
			if math.random(100) >= 95 then
				addChunkParticles(1, pickRandom(particle_building_smoke), pickRandom(particle_building_parts), 150, 100, x + 85, y + 81, 0, 400, 77, 0, nil, 0, drawLevels.DL_PartGround, drawLevels.DL_PartLow, drawLevels.DL_PartLow)
			end
		end
	end
end

How that looks like in Doom Wars:
Image
Hey cybermind,

thanks for the explanation! :)

Re: Wyrmsun

Posted: Fri Dec 20, 2013 10:11 am
by jarod42
@cybermind: if not done, can you add it in the help documentation. thanks.

Re: Wyrmsun

Posted: Fri Dec 20, 2013 1:17 pm
by Zed
jarod42 wrote:@cybermind: if not done, can you add it in the help documentation. thanks.
That wouldn't be in the Stratagus spirit.