Questions about Canvas

Discussions about Coding and Scripting
Post Reply
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Questions about Canvas

Post by PrinceOfFunky »

I've some questions about canvas:
1. Why can I use "PostRender()" function on weapons(when active on player), to spawn multiple chairs with the "DrawActor()" function, and not to spawn multiple candles?
2. Who calls "RenderOverlays()" function? I saw that function overriden into "GuidedWarshell" class, and so I though that to call it on an actor, I just needed to make it my view target, but it is not called when an actor is my view target.
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: Questions about Canvas

Post by Shadow »

2. renderoverlays is called by the pawn that owns that weapon, if that weapon is currently the active weapon - renderoverlays on any actor is called automatically if it's the current viewtarget of the playerpawn

Code: Select all

simulated event RenderOverlays( canvas Canvas )
{
	if ( Weapon != None )
		Weapon.RenderOverlays(Canvas);
}
although I don't understand your first question..
Image
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Questions about Canvas

Post by PrinceOfFunky »

Shadow wrote:2. renderoverlays is called by the pawn that owns that weapon, if that weapon is currently the active weapon - renderoverlays on any actor is called automatically if it's the current viewtarget of the playerpawn

Code: Select all

simulated event RenderOverlays( canvas Canvas )
{
	if ( Weapon != None )
		Weapon.RenderOverlays(Canvas);
}
although I don't understand your first question..
I tried using "DrawText()" function, it worked on "PostRender()" function(the overrided one from a weapon), but it didn't work with inside "RenderOverlays()" function from a whatever class. I tried using the DrawText() inside RenderOverlays() into a Trigger object, and when I entered the command "cheatview Trigger", when that trigger became my ViewTarget, no text was shown, even if I wrote a call to DrawText().

For the chairs/candles case: Inside a weapon class, I tried calling the "PostRender()" function and make it Draw a Chair on the Canvas, with the "DrawActor()" function. It worked, it spawned a chair every frame, but only the last one was visible in game, the other ones were just invisible, but collideable and destructable. I tried changing the actor, from Chair to Candle, and the game crashed. It doesn't happen just with candles.
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Questions about Canvas

Post by sektor2111 »

I'm really happy because I never intend to try what you do blindly.

First of all, spawning an actor in render !!?? - This won't very occur in servers, only if client calls that in certain cases but... anyway...
Second: Change you glasses (or buy some from a good shop) and see default-properties of candle. Good luck with spawning candles...
The third - you said: Crash ? I would look over logs just by curiosity.
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Questions about Canvas

Post by PrinceOfFunky »

sektor2111 wrote:I'm really happy because I never intend to try what you do blindly.

First of all, spawning an actor in render !!?? - This won't very occur in servers, only if client calls that in certain cases but... anyway...
Second: Change you glasses (or buy some from a good shop) and see default-properties of candle. Good luck with spawning candles...
The third - you said: Crash ? I would look over logs just by curiosity.
So you meant, that it is because Candle class has these 2 settings:
bCollideActors=True
bCollideWorld=True
(That doesn't even work in game, but well...)
?

Well, that's weird that Chair class has bCollideActors and bCollideWorld to False tho... o.o
Anyway Thank you for the answer :)
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Questions about Canvas

Post by sektor2111 »

Nope, you did not even read latest posts with iterator deletion, so you don't seems to understand that a PATHNODE, CANDLE OR ANY bStatic or bNoDelete WON'T SPAWN NORMALLY EVER without hacks.
PrinceOfFunky wrote: So you meant, that it is because Candle class has these 2 settings:
bCollideActors=True
bCollideWorld=True
(That doesn't even work in game, but well...)
Yes... you don't understand these, and they ARE VERY WORKING - and they are pretty Important at a moment or Absolutely important when we speak about pawns as actors linked with these.

A friendly advice:
Do some mutator in DM for whatever accelerating combat purposes. In random moments toy with these values at pawns and see what you get before to speak more bad presumptions if their name is not enough self explanatory.
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Questions about Canvas

Post by Barbie »

I'm still not sure what you want to achieve: either spawning something in the map? Then it will be drawn by client automatically. Or do you want to change what is shown on clients screen? Then you should have a look at the HUD classes.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Questions about Canvas

Post by sektor2111 »

Barbie wrote:I'm still not sure what you want to achieve: either spawning something in the map? Then it will be drawn by client automatically. Or do you want to change what is shown on clients screen? Then you should have a look at the HUD classes.
Exactly this is my out of understanding point - Canvas + Spawning Candles which won't spawn, and Canvas runs mainly in player after all...
Chris
Experienced
Posts: 134
Joined: Mon Nov 24, 2014 9:27 am

Re: Questions about Canvas

Post by Chris »

For further notice, I'd recommend that you check the wiki at http://wiki.beyondunreal.com/ before asking questions about things that has already been documented.
RenderOverlays() is exactly what it says, it's used to draw additional textures and stuff when the weapon is selected.
Canvas is simple, DrawActor() for example is used to draw actors on the Player's screen, like the weapon.
If you want to print text on the clients HUD you'd probably want a HUD mutator (Check wiki).
I'd also suggest you to do some research on how client/server roles work, and why you shouldn't blindly spawn crap on the client.

EDIT:
You don't Spawn anything using the DrawActor() function.
Read this:
http://wiki.beyondunreal.com/What_happe ... awn_checks
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Questions about Canvas

Post by JackGriffin »

Personally I think canvas and HUD is only slightly easier to fully understand than replication. Don't worry if it takes a while to make sense of things.
So long, and thanks for all the fish
Chris
Experienced
Posts: 134
Joined: Mon Nov 24, 2014 9:27 am

Re: Questions about Canvas

Post by Chris »

Truth is that, HUD and Canvas in UE1 is very messy and inefficient.
Obviously a Canvas can only exist on a client, which in turn is co-operating with the viewport.
The Canvas object is not stored in a global variable logically, but sent as a parameter to a function such as PostRender() which has to be called every tick because everything gets flushed right at the beginning of the tick.
Looking at Epic's HUD code might be confusing and not really helpful at first because it's alot to wrap your head around.
For example the default HUD mutator registration method is broken for network play.
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Questions about Canvas

Post by PrinceOfFunky »

sektor2111 wrote:Nope, you did not even read latest posts with iterator deletion
No, I wasn't interested.
sektor2111 wrote:so you don't seems to understand that a PATHNODE, CANDLE OR ANY bStatic or bNoDelete WON'T SPAWN NORMALLY EVER without hacks.
I know it... but you said:
sektor2111 wrote:Change you glasses (or buy some from a good shop) and see default-properties of candle. Good luck with spawning candles...
And so I though that the solution was directly written in the default properties of Candle calss.
Chris wrote:For further notice, I'd recommend that you check the wiki at http://wiki.beyondunreal.com/ before asking questions about things that has already been documented.
I always check the wiki before to post here.
Chris wrote:RenderOverlays() is exactly what it says, it's used to draw additional textures and stuff when the weapon is selected.
Well... ...actually the name "RenderOverlays" doesn't implicity say it all, but ok. XD
Chris wrote:If you want to print text on the clients HUD you'd probably want a HUD mutator (Check wiki).
I already did it and I didn't need an HUD mutator.
Chris wrote:You don't Spawn anything using the DrawActor() function.
If I don't spawn the actor before to give it as parameter to the "DrawActor()" function, it gives me an error.
Already read it.
Chris wrote:The Canvas object is not stored in a global variable logically, but sent as a parameter to a function such as PostRender() which has to be called every tick because everything gets flushed right at the beginning of the tick.
But I think there might be at least one Canvas variable somewhere.
JackGriffin wrote:Personally I think canvas and HUD is only slightly easier to fully understand than replication. Don't worry if it takes a while to make sense of things.
Yeah, I mean, there are a lot of better solution than canvas, they could use, I guess.

Sorry for the long post.
"Your stuff is known to be buggy and unfinished/not properly tested"
Chris
Experienced
Posts: 134
Joined: Mon Nov 24, 2014 9:27 am

Re: Questions about Canvas

Post by Chris »

PrinceOfFunky wrote:
Chris wrote:RenderOverlays() is exactly what it says, it's used to draw additional textures and stuff when the weapon is selected.
Well... ...actually the name "RenderOverlays" doesn't implicity say it all, but ok. XD
Chris wrote:You don't Spawn anything using the DrawActor() function.
If I don't spawn the actor before to give it as parameter to the "DrawActor()" function, it gives me an error.
Chris wrote:The Canvas object is not stored in a global variable logically, but sent as a parameter to a function such as PostRender() which has to be called every tick because everything gets flushed right at the beginning of the tick.
But I think there might be at least one Canvas variable somewhere.
"Render Overlays" What is hard to understand in that? Are you saying that it doesn't explain what "Rendering" and "Overlays" is? Well in that case you can walk that chain forever.

It doesn't seem like you understand what I'm saying. If you understand the mechanics of the Canvas, then you'd also understand why you wouldn't point a Canvas object to a global variable. It doesn't make sense unless you want to use its metrics functions only.

One thing I had in mind as an optimization to the Canvas would be to have elements, such as a text string wrapped in a "TextObject" and only have it updated when needed, where each one would have an FName ID so you could do something like "GetTextObject('Ammo').setText(100)" Same thing for non translucent/modulated textures (these would have to be updated each tick)
The design of UE1 wouldn't allow that but it's an idea.
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Questions about Canvas

Post by PrinceOfFunky »

Chris wrote:
PrinceOfFunky wrote:
Chris wrote:RenderOverlays() is exactly what it says, it's used to draw additional textures and stuff when the weapon is selected.
Well... ...actually the name "RenderOverlays" doesn't implicity say it all, but ok. XD
Chris wrote:You don't Spawn anything using the DrawActor() function.
If I don't spawn the actor before to give it as parameter to the "DrawActor()" function, it gives me an error.
Chris wrote:The Canvas object is not stored in a global variable logically, but sent as a parameter to a function such as PostRender() which has to be called every tick because everything gets flushed right at the beginning of the tick.
But I think there might be at least one Canvas variable somewhere.
"Render Overlays" What is hard to understand in that? Are you saying that it doesn't explain what "Rendering" and "Overlays" is? Well in that case you can walk that chain forever.

It doesn't seem like you understand what I'm saying. If you understand the mechanics of the Canvas, then you'd also understand why you wouldn't point a Canvas object to a global variable. It doesn't make sense unless you want to use its metrics functions only.

One thing I had in mind as an optimization to the Canvas would be to have elements, such as a text string wrapped in a "TextObject" and only have it updated when needed, where each one would have an FName ID so you could do something like "GetTextObject('Ammo').setText(100)" Same thing for non translucent/modulated textures (these would have to be updated each tick)
The design of UE1 wouldn't allow that but it's an idea.
I feel like I should be use to this UE1 ways... lol
"Your stuff is known to be buggy and unfinished/not properly tested"
Post Reply