Page 1 of 2

[needs randi]Overlays for Actors

Posted: Tue Jun 21, 2016 10:05 am
by Major Cooke
Leonard2's Pull Request

Allows overlays to be set and destroyed on actors. Useful if someone makes remote controlled things such as flying attack robots with guns that can be controlled until destroyed. ;)

Summon D in console. It will display the rocket launcher sprites on its own, switching between frames A and B.

Code: Select all

Actor D
{
	+NOINTERACTION
	States
	{
	Spawn:
		PLAY A 15
		PLAY A 16
		{
			Thing_ChangeTID(0,20000);
			ChangeCamera(20000,1,0);
			A_Overlay(2,"Test");
			A_OverlayOffset(2,0,32);
		}
		PLAY A 17
		{
			if (!A_Overlay(2,"Null",true))
			{	
				A_PrintBold("This one's still rollin!");
				A_SetTics(17*9);
			}
			else
			{	A_PrintBold("That ain't good.");	}
		}
		PLAY A 17
		PLAY A 0 ChangeCamera(0,1,0)
		Stop
	
	Test:
		MISG A 17 A_PrintBold("10")
		MISG B 17 A_PrintBold("9")
		MISG A 17 A_PrintBold("8")
		MISG B 17 A_PrintBold("7")
		MISG A 17 A_PrintBold("6")
		MISG B 17 A_PrintBold("5")
		MISG A 17 A_PrintBold("4")
		MISG B 17 A_PrintBold("3")
		MISG A 17 A_PrintBold("2")
		MISG B 17 A_PrintBold("1")
		Stop
	}
}
Image

Re: Overlays for Actors

Posted: Wed Jun 22, 2016 12:02 am
by Snarboo
Would this allow for attachable accessories, such as satchels or damage decals, or would this be restricted to parallel functions, such as allowing monsters to summon child actors independently of what state they're in?

Re: Overlays for Actors

Posted: Wed Jun 22, 2016 2:24 am
by Nash
Good, I'm tired of the disproportionate performance overhead from attaching multi-part monsters via A_Warping them together.

Even if a monster is only made up of two parts - let's say upper body and lower body - the amount of actor processing is already doubled (it's like for every 1 of those monsters, there's 2 of them because they're separate, full actors all with their own LOS/AI overhead - even if the attached part doesn't need them!)

Re: Overlays for Actors

Posted: Wed Jun 22, 2016 5:19 am
by Major Cooke
Snarboo wrote:Would this allow for attachable accessories, such as satchels or damage decals, or would this be restricted to parallel functions, such as allowing monsters to summon child actors independently of what state they're in?
The latter.

Re: Overlays for Actors

Posted: Wed Jun 22, 2016 7:10 am
by Gez
I'm afraid of the performance hit that'd happen if every actor has to be processed for multiple sprites.

Re: Overlays for Actors

Posted: Wed Jun 22, 2016 7:44 am
by Major Cooke
The only sprites to process are if the camera's being viewed from within them, i.e. ChangeCamera. Otherwise, they're not rendered at all. It would be no different than ticking inventory, only on the actor itself instead of an inventory.

Re: Overlays for Actors

Posted: Wed Jun 22, 2016 8:26 am
by Xaser
Seems like there's a disconnect between the actual suggestion and our perceptions of it -- I was confused too at first. :P

I think what Cooke is asking is for the ability to attach PSprite layers to things like cameras or monsters so that they get displayed on the player's screen if you ChangeCamera to the actor... this by itself is would be an oddly-specific use-case that could be dismissed with a "use HudMessage", but the second key point is that the PSprites have full state sequences that can affect its parent actor, so a monster can have multiple DECORATE state loops going on at once.

I still like Nash's interpretation better, though. If we could somehow figure out how to do that, then we can do some kickass visual stuff and get the multi-state benefits as described above.

TBH, A_Warp has matured rather nicely, so I still dunno the true feasibility of this given you can sorta do it already. Just spitballing/translating.

Re: Overlays for Actors

Posted: Thu Jun 23, 2016 7:35 am
by Major Cooke
Edward-san (from another thread he meant to post here) wrote:Sounds so much WFDS, but maybe I'm too pessimistic :mrgreen:
Maybe so, but the code is quite similar so perhaps that could be something going for it. As you can see in my PR, I managed to just extend DPSprites to non-players.
Xaser wrote:I think what Cooke is asking is for the ability to attach PSprite layers to things like cameras or monsters so that they get displayed on the player's screen if you ChangeCamera to the actor... this by itself is would be an oddly-specific use-case that could be dismissed with a "use HudMessage", but the second key point is that the PSprites have full state sequences that can affect its parent actor, so a monster can have multiple DECORATE state loops going on at once.
Leonard2 was going to do this, now that he has the base overlays in for players. However, it appears he's taking a break for the time being so I jumped on board after he provided some... inspiration. Admittedly though, he probably would've done it a lot better than I would have. But, it was a lot easier than I thought it would be which I'm proud of.
Xaser wrote:I still like Nash's interpretation better, though. If we could somehow figure out how to do that, then we can do some kickass visual stuff and get the multi-state benefits as described above.
That's unfortunately all doomscript material I think.

-----

And I'm done. Now I just need people to review my code.

Re: Overlays for Actors

Posted: Wed Jul 06, 2016 10:17 am
by Major Cooke
Updated. Cleaned up the merge conflict.

Re: Overlays for Actors

Posted: Wed Jul 06, 2016 11:42 am
by Rachael
Alright - I was pretty darn confused reading this whole thing until it finally clicked what this is actually trying to accomplish.

So for those people who are as confused as I was - here is my interpretation of it (in Lehman's terms) -

Basically, it's like attaching weapon sprites to a non-player view for when you ChangeCamera to said actor. So if you are controlling a non-player "monster" (let's just call it that) you still get a "weapon" on your screen belonging to said "monster".

Please feel free to correct me if I am wrong.

Re: Overlays for Actors

Posted: Wed Jul 06, 2016 11:44 am
by Major Cooke
That's basically my github commit message with expanded detail. :P You nailed it on the head. Note that what the monsters draw is their own overlays. So if you have a plasma rifle up and you set a rocket launcher for a monster, the rocket launcher will be visible instead of the plasma rifle when using ChangeCamera.

Re: Overlays for Actors

Posted: Fri Jul 08, 2016 1:37 am
by The Zombie Killer
This would be incredibly useful for possession (and Classic Arcade too, if it works on camtextures!)

Re: Overlays for Actors

Posted: Fri Jul 08, 2016 7:51 am
by Major Cooke
Agreed. I'm not sure if it works on camtextures or not though. I've always been a little fumble-some with those, can't ever seem to get them to work right. :|

That is, generally speaking, not involving my submission at all.

Re: Overlays for Actors

Posted: Fri Jul 08, 2016 10:04 am
by Arctangent
Out of curiosity, are there any issues that could arise if you use this on a player?

Re: Overlays for Actors

Posted: Fri Jul 08, 2016 10:06 am
by Major Cooke
On the contrary. It was built for the player. This just happens to expand it to actors. In fact, every weapon call technically puts them ON the player itself.