transparency problem

Started by haijin, May 30, 2011, 02:18:46 PM

Previous topic - Next topic

haijin

Hi,

I'm getting a transparency issue where objects calling setTransparency() have a strange see-through effect (see current beta of Run! on the Android Market) against each other. This effect can be seen when a road path is under a tree top (both objects using transparency).
Am I using it wrong?

cheers

EgonOlsen

Most likely a sorting issue. Transparent objects need to be rendered in the correct order to be displayed correctly. This sorting is per object and it can't be correct in all cases. If, like in your case, some objects like the roads are always behind all other transparent objects, you can tweak this sorting by applying an offset. The method in Object3D is called setSortOffset or similar.

haijin

Ok, fiddling with setSortOffset() seems to do the trick (not completely sure because the issue wouldn't always show up, but the tests look alright). thanks!

haijin

turns out me playing with the setsortoffset didn't fix the transparency problem :S
the ground layer is added first to the world, then the trees... in any case, the issue shows up randomly...
any hints/details on how that method actually works (values I should set)?
in my last attempt, I set -2000 (negative values getting closer to the camera) for the trees and 0 for the ground layer
I'm ready for a new release with a few nice details and fixes, but would like to include this... and, while I thought of having opaque leaves, I would still have the same problem with future features.
on a side note, I'm using png's with alpha channel...

EgonOlsen

Try to leave the trees alone and offset the ground only by 100.000 or something.

haijin

done, haven't seen the issue again so far so... new release out!

EgonOlsen

This version somehow hangs after dying....the only way to exit it, is to kill it.

haijin

I wasn't dealing very well with the screen capture process... should be better now (new release published)

EgonOlsen

Works fine now. What this game really needs is a mini-map IMHO. I usually have no Client where i am and where i'm supposed to go....

haijin

I thought of it at an early stage of development (adding an arrow for direction) but ditched the idea because this way, having to search around and finding the spot while avoiding the monsters is part of the challenge... it would be too straightforward and easy otherwise. Does this 'lost' factor make it dull, tedious or boring?
if it is, I might think of something less obvious and for the easier difficulty levels...

EgonOlsen

It makes me feel "lost". I've no idea if i'm on the right track or not because there's no feedback and finally, i get caught by the zombies while stumbling around. The main character says stuff like "she's in the cottage" or "maybe in the car" or something like that...so i expect him to have at least a vague idea where these places are. The game should reflect this somehow....

haijin

ok, I have made a quick release including directions (N, SE, W, etc.), a bit vague but should be a good balance between lost and too easy search...
and I think I am done with the main development. Unless there are bugs reported or other suggestions I will now focus on adding levels for a full release!

EgonOlsen

Yes, that's better. I was able to complete the first level...but then, i got this:


06-08 00:35:37.808: ERROR/AndroidRuntime(21203): java.lang.NullPointerException
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.loxai.run.RunActivity.onTouch(RunActivity.java:416)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.View.dispatchTouchEvent(View.java:3881)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.os.Looper.loop(Looper.java:130)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at android.app.ActivityThread.main(ActivityThread.java:3683)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at java.lang.reflect.Method.invokeNative(Native Method)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at java.lang.reflect.Method.invoke(Method.java:507)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-08 00:35:37.808: ERROR/AndroidRuntime(21203):     at dalvik.system.NativeStart.main(Native Method)


haijin

thanks for the stack trace, should be fixed for next release (I don't want to update just for one bug, should get a few more ;)). In the meantime, it should work as long as you don't touch the screen between level success and next level loading (that's the only way I got it).