danishcake / ShokoRocketAndroid

Android version of ShokoRocket
MIT License
5 stars 2 forks source link

Missing xhdpi and xxhdpi makes playing on modern phones almost impossible #20

Open danielmmmm opened 7 years ago

danielmmmm commented 7 years ago

Hei danishcake!

Are you still working on Shoko Rocket? It would be awesome if we could play this game on modern phones with high resolution displays. I wouldn't mind if everything was pixelated, but at least the controls and menu should be bigger, and the player field should filt the screen.

Is this difficult to achieve? Or is it just tedious work? If you can explain how to scale everything up, I would love to take over the tedious part!

Hilsen, Daniel

danishcake commented 7 years ago

So I actually got half way through implementing this years ago, but I've misplaced the code. I'll have a root through my archives to see if I can find what I was working on. The problem was that this code dates from when Android phones were slow and didn't have much hardware acceleration. To make things as fast as possible all the sprites were scaled ahead of time (see GameDrawer.java:Setup()). This meant that drawing bitmaps was a simple case of copying bytes.

Unfortunately early Android devices also enforced tiny managed heap sizes. 24, 16 or even 12 megabyte heaps were not unheard of. Pre-scaled sprites took up masses of memory and limited the range of devices ShokoRocket could run on.

Nowadays RAM is cheap and hardware is fast. The best solution is probably to

  1. Resample the SVG images at a decent (2x or 4x current) resolution)
  2. Update the animation xml files
  3. Load these directly and don't perform any scaling
  4. Perform all scaling at runtime in GameDrawer/Animation.java
danielmmmm commented 7 years ago

What you proposed seams reasonable ... for someone who can script a little, but not code :-)