[needs randi]Overlays for Actors

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

[needs randi]Overlays for Actors

Post 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
Last edited by Major Cooke on Thu Jul 28, 2016 4:24 pm, edited 7 times in total.
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Re: Overlays for Actors

Post 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?
User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Overlays for Actors

Post 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!)
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post 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.
Gez
 
 
Posts: 17831
Joined: Fri Jul 06, 2007 3:22 pm

Re: Overlays for Actors

Post by Gez »

I'm afraid of the performance hit that'd happen if every actor has to be processed for multiple sprites.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post 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.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Overlays for Actors

Post 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.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post 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.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post by Major Cooke »

Updated. Cleaned up the merge conflict.
User avatar
Rachael
Posts: 13527
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Overlays for Actors

Post 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.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post 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.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: Overlays for Actors

Post by The Zombie Killer »

This would be incredibly useful for possession (and Classic Arcade too, if it works on camtextures!)
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post 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.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Overlays for Actors

Post by Arctangent »

Out of curiosity, are there any issues that could arise if you use this on a player?
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Overlays for Actors

Post 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.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”