Follow us on Twitter!
Imagination is more valuable than knowledge - Albert Einstein
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 21
Guests Online: 19
Members Online: 2

Registered Members: 82886
Newest Member: The Slummy
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 03-04-13 15:05
So I have been working on a casual game for my BS class. Were are currently just finishing up on loading the images, scaling, and moving the objects around. I have found some decent code snippets on the web about orientation change states. My issue is that I am trying to catch the thread and then close it when I try to back out or close via the home button. What happens is the game freezes then crashes, but if I hold the home button down to view paused apps, the game is there. When I choose it it runs fine. This happens when changing the orientation of the phone from portrait to landscape. I have a few ideas about onConfigurationChanged().

Has anyone else worked with android development and has any tips on avoid some pitfalls with activity-state-thread based programming?


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Android Game Development

Mordak
Evil Sorcerer



Posts: 571
Location: England
Joined: 01.01.70
Rank:
Elite
Posted on 03-04-13 21:28
I have done a lot with android development. But i don't quite understand what it is your asking. Sorry


http://developers.hellboundhackers.org
Author

RE: Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 03-04-13 21:59
Sorry, hopefully I can clear up my request:


1. I am having troubles catching my current game thread to properly close (save state). What happens, is the thread is caught but cannot exit without crashing. Does anyone have a working example on working with thread based activities?

2. The crashing isn't a full crash, it just freezes then barks out a message about "Unfortunately, Fire Catcher has stopped" (Fire Catcher is the name of our game). If hold down the home button to show saved activities states (Samsung Galaxy S III) the game is still open and saved at the the current state of which it stopped. When I reopen, it proceeds to continue as normal until I try to close it again. So is there a "neat" way of pausing apps that someone has that could help point out common pitfalls? There are so many examples but none in which are standard.

3. I am currently working on the orientation of the app so allow the game to switched from portrait to landscape. But I am contemplating on just making either portrait or landscape and not allow the user to switch between the layouts. I was reading up on onConfigurationChanged(), haven't read the whole document yet; work gets in the way Sad, so my question this override function would be can this work with surfaces instead of activities? My assumption would be yes in a round about way but not directly.

I hope this clears it up a little bit.


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Android Game Development

Mordak
Evil Sorcerer



Posts: 571
Location: England
Joined: 01.01.70
Rank:
Elite
Posted on 03-04-13 22:18
Just as a note. I have had a lot of problems with the S3 for a lot of simple tasks. I would suggest trying your app on a different device. If that doesn't work i will help more Smile


http://developers.hellboundhackers.org
Author

RE: Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 03-04-13 22:38
Good note to keep in mind,


Just got a book: Android 4 Games Development 2012, learning more in the first 3 chapters then from class.

Figured out how to do the threads, obviously pasting my code here would be just plain dumb I can explain the concept.


In the main activity I had to create a new Thread() in the onCreate() method. Then wrap this thread in a handler that would allow me to to switch between activities Wink . Was this was done I could now call the finish() method on the current activity. Now my app doesn't crash.

I also just change it to only render in landscape mode for now. Grin

I know the info above is a little truncated but the main issue has been resolved. The Handler was the key to stop the thread from crashing.


Android is fun, but I would love for the development of this class to be in Kivy or py4A Wink

Then I could just could in python, pygame, wrap it in either Kivy or py4A compile and call it a day.

But if I did that my professor would be like "What just happened?......I am confused".


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Update

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 05-04-13 22:13
Well starting chapter 5, the game shell code is going well. Adding a menu screen and some 8bit sound bytes for fun. Getting ready to start loading the main player and controllers and falling objects.


Using OpenGL(ES), the fps is smooth!


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 11-04-13 01:59
Hit a snag with Alphas and scaling textures. If anyone who has dealt with OpenGL and knows how to load proper alpha channeled textures, please do hesitate to post a help tip. Time to dig into OpenGL Docs..... fun.


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 15-04-13 17:58
Well, got my alpha textures and now working on load my sprite sheets. Seems to be working smooth now. Except for the random music thread loading upload even if the game is not even in a saved state. Odd.


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Android Game Development

dami3n
Member

Your avatar

Posts: 104
Location: Manchester
Joined: 28.06.05
Rank:
Apprentice
Warn Level: 5
Posted on 18-04-13 23:23
Mordak wrote:
Just as a note. I have had a lot of problems with the S3 for a lot of simple tasks. I would suggest trying your app on a different device. If that doesn't work i will help more Smile


Personally problems or not, you must get it to work on the S3. Recent sales will show that most android apps well mobile device ones not including tablet sales will be through the S3 yes there is the HTC phones but the majority will be the S3.

Don't forget the best part of being a programmer is solving those problems! Gotta love it.

As for the flipping of the phone whilst playing I cant say I have seen many apps do that well games. It would take up a lot of resources if the game was in the play.
soulboundsecurity.wordpress.com
Author

RE: Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 19-04-13 20:38
Valid point on the S3 sales. As far as the flipping on orientation, I am going to lock it down to just portrait. The reason is the game looks better on portrait then landscape. We now at the part where we have objects falling down. We are trying to get the clipping right for each object as there are some bleeding of characters from the sprite sheet. The game is coming along. The graphics are very plain but it's just a simple game and we are the only team in the course that is doing it in OpenGL ES. Hopefully we can get it done very soon.


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>
Author

RE: Android Game Development

elmiguel
Member



Posts: 161
Location: Your Computer
Joined: 12.12.07
Rank:
God
Posted on 10-05-13 03:14
Well finished my class, got an A but the app was a total fail. Going to revisit this app at a later time. I might try it without OpenGL ES next time and see if there is really a need for it. I can't seem to find any decent examples out there without any bugs! Everything is too specific in the examples to really get a broad scope on it. Well maybe next time.


The philosophy of one century is the common sense of the next. -Fortune Cookie

I would like to thank a few friends that I have made here that helped me and deserve to be mentioned:
System_Meltdown, Futility, nvrlivenvrdie, Mastergamer, TrueHacker, S1L3NTKn1GhT, Reelix, ynori7, Demons Halo, kryptor

www.hellboundhackers.org/sig/r/24963.png

www.hellboundhackers.org/sig/hbh2.png
<script>alert('XSS');</script>