Question

I've been reading stuff about android game development and performance optimization. And i have two questions:

Supose i have a game, and in that game i use one thread for drawing stuff on a canvas. when I fire a bullet i want an explosion to happen at contact with another surface. will the game wait for the explosion to render and then continue to render the rest of the animations etc? or will it all happen at the same time?

The second question is about the garbage collector, and if anyone could give me some hints or post a link to something about it regardin games performance.

Thank you very much.

Was it helpful?

Solution

will the game wait for the explosion to render and then continue to render the rest of the animations etc?

Not unless you do something to specifically make the game wait for the events to execute in a certain order. If you have synchronized access to the canvas, then all that will be guaranteed is that the two threads will not draw on the canvas at the same time, but the order in which they draw, and when they draw, is not guaranteed.

or will it all happen at the same time?

The order in which the drawing will occur may be concurrent, so you could say it's happening in the same time. However, it's recommended that only one thread draws on the canvas.

If I were you I would try to get a decent 2D/3D game engine for android and worry about your game more than the multithreading and garbage collection behind it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top