v0.8.9 (Bugfixes + translations) released to Google Play!

Useful links
Source code of the game - Contribution guide - ATCS Editor - Translate the game on Weblate - Example walkthrough - Andor's Trail Directory - Join the Discord
Get the game (v0.8.9) from Google, F-Droid, our server, or itch.io

New to Development

Discussions of the development process of the game.
Raner
Posts: 26
Joined: Fri May 16, 2014 2:55 am
android_version: 4.0

Re: New to Development

Post by Raner »

I can't explain why, or what you did, but I did manage to get the map working.

If you go to map_plant_1, and look at the grass in the second row from the top, eighth tile from the left, you will notice that on your map, it is sometimes posted correctly, and sometimes rotated 180 degrees.

I took the original tile from map_plant_1 and pasted over the 'upside down' grass, and all errors vanished, I was able to walk around your map without trouble.

Since I did not have a brilliant solution, I just progressively deleted layers / tiles until the culprit was obvious. If this does not work for you... well I am sure one of the experts like Zukero will be around soon.

I had been pondering finding a way to rotate sprites myself... I wonder if there is a way to do it and not create errors?

-Raner

EDIT: how about I attach the fixed file - would that be a good idea? Maybe..... :oops:
You do not have the required permissions to view the files attached to this post.
Raner:
Lvl: 1__Exp: 1.7mm__Gold: 70k
HP: 44__AP: 5/10__AC: 127__AD: 10-21__BC: 49__DR: 3__ECC: n/a
Shadow Regeneration

RoLS: 2__RoL: 2__ElyR: 1__GoLF: 1

... no skills ...
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: New to Development

Post by Zukero »

Well done Raner. Using Tiled's tile rotation (or mirroring) feature could indeed break the game.
Tiled stores the layers as a series of 32 bits integers, each of them being the tile identifier. But, the first 3 bits (leftmost) are actually used to store rotation & mirroring data.
The game code does not take care of these 3 bits, and reads the whole 32 bits as a number, and then cannot find the tile associated with this identifier.
Trying in layman's terms : if you place tile #34 with a rotation in Tiled, it is saved as tile #1 000 034, then, the game fails to find tile #1 000 034, and crashes as it does not exist.
There is no code in the game to prevent such crashes, and I will not add any, as the data should be checked before release, and any code made to protect from such crashes would just be cpu cycles waste for the released versions.
Note for experts:
The actual array of integers is first base64-encoded, then gzipped, before being written in the .tmx file, thus the unreadable password-looking garbage you see when visualizing the .tmx files in a text/xml editor. Note that these encoding & compression methods are parameters in Tiled, and can be changed, but for AT, all maps are using this base64/gzip combo.
I may look into support for tile rotation & mirroring in the game.... later.

@Medullan: when you experience such a crash, the best way for us to identify the root cause is to provide the "stack trace" of the crash. In eclipse, it would be located in the "logcat" view, and would be the big part in red starting with something like

Code: Select all

FATAL EXCEPTION: main
Process: com.gpl.rpg.AndorsTrail, PID: 1742
java.lang.ArrayIndexOutOfBoundsException: length:1089; index:2215
at com.gpl.rpg.AndorsTrail.controller.PathFinder.findPathBetween(PathFinder.java.37)
Copy & paste this information (including all the subsequent lines that look like the last in my example) in spoiler tags in your posts. I will tell me exactly which part of the code crashed, and is often enough to find out the cause.
Last edited by Zukero on Fri Jun 06, 2014 8:50 am, edited 1 time in total.
Reason: Added a note for experts
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
Medullan
Posts: 9
Joined: Mon Jun 02, 2014 7:59 pm
android_version: 4.1 - Jellybean

Re: New to Development

Post by Medullan »

Awesome thank you both. I actually figured out how to fix it myself but I was unable to find the specific tile that was causing the problem.(I figured it might have been a rotated tile.) What I ended up doing was starting with a fresh template map renamed to bugcheck. I copied the gzip compressed text for each layer one at a time from the original map to the new bugcheck map using notepad++. once I attempted to load each map I was able to determine that it was the object layer causing the problem. It was handy that notepad++ asks if you want to load changes made in other programs and that tiled did not automatically update when I saved the map files in notepad++. That made it really easy to revert changes I did not need. I ended up just replacing the entire object layer. I checked the logcat and now I see where that red error showed up next time I'll put that in the spoiler.

As far as rotating sprites goes we were just getting to know the tiled program and had actually decided the rotated sprites didn't look right I guess we left one there on accident although it is good to know that rotated sprites will cause the game to crash perhaps that could be added to the wiki page on map making or advanced map making. It doesn't seem worthwhile to add a bunch of extra code with a high processing demand just to get AT to recognize rotated sprites but if anyone needs one rotated I can do it easily enough with photoshop.
Post Reply