jPCT-AE - a 3d engine for Android > Support

Scaling on different devices

(1/3) > >>

rushtone:
Hello everybody,

im new to jpct and also new in game developing as well.
but at least i have a very good java knowledge so i thought i give it a try with a 3d based game.
And actually its going on pretty well.

First off i wanna thank egon for this awesome library.

sorry for my bad english, its not my native language.

so lets go ahead to my questions.
1. is there an easy way to check if an object is visible by the camera?
or do i have to check that by my own?
for example with interact2d3d methods?

2. when i put my game to another device,
will the game look the same? or do i have to take care of scaling objects and camera positioning depending on aspect ratio and so on?

sorry if these questions are kind of dumb in a way.
i would test it, but i do not own a second android device.. :/

oh and once in a while (about each minute) my game is a little bit sluggish.. it seems to freez for a few ms..
i use pools for nearly everything to avoid garbage collection.
is this freezing normal in games? or can i get rid of it?
actualy the only points where the object allocation tracker notifies of allocations is inside the collision checks in the jpct lib.
maybe its my gameloop. i dont know. maybe someone can give me some advices.

thank you guys really much.

EgonOlsen:

* One question is: Why would you want to? And another question is: What does "visible" actually mean? That it lies in the view frustum? That it's not hidden behind other objects?
* jPCT-AE will adjust the vertical FOV to maintain the horizontal FOV. That means that the part of the world that you see from left to right doesn't change, but according to the aspect ratio of the screen, the visible range in vertical direction might change and that will have an influence on objects' size. However, displays don't differ that much that this will become an issue in most cases.
* You can get rid of it by using a later Android version is possible (everything 4+ has improved GC) or creating less objects. However, some objects have to be created and some creations can't be controlled by the app (like touch events). Collision detection has to create a small amount of objects in each iteration, but it usually isn't a problem. You can try the latest version (released today), which reduces object creation in collision detection in some cases. Maybe it helps. Also keep in mind that using enhanced for loops or auto-boxing/unboxing can create a lot of implicit objects, so try to avoid using them.

Bryce Thorup:
One way to test how the FOV changes is by allowing your app to rotate. Since the live wallpapers we have made required the possibility of landscape or portrait layout, I had to write code to handle what to  do in each instance, and also to read the screen dimensions to determine the aspect ratio. It took me a bit to get the hang of how FOV changes work, but it is manageable.

rushtone:
thank you very much for your detailed answer. :)
1. i want to check visibility of objects visible in the frustum. iam developing a 3d based 2d game.
when i fire a bullet i wanna detach it from world an recycle it in my pool as soon as it lefts the outer bounds of my scene.
right now i use max y and x values for this.
but because of the spheric view the x coords dont match the screen bounds on the max y coords. i hope you get what i mean..
the camera is not straight top down..
i possibly could use interact2d3d methods to get the world coords with 0/0 and viewport width/height to get the proper world coords to check against to determine if an object left the camera sight.. didnt tryed yet.

2. well that sounds good. sounds like its already what i wanted. that also means if i have build my game around an fixed x/y world point. this point will stay the same in any ratio?
for example if in my scene on my phone the max y value is 10 then it is on any other phone the same?

3. i think each min is not that bad.
is there no way to provide a pool or a parameter like gettranslation(simplevector) for the collisions?

i have about 50 primites moving as background objects.. maybe there is another way to simulate movement of a vehicle without creating primitives that move in a direction to simulate that..?
i will try the new released version.
i have android 4 on my phone so i dont think this is the issue.
and i only used normal for loops on android.
i thank you very much.
//edit:
another question which come to my mind is..
does world.getobjects() creates an new enumeration object each time called or is it cached somehow? than i do not need to use my own arraylist to cycle through all my objects. i could use that one.. but i didnt want to create new objects without need.

EgonOlsen:

* jPCT-AE has a method Object3D.wasVisible(). This was broken in former releases but should work again in the latest release. With that, you can determine if an object was visible in the last frame. IMHO, this should be sufficient in this case. You'll put your objects back into the pool with one frame delay, but that shouldn't matter.
* I'm not sure if i got the question...?
* I really don't think that it's worth it unless you are doing a lot of collision checks which actually indicates that your problem is somewhere else...50 objects to simulate a vehicle seem a bit too much for me. Why do you need so many of them?
* Yes, world.getObjects() creates a new enumeration each time.

Navigation

[0] Message Index

[#] Next page

Go to full version