SyntaxBomb - Indie Coders

Languages & Coding => AGK => Topic started by: Pfaber11 on September 22, 2019, 09:28:09 AM

Title: apk problem
Post by: Pfaber11 on September 22, 2019, 09:28:09 AM
Just launched my latest game for android on itch.io and although it downloads when I try and install it it gets to about 80 % then says install failed . was thinking it may be due to the size of the file 114 mb  . https://pfaber11.itch.io/the-awesome-maze-game-2-android-edition (https://pfaber11.itch.io/the-awesome-maze-game-2-android-edition)
If that is the case what can I do about it . Thanks

It's ok fixed it and it was user error . I was trying to use a png file for the app icon .
Title: Re: apk problem
Post by: iWasAdam on September 22, 2019, 02:47:59 PM
out of interest 114mb seems like a lot of very large data. I would have thought you should have a max of around 20mb for something like this?
Title: Re: apk problem
Post by: Pfaber11 on September 23, 2019, 05:43:03 PM
yes so would I for some reason the mazes took up 12 mb for the new ones an only half a meg or something for the recycled ones . Been working on this all day and eventually got it all working right . A little bigger than really needed I suppose . I'm done with mazes for now gonna try something else next .
By the way you do need a png file for the icon on the phone but I was using too big of one , settled for 256X256 in the end . I am now charging for all my games to see if I can earn a buck and if I do I'll let you know how I get on . Not expecting anything great but who knows . Maybe my next game will be a cash cow , I doubt it but you never know.
Title: Re: apk problem
Post by: Pfaber11 on September 24, 2019, 07:36:57 AM
Another problem I encountered was that I kept going through the walls of the maze on android but when the exact same program was run on the pc it was faultless . I tried every thing I could think of for more than a day to fix this . It was happening when I went into a wall then moved rapidly from left to right and forward at the same time . very annoying . I eventually got round this by making it so if left or right was pressed at the same time as move forward the object would not move at all. This worked fine and once you get used to it it was pretty much ok . Gonna start a new project after a small break .
   Happy coding . May the force be with you.
Title: Re: apk problem
Post by: Derron on September 24, 2019, 10:05:54 AM
This sounds as if:
- your logic is faulty
- or you trust in collision detection and the android device runs less often so you have a check before the wall and the next is already on a valid coordinate again (the famous "bullet + thin wall" problem)

I think in a maze game you can skip collision checks and use simple tile based checks - so a faulty logic for now ;)

also 100mb for (such) a maze game is too much in my opinion ... except you have a lot of big textures (for whatever reason). If I see such a game and it requires 100mb (btw: google play allowed 50mb once... as maximum) then I would ask the question what else is hidden in the application.
Instead of going on with the next game I would try to find out why the game became so big (music? gfx? duplicate data? debug builds?). a 12MB 3D model might mean you include the textures in the file - maybe some unused textures? If it was only a 12 MB "data" model (so only the vertices etc) then you might be way too high poly. Also such model stuff should compress well (an APK is compressed already).


bye
Ron
Title: Re: apk problem
Post by: iWasAdam on September 24, 2019, 10:20:27 AM
ok, if we take the base maze as a grid - what grid size are you using?
assuming 1 byte for each grid and 32x32 for a level you would get 1k per level
64x64 = 4k
and 128x128 = 16k

generally 32x32 for a maze based level is a good size - more than that and the level just becomes a lot of corridors with no differences.

texturing could be a single texture or multiple textures - lets give (say) 128k-256k per texture

3d models (which should be lowish vertex resolution) should not be too high - lets give a max of 32k per model, with most around 2-4k

lets have 32 different 3d models.

So in total you should have a data size (without audio/music) of:
32 3d models x 32k = 1mb
12 levels at 32x32 = 1k x 12 = 12k
textures 12 x 128k = 1.5mb

which sort of gives (lets round up): 3mb
add 1mb for general graphics data - UI, etc
add 10mb for audio/music

Grand total is.... TADA: 24MB


So there you have it. if your install size is larger than 24mb - you need to look at where and what is eating the data and possibly rethink things.

Just because we have multi-gig machines, that is no reason for being sloppy - it wont make you a better programmer, just learn poor ways of doing things.
Title: Re: apk problem
Post by: Derron on September 24, 2019, 10:38:40 AM
Regarding grids: Maybe the mazes are pregenerated 3D models ... so not constructed "live" but reusing existing blocks or even complete maps. This would explain a bigger asset size than really needed.

