Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing an Android game, and I'm making it so that it can run on low end devices without GPU, so I'm using the 2D API. I have so far tried to use Android's mechanisms such as layouts and activities where possible, but I'm beginning to wonder if it's not easier to just create a single custom view (or one per activity) and do all the work there.

Here's an example of how I currently do things: I'm using a layout to display the game's background as an image view and the square game area, which is a custom view, centered in the middle.

What would you say? Should I continue to use layouts where possible or is it more common/reasonable to just use a large custom view? I'm thinking that this would probably also make it easier to port my code to other platforms.

share|improve this question

2 Answers 2

It depends on your game. It's probably okay to use several views for more passive games like minesweeper or sudoku, but not for a shoot 'em up or a platformer. If your current setup is working fine and you find it easier to code using views then you might as well continue doing things that way. It doesn't really matters as long as you're satisfied with the result.

If porting is an issue then you want to use abstractions for the platform-specific stuff regardless of your implementation. But I think that you're right about it being easier with using a custom view, mainly because you wouldn't worry about parsing the layout XML files on the new platform (unless you define the layout in code).

share|improve this answer

I have also developed a casual game for Android version 1.6. As you have done, i have also used a imageview as the background, added custom views to accomodate my gameplay area.

This is working very fine for my game. Because, first thing, the views are not complex, second thing, the responsiveness is good, and third, the game flow is also maintained efficiently.

But this is okay for a casual games like board games, games where only 2/3 activities are used (my game uses only 2 activities, with complete game life cycle) or simple puzzle games.

So depending on the complexity of the project the views must be defined. It is better to keep the flow simple and responsive.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.