The Stage3DPunk Thread!

(Jacob Albano) #42

Show the contents of the die() function, please? Nothing you have there is going to be of much help.

One thing that might make a difference (though I doubt it) is that your color value is RBG instead of ARGB. You could try 0xff800080 instead of 0x800080. It shouldn’t make a difference to Flashpunk, but it’s possible Stage3dPunk doesn’t account for it at some point.

(Red Ligot) #43
public function die():void

Honestly, I don’t understand what showing the die function has to do with it. I also tried to change the color value to ARGB, it doesn’t seem to work though. =p

(azrafe7) #44

Hey @redligot2009,

@jacobalbano’s request is more than understable: showing us the content of the die() function can be valuable to us to make sure it is not causing side-effects in some way. :smile:

I’ve lately found some incosistencies too when trying to re-apply a different tinting in Stage3D mode, but weirdly I cannot reproduce the issue reliably (it seems not to work in the same way with the standard FP counterpart).

Can you isolate the issue with a simple project and post it here for us to take a look at?

(Red Ligot) #45
public class MainWorld extends World 
        private var gameGraphicImg:Class;
        private var img:Image;
        private var gameEntity:Entity;
        public function MainWorld() 
            img = new Image(gameGraphicImg);
            gameEntity = new Entity(32, 32, img);
        override public function update():void
            img.color = 0x008080;

So I tried to recreate the bug with a simple project that simply adds an Entity and changes its graphic’s color. I was able to successfully recreate it. Unless the image’s color has been set before in the begin function or constructor and the color it was set to wasn’t white, the color doesn’t change.

(azrafe7) #46

Great! I can reproduce the issue using your code.

I’ve tried to find out where the problem might be without success, but… I discovered a weird workaround that should give some hints to @Ultima2876 of what is going wrong:

public class GameWorld extends World 
	var gameGraphicImg:Class;
	var img:Image;
	var gameEntity:Entity;

	public function GameWorld() 
		img = new Image(gameGraphicImg);
		img.tinting = 0;
		gameEntity = new Entity(32, 32, img);

	override public function update():void
		img.tinting = 1;
		img.color = 0x008080;

As you’ll see the color gets applied with a one frame delay.

(Ultima2876) #47

Strange stuff. Thanks very much guys for looking into it - I really appreciate it! These test cases and explorations of the issue are incredibly helpful for me, especially at the moment as I am quite pressed for time. I’ll look into a fix this evening!


(Ultima2876) #48

I’ve found the issue and have fixed it. I haven’t yet had time to look into the other issues here so for now I’m going to provide a hotfix swc rather than doing a full release. You can grab that here:

Simply replace your current swc with that.

I’m aiming to make a full official update this weekend that addresses all of the issues gathered up to this point (plus exposing documentation for the internal stage3d functionality etc - and possibly an ASDoc export!). Sorry I haven’t been very active recently!

(azrafe7) #49

Thanks for the fix, you’re fast! :smile:

I’ve tested it and it works. What was it if I may ask?

The only thing I’d wish to add is that it still has the one frame delay I mentioned before (in both FP mode and S3P). The issue is not present in vanilla FP, and I seem to have restricted it to Engine.update(), which has a different order of function calls (watch out for checkWorld() and updateLists() specifically).

(Ultima2876) #50

Ah, I’ll have to check that. It probably is exactly as you say - a different order of operations there meaning it isn’t picking up the new color until the next render. That also probably effects many other things in a similar way I’d imagine.

The issue was to do with optimisations not picking up on the update as I thought, but not specifically to do with the ‘lazy vertices’ optimisation - basically, it only enables the tint shader for batches that require them and it wasn’t picking up on the color updates to do so in this particular instance (ie changing colors without the tint mode changing). Now it enables the tint shader in the actual color update functions (within the Stage3DSprite class).

(John Andersson) #51

Hi, I got a weird error which might be related to stage3dpunk

Thank you

(Zouhair Elamrani Abou Elassad) #52

I tried to follow exactly the demo video that was used to set The Pink Demo Project, i’m using Flex 4.13.0 and AIR 15, i get this error :

 Error while setting up Stage3D: 3702 - Error #3702: Context3D non disponible.
 Running in Non-Stage3D mode (Stage3D not supported)!
 Post-Init Children: 0 [Null Stage]

(Ultima2876) #53

How are you testing your game? In order for Stage3D to be supported when testing in the browser (rather than a desktop AIR window) you need to have ‘direct’ render mode enabled. For AIR, depending on your environment, you may also need to enable the ‘direct’ render mode to allow the game to get a Stage3D context.

(Zouhair Elamrani Abou Elassad) #54

I get the trace log saying that there is an error while setting the Stage3D, i never tested my game on the browser, i’m already setting wmode=“direct” in my web page, i’m testing my game just on desktop, do i need to put on the server for the Stage3D to be activated ?

(Ultima2876) #55

Stage3D should work without issues on desktop, unless your GPU is unsupported (which is fairly unlikely but possible). Has anyone else had this issue?

Which GPU do you have?

(Mike Evmm) #56

Well, I dunno how @AbouElassad has his IDE set up, but running the swf directly (I.e., not through FD) doesn’t usually let me use S3D.
That reminds me, worst case scenario, provided you’re using FD, you could always automate testing, by automatically compiling and running an html file.

(Ultima2876) #57

Oh yeah! You’re absolutely right @miguelmurca; you need to run the game from FlashDevelop directly to be able to support S3D (or otherwise run it from a html page that specifies ‘direct’ render mode).

I’m slowly becoming useless at supporting Stage3DPunk as I haven’t worked on it seriously in some time, so I’m sorry to anyone I’ve been giving poor advice to recently.

(Zouhair Elamrani Abou Elassad) #58

Hey, sorry for the late reply, i’ve been working on my game like a monster :smile:, i have an NVIDIA graphic card, the things is thatwhen i run the game in the FlashViewer Default mode in FD i get a white screen, once i change it to Open in Popup i get the Flashpunk mode, even through FD, i haven’t tested in a browser, i’ll do that in i’ll get back to you guys.

(John Andersson) #59

Hmmm… After taking a bit of a break from programming in general, I restarted on a new game. I am using no hand drawn graphics what so ever, except for the backdrop of the game. The normal graphics are created with the Draw functions.

As soon as I added stage3dpunk to the game, the graphics “froze”. So I disabled enablelazyvertexupdates, and now the backdrop works. But the Draw’n graphics aren’t visible! What is up with that?

(Ultima2876) #60

Stage3DPunk doesn’t support Draw at all; at least not officially (this is due to the difficulty in implementing it with the way Stage3DPunk and Stage3D work internally). I believe there may have been some experimental support for Draw->bitmap, but that’s slower than using regular old CPU rendering unless you’re clever about precaching and storing your sprites.

(bldd) #61

Hi, I was searching for this library but I can’t find the link, ¿Can someone pass me the link of the library? PD: My english is pretty basic :slight_smile:.