In "Maze Raider" (biggest is the runtime there I think) I used individual 3d models for "sides", "corners", "T-shapes", "+shapes" ... and then generate the level grid cell by grid cell. Afterwards according to what kind of wall is needed there I place the according 3d model at the position in the 3d level corresponding to the 2d labyrinth/maze I generated (in my case it was a pac-man-"maze").


@24MB
you are talking about _uncompressed 24MB. 3D models could compress a bit here and there. So even more space for more textures/models.


As said: use the "done game" to improve it regarding on how you organize your assets, improve on how to store your stuff more efficiently. Of course you should not overcomplicate (create models and textures procedurally or so) but at least try to improve your coding / project management skills.


bye
Ron
Title: Re: apk problem
Post by: Steve Elliott on September 24, 2019, 10:42:40 AM
114Mb for an Android app is very large, you need to address this problem to stand any chance of being successful.  A quick search for average app size on on Android gives this article and a figure of 15Mb.

https://sweetpricing.com/blog/2017/02/average-app-file-size/
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 06:36:54 AM
The reason it's so huge is down to the mazes . For some reason they are taking up 12 mb  . I have redone a blank maze just to try and see what the result is and the new ones are using 4mb still high but heading in the right direction. I might try and redo them . on my original maze game they were averaging about 256k . the mazes are 2048x2048 in size so quite large . I think I should redo one maze a day until the job is done as my punishment for sloppy programming . I started off when I was 15 with a zx81 when 1k was 1k . In those days efficient programming was very important . Today we are spoilt rotten with mounds of memory to play with but yes no excuse for the sloppy programming.
Anyway if I go with the 4mb mazes it will shave 48mb off the total . so nearly half what it was . Might be something to do with mtpaint but I like the simplicity of the program. Thanks for the input.

Bonjour
Title: Re: apk problem
Post by: Derron on September 25, 2019, 07:17:46 AM
What is a "blank maze" ... what does it contain, which format is it? If it is blank vertices it won't be 4MB except it contains some very verbose extra data.


bye
Ron
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 08:32:56 AM
I will try and show you what I call a blank maze .
This is a blank maze and the other one is a maze completed. As you can see the bottom one is the same size but uses much less memory . not sure why. Anyway I just draw on the blank whatever I like then tramsform it into a height map and there's my maze . I put  a texture on the maze also to enhance it .
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 08:53:01 AM
Never seen any mazes done like this but I should imagine it's been done many times before. I set the height of the height map to 2000 or so and the height of the camera to 500 . And there it is very simple but effective . I  set my computer to show x and z coordinates so I can place the orbs and food in the maze . My latest maze game has 12 levels of play opposed to the original game with only 6  plus added food and ghosts . I have plans to make it even better but I'll do that in the near future . was thinking when a ghost touches you everything goes into slow motion for 10 seconds . At the moment the ghosts are passive and just look good . When I create the height map from the 2d png file I make it 20480 x 2000 x 20480 so they are quite large . Takes a few seconds to load in fact about 15 on my phone and 40 seconds on my laptop .  It's a slow laptop.
Title: Re: apk problem
Post by: iWasAdam on September 25, 2019, 08:56:20 AM
OK. In essence you map is a 17x17 grid:
(https://vjointeractive.files.wordpress.com/2019/09/screenshot-2019-09-25-at-08.48.56.png)

which at 1byte per grid position (array of bytes) would be 289bytes. you would have an array so that you can do proper clip/collision checking, movement etc.

Probably the best suggestion I could give you is to dump the 3d, and focus on a very simple 2d topdown maze using a simple array ( array[x,y] ) with 0 being the floor and 1 being a wall.
your man starts at a random position where the array[x,y] = 0

Build a small program to enable you to move the man around on the floor and not bumping into the walls.

Next step would be to add an exit and a time to get to the exit.

After that use the code you wrote for moving the man and adapt it so that it uses randoms to move your man - you now have the basics of an enemy :)

Start simple. then work your way up.  ;D
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 09:21:40 AM
That's interesting Adam but not giving up on 3d I'm hooked on it . If you played my maze game 2 with ghosts and food I think you might think the result is quite good . If any members of SyntaxBomb  ever want to see any of my games just let me know and I'll get you a key to get a free download . The 17 x 17 grid is a good idea though never thought of that. The 3d thing is awesome to use and really is no more difficult than 2d . just different . This is a screen shot of my game to give you an idea of what I'm doing and they are getting better all the time .
Title: Re: apk problem
Post by: Derron on September 25, 2019, 10:49:29 AM
So you have drawn bitmaps (with jerky lines) in 2048x2048 and use that as heightmap to alter the position of vertices??
Does that mean you have thousand of vertices (so you have one "next to your lines")??

As told: create ground tiles, create wall tiles - and position according to the maze layout. This allows for multiple things:
- themes (other tiles for a theme) for the same maze layout
- animated mazes without much effort (sliding doors)
- dynamically create mazes
- mazes which occupy way way less disk space


as said I took that route with Maze Raider.


So if I misunderstood how you create a maze: what is the data format of a "map level/layout"?


bye
Ron
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 11:55:36 AM
 The lines are jerky but I think that adds to the aesthetics . I really like them . Basically what I do is draw a 2d maze with mtpaint 2048x2048 then create a height map 20480x2000x20480 . I intend to take a look at your maze Ron and see what I think. I can knock up a new maze in less than 20 minutes using this method . I know it's unconventional but it works and I actually enjoy playing the game . Sliding doors would be good though. I don't intend to be making any new maze games right now but I will take onboard what you guys are saying . you know I think I could put in sliding doors quite easily come to think of it by creating a door model and placing it in the appropriate place then sliding it to the side . Hmm food for thought . Would probably be a bit of trial and error placing it in the right spot or I could put it into the maze then manoeuvre it into position.
Title: Re: apk problem
Post by: iWasAdam on September 25, 2019, 12:03:32 PM
I'm not going to say any more, but I will post some images that should give you food for thought about presentation and also about how to do something 'right' by using a grid.
So going from early to newest we have:
(https://4.bp.blogspot.com/-ggvZIyISfFU/WKc4n2U2xrI/AAAAAAAAIpQ/9mgdSkvyNyMrtDxwe7s5SpaqztMipiLMQCLcB/s1600/Videojuego%2BMaze%2BWar.jpg)
(https://lurkmore.so/images/thumb/9/94/3D_Monster_Maze.jpg/239px-3D_Monster_Maze.jpg)
(https://sujoygroy.files.wordpress.com/2014/09/maze-war-3.png)
(https://www.abandonwaredos.com/public/aban_img_screens/terminatorrampage-3.jpg)
(https://mobimg.b-cdn.net/androidgame_img/maze_dungeon_by_uajoytech/thumbs/maze_dungeon_by_uajoytech.jpg)

Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 12:48:07 PM
The second one down looks like 3d monster maze on the zx81 which was the first program I ever purchased . My first computer too. I worked in my summer holidays when I was at school and by chance I saw a picture of the zx81 in a magazine and went out found a computer shop and bought one followed a few weeks later by a 16k ram pack. loved that computer . I was the first person I knew to own a computer . When I got it home I thought I better be careful not to use up all the 1 k of memory . I didn't realize when you pulled the plug it reset and you got the 1 k back again. Green or what. soon caught on though . The BBC computers and vic 20 were also out at the same time but were out of my league financially . Happy coding
Title: Re: apk problem
Post by: TomToad on September 25, 2019, 12:50:03 PM
Exact same images saved in black and white.  Sizes are 6K and 3K.  Total storage savings are 4122 K.
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 12:55:30 PM
Tom will they still create a height map being black and white ? I will try one later . You know personally I think computers have such vast memory these days it hardly matters . in fact someone downloading my game will probably think it's even better being a bigger file . Gonna try the black and white thing now. Be back when I'm done .
Tom Toad your assistance is required . The black and white mazes work exactly the same . could you please tell me how you turned  my maze black and white.
Title: Re: apk problem
Post by: Steve Elliott on September 25, 2019, 01:08:27 PM
Quote
I think computers have such vast memory these days it hardly matters .

It *does* matter, especially for mobile devices.  Personally I think this is a terrible attitude to have - especially for an ex ZX81 owner lol.  Guy's with 3D experience are trying to help you, so let them.
Title: Re: apk problem
Post by: Derron on September 25, 2019, 01:26:55 PM
The black and white mazes work exactly the same . could you please tell me how you turned  my maze black and white.

Open in image editor of choice and save as 2bit image - or reduce image depth first.


@ jittery lines
Just use a grid with tinier grid cells. Still the idea is to "abstract" it. Think of it as if you draw the maze at 512x512 and scale it up to 2048x2048 - elements will be "blockier" but this is what happens in mazes: there are straight walls, not curvy ones (except "faked" ones with decorations etc).


@ 20 minutes
I click on "generate" and have a maze. If I like the maze I store the seed for the initial random number. Want to play the same maze again? Use the same starting random number seed.


I (and others here) are not telling you how to do stuff - we write how we did or would tackle such stuff. We do this to help you improve. And seeing how you did your maze game ... it is an non-conventional way of doing. Means you can think outside the box. This is good. But sometimes it is better to use "proven" mechanics. Especially if it is such hmm "basic" stuff.
Heck, even if you follow the basic approaches of others there is plenty of room for your own ideas, tries to improve stuff (I do too - and often am finding out that the old solutions are still superior - generations of developers evolved the approaches already).


bye
Ron
Title: Re: apk problem
Post by: iWasAdam on September 25, 2019, 02:27:51 PM
OK. Let's look at this from a different perspective: 3D

First:
(https://vjointeractive.files.wordpress.com/2019/09/screenshot-2019-09-25-at-14.03.49-1.png)
The magenta lines are what I've drown on top to show how things are done.

It's a 4x5grid with each grid position referencing 6 3d objects (total size for each model is 6k). Total texture size (for everything) is 20k.
What is more interesting is the grid positions are not floor/wall, but also reference height.
At any grid position I can check the part to be rendered and the height. so no collision code, etc.

OK. now for a different view:
(https://vjointeractive.files.wordpress.com/2019/09/screenshot-2019-09-25-at-14.06.28-2.png)
This is a debug/working view for checking and getting everything right before adding other stuff.

The first thing to note is there are 2 views:
1. a fps view showing the 3d model
2. the underlying 2d grid outlined in red

the green square is you and the yellow line is the direction you are facing
I have outlined the 3d object in magenta on the 2d map so you can see how it is referenced.

In this case the 3d model occupies a 10x10grid (shown)

In both cases the actual 'game' is actually 2d. the 3d is just the icing and only serves as display output. I could just as simply not show it, or use the 2d grid for the game. But you my possibly get the concepts and thoughts behind things?

As was said. There is no right or wrong way. But to ignore or dismiss simpler and easier ways of doing things is not going to help in the long run.

KISS - Keep it simple stupid (from my design days)!

In the above examples you would need some very funky (read complex and nasty) code to deal with collisions in 3d. The more you need to check the slower your game and the more work you need to do to maintain things.

a 2d underlying grid array is simple to check and very simple to write and code - you may have to think a bit to get into the headspace. BUT... The only difference from this, pac man, Doom, even space invaders to an extent is they are all 2d based with some form of grid (screen positions count as a grid). Heck even Mario is just a grid. the only thing different is how the user moves and sees the result.
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 04:29:54 PM
This is all very interesting and I will try some of this stuff out in my next project. By the way I've got my apk file down to 18.7 mb from over a hundred will be uploading it onto itch.io later today. Tom toad the black and white approach worked very well and now my mazes are typically 20kb . down from 12mb each it's a lot better . I don't know why they were 12 mb in the first place but there you have it. I think i'm gonna try and pick up a zx81 if I can find one cheap . just so I can say that's what I started on .
Title: Re: apk problem
Post by: Steve Elliott on September 25, 2019, 04:34:58 PM
Quote
By the way I've got my apk file down to 18.7 mb from over a hundred will be uploading it onto itch.io later today. Tom toad the black and white approach worked very well and now my mazes are typically 20kb . down from 12mb each it's a lot better .

Great news!  Well done Tom Toad.   :D
Title: Re: apk problem
Post by: Derron on September 25, 2019, 06:14:06 PM
Once we prised out of him how he creates the maze It was just up to TomToad to suggest the bw-part. Good find.


@ 12 MB
What imageformat are you using? An APK should automatically compress bitmaps (or files in general). So if it was BMP it compresses well but original file size ("extracted") will be big.
Maybe you store stuff in a 32bit color depth and have a bit noise in your image?
Or you have "layers" and draw over it (tiff?).


Glad you cut it down now - means our blaming and posting here somehow lead to an improved version - and we were able to give you some new thoughts to tinker with.


bye
Ron
Title: Re: apk problem
Post by: Steve Elliott on September 25, 2019, 06:18:23 PM
Quote
Once we prised out of him how he creates the maze It was just up to TomToad to suggest the bw-part. Good find.

lol true.  If you don't have an efficient solution, then ask the guys here.
Title: Re: apk problem
Post by: Pfaber11 on September 25, 2019, 10:10:12 PM
Well I've finished the improvements the pc version is down to about 16mb and when zipped up is 7 mb  . The apk file for android
 is about 18 although when installed uses about 35mb . A huge improvement. uploaded both to itch.io then downloaded and tested them to make sure they work ok . They are free tonight on itch.io  so if anybody is curious as to what I have made feel free tohttps://itch.io/search?q=pfaber11
   (https://itch.io/search?q=pfaber11) take a look .
Title: Re: apk problem
Post by: Pfaber11 on September 26, 2019, 10:39:21 AM
Well I'm having another flash sale until midnight tonight just to get the ball rolling 100% off . It maybe I look at things a bit differently to you guys . Gonna do some study over the next couple of weeks and see if I can see exactly what you mean . All I know really is about height maps and models . Still obviously plenty to learn . It seems the further down the rabbit hole I get the more there is to Know . Anyway thanks once more for all your input gonna take a look on you tube to see what information I can find. The link to the 100% off sale is in my previous post . Happy coding .
Title: Re: apk problem
Post by: iWasAdam on September 26, 2019, 11:06:23 AM
mmmm. I've kept quiet on the 100% 'Golf Sale' mentality, but I do have something to say that might give you some thoughts.

'Golf Sales' are generally a terrible concept, in the respect that most sales are just the 'real value' dropped from an inflated one - it's not really good business or practice. But... There is something a bit more fundamental:

Something discounted is always great for getting headlines and eyeballs. But once downloaded and checked out the quality of the product (your game in this case) is what will be left. Ask yourself "Is this a good product and would someone who downloaded it think it was good or bad?" You have to be brutal with that one...

Is your aim to get downloads - at what cost to your reputation?
If 1 person likes your game they will tell 1 other person.
If 1 person doesn't like your game (for whatever reason) they will shout a bit and tell 10 people.

You real aim should be to learn and grow and potentially profit (at some stage) for doing something that people like. In the early stages you will have lots of projects that are not brilliant (we all have them stored away ;) ). You should make sure that people tell other peole what they liked and not what the didn't like.

In the previous posts showing a number of different maze related fps games - how does your games measure against those (be brutal on this)? With google you now have the ability to see what is a good game, how it looks and how it is presented - try to aim for the same style/thing they do. if you have hugely multicolored stuff - ask yourself why?, could it be better presented? etc, etc

Keep up the good work, but look, absorb, learn and think :)
Title: Re: apk problem
Post by: Pfaber11 on September 26, 2019, 11:37:18 AM
You know I agree with you in that 100% off sales are not the way to go  . I do actually like my maze games though. The first few games I did were rubbish though and must agree there . I will probably take them down sooner or later although somebody bought wingfighterz and cannot remove it from itch.io because they say it is owned . Takes a fair while to get good at this programming business. 16 months I've been at this now with AGK Classic . If I can keep learning I'm guessing in another 12 months  I will feel competent . will know a bit by then . It's a shame they don't do a coarse in mastering AGK Classic but there you go. I've never read any books on AGK and really don't know how I've got this far , but am very pleased with my progress. yes I have written the odd program in the past but that was 30 years ago or so and nothing like I'm doing now.
     Up until last Christmas I knew nothing about 3d programming so haven't been at this very long . The fact I have produced anything up to this point is a miracle for me . Really got to get this sorted though and then maybe when I have I will reinvent my self with a new website and highly polished apps on it with no rubbish and that site will be my business card . Really hope they don't pull the plug on AGK anytime soon and change the goal posts as I really like this language .
SimplePortal 2.3.6 © 2008-2014, SimplePortal