First i wanted to say hi since this is my first post.
I already read a lot on this forum and it's a great place! Lots of useful hints here.
My problem is the following:
I want to create a board game for android similar to checkers.
I've already implemented the engine and some basic BoardView class.
I encountered a problem with the invalidate() function and searched the web a whole day for help. It doesnt update when the player has moved a piece but waits for the engine to make a move first.
I found some tutorials explaining a standard game loop like this one: http://blorb.tumblr.com/post/236799414/ ... -game-loop
I wonder if that approach makes sense for a turn based board game. Since the polling of the "worker" thread consumes cpu and battery power and isnt needed with my understanding. Also i implemented my game with a simple View not SurfaceView since i thought it would fit all my needs.
So isnt it possible to design a simple app like this:
- a view for the board
- an engine which handles moves
- no extra thread which polls all the time (or periodically)
The Boardview should just do this:
- when an onTouchEvent occures it moves the piece and redraws the board
- then it commands the engine to calculate a move, processes it and redraws
Sorry for this long text.. but i would appreciate your help very much. If you have any tutorials that handle a turn based game without constant polling or have any other advice on the design of the app pls write!