Snake game (for Android phones)

Discussions related to graphics (2D and 3D), animation and games programming
David Williams
Posts: 68
Joined: Wed 04 Jul 2018, 16:23

Re: Snake game (for Android phones)

Post by David Williams » Sat 01 Sep 2018, 13:04

RNBW wrote:
Sat 01 Sep 2018, 11:06
I looked in the source folder and extracted the files from there. Should have done that in the first place. I'm useless at the game, but tried it for some time on my Samsung Galaxy Tab S2 9.7 tablet without any problems.
Thanks for testing, I appreciate it.

---

EDIT: Sorry for the confusion caused when I gave the link to the Zip file containing the EXE, but not mentioning that the Zip also includes the source code. If it makes it easier for anyone else, the two source files (a .BBC and .DAT file) can be downloaded directly from these two links:

http://www.proggies.uk/temp/RainbowSnake.bbc
http://www.proggies.uk/temp/RainbowSnakeData.DAT
Last edited by David Williams on Sat 01 Sep 2018, 14:52, edited 1 time in total.

David Williams
Posts: 68
Joined: Wed 04 Jul 2018, 16:23

Re: Snake game (for Android phones)

Post by David Williams » Sat 01 Sep 2018, 14:51

I've tested the game on three Android phones: 2x Moto G4 Plus, and a Moto G5S. The responsiveness issue is noticeably more severe with the G4+ than the G5S, but I'm not sure why. Running Richard's timing test (timing.bbc) on both phones suggests that the G4+ actually runs BBC Basic programs slightly faster than the G5S, so I don't think it's a phone speed-related issue (they're not particularly slow phones!).

BBCSDL's MOUSE statement relies on SDL_GetMouseState which appears (unless I'm mistaken) to always return correct mouse button state, but on my phones it doesn't always return updated mouse/touchscreen coordinates, which leads to the issue I've stated. SDL_GetMouseState in turn relies on Android to give it accurate, up-to-date information with regards the mouse state. I don't know what the root cause is (I know it's nothing to do with BBCSDL, and I've never suggested it has).

David.
--

svein
Posts: 26
Joined: Tue 03 Apr 2018, 19:34

Re: Snake game (for Android phones)

Post by svein » Sat 01 Sep 2018, 18:21

The issue seems to occur when one touches both circles simultaneously.
It is enough to barely touch the screen, the phone reacts even if i dont feel the finger touching the screen surface.
If one could somehow detect the level of finger pressure and select the one with hardest pressure ??
Easily improved my hi-score by making sure the inactive finger was lifted well clear of screen surface.
Tested on Samsung S8.

Svein

David Williams
Posts: 68
Joined: Wed 04 Jul 2018, 16:23

Re: Snake game (for Android phones)

Post by David Williams » Sun 02 Sep 2018, 08:18

svein wrote:
Sat 01 Sep 2018, 18:21
The issue seems to occur when one touches both circles simultaneously.
I've been especially careful not to do that, but for me the issue occurs regardless.
It is enough to barely touch the screen, the phone reacts even if i dont feel the finger touching the screen surface.
If one could somehow detect the level of finger pressure and select the one with hardest pressure ??
Easily improved my hi-score by making sure the inactive finger was lifted well clear of screen surface.
Tested on Samsung S8.
Thanks for testing the program on your phone, it's much appreciated.

One possible solution (apart from buy a new phone!) is to change the snake control system to either a large, single rotating wheel (probably a bit clumsy), or just drag the snake around by its head. I'll probably try the latter idea in the next few days.


David.
--

kendallcp
Posts: 3
Joined: Fri 13 Apr 2018, 14:37

Re: Snake game (for Android phones)

Post by kendallcp » Sun 02 Sep 2018, 10:43

I've tried it on 0.23c using my 'Gemini' PDA. I can't make it fail in any kind of intermittent way. Could wish for the game board to autosize when I rotate to portrait but that could easily be a Gemini issue, not to do with the game. Haven't quite pinned down the underlying behaviour when you touch both buttons, perhaps it's right button dominant (i.e. holding right and tapping left no effect, holding left and tapping right causes direction change, I think...), but I've not made it fall over by 'randomly' jabbing and holding buttons. The game itself is way too hard for me, wish the board was way larger!

kendallcp
Posts: 3
Joined: Fri 13 Apr 2018, 14:37

Re: Snake game (for Android phones)

Post by kendallcp » Sun 02 Sep 2018, 10:49

By the way, how do you exit? The Esc key seems to be disabled. I had to kill BBCbasic to stop Snakes from running automatically when I tap the BBCbasic icon.

David Williams
Posts: 68
Joined: Wed 04 Jul 2018, 16:23

Re: Snake game (for Android phones)

Post by David Williams » Sun 02 Sep 2018, 14:22

kendallcp wrote:
Sun 02 Sep 2018, 10:43
I've tried it on 0.23c using my 'Gemini' PDA. I can't make it fail in any kind of intermittent way.
Thanks for testing the game on your device.

Could wish for the game board to autosize when I rotate to portrait but that could easily be a Gemini issue, not to do with the game.
No, I think it's an issue with the program as it currently stands. I don't know how to programmatically (within BBCSDL) prevent autorotation from the intended portrait mode to landscape other than through the (currently non-existent) Android app manifest. If/when I submit the game to Google's Play Store, I will specify a portrait-only orientation in the manifest, although I realise, ideally, there should be provision within the program to accommodate landscape mode. Most Android games, I find, allow for either one or the other - not both.
The game itself is way too hard for me, wish the board was way larger!
Funnily enough I'm not very good at it myself :)

By the way, how do you exit? The Esc key seems to be disabled. I had to kill BBCbasic to stop Snakes from running automatically when I tap the BBCbasic icon.
I intended the app to be packaged up into a standalone Android APK app, and requiring the user to close the app in the usual way by pressing the standard Android on-screen square button to bring up the currently running apps which can then be closed pressing the 'X' on the app windows' title bars. However, I admit this isn't convenient when running the program from the BBCSDL ToucheIDE, so I will modify the code to not disable the Escape button under those circumstances.

Thanks again for the feedback.


David.
--

DDRM
Administrator
Posts: 126
Joined: Mon 02 Apr 2018, 18:04

Re: Snake game (for Android phones)

Post by DDRM » Tue 04 Sep 2018, 13:58

As a general service if anyone else wants to know, the solution to the inadvertant zoom is to include
*SYS 4
Which means the operating system will pass you multi-digit commands like pan and zoom, which you can then ignore! This is covered briefly on the "differences between BB4W and BBCSDL" page, linked to on the posting I've just put up.

David, have you seen the post on the groups.io forum where they said they could reproduce the loss of control by pressing both at once? Maybe that is ALSO related to multifinger touch issues?

Best wishes,

D

David Williams
Posts: 68
Joined: Wed 04 Jul 2018, 16:23

Re: Snake game (for Android phones)

Post by David Williams » Tue 04 Sep 2018, 16:53

DDRM wrote:
Tue 04 Sep 2018, 13:58
David, have you seen the post on the groups.io forum where they said they could reproduce the loss of control by pressing both at once? Maybe that is ALSO related to multifinger touch issues?
Yes, I've been following the thread with interest. The intermittent responsiveness issue occurs for me (on the Moto G4+ and less so on the Moto G5S) even when I make what I believe are distinct, single presses/taps, being careful to lift the finger currently pressing one on-screen button before pressing the other button with the other finger. Judging by the feedback given so far, the issue seems mostly confined to the Moto G series of smartphones.


David.
--

Post Reply