Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / loadsubimage and error -1073741819

Author
Message
Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 23rd Jun 2013 02:35 Edited at: 23rd Jun 2013 02:37
Ok, so I'm trying to use the loadsubimage command to load up a bunch of tiles from my tile files (they're .png).

This is a sample of the code.



This is a sample of the subimage file



384 is the last entry.

It works. The tiles load, display, and I can walk around on the map, but when I go to exit the program exits with a crash and the IDE gives me Process terminated with status -1073741819

What am I doing wrong? Maybe everything. I don't know.

It happens in beta 108 13, 14, and presumably other versions. I've tried different things and sometimes I think it is fixed, but I'll walk to some far-flung portion of the map and it'll pop up again when I exit.

I compile for Windows only.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Jun 2013 05:30
I don't use atlas files as I find them almost pointless. I would make sure my image is setup correctly (tiled) and just use setspriteanimation() with whatever grid is needed, and then set each sprites frame to the needed image. However it probably isn't the issue.
In my experience the error you mention is normally caused by an array being out of bounds, and the compiler failing to register this before run time, so you get the error when the program attempts to access it.
When you say exit, do you mean an actual exit or a return to a menu for instance? If so, the program is probably trying to access an array/variable incorrectly.
Of course it could be something else, but is definitely where I would look first.
Still, I recommend using the sprite animation command and tileing your image to suit. For one thing it saves having a subimage file altogether. Unless you really need the extra space it can give you.

Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 23rd Jun 2013 06:46 Edited at: 23rd Jun 2013 07:04
When I say "exit" I mean terminate the program. I have the "escape" key set to end the software and I can also click the red "x" that the window has. Either way makes the program end with an abnormal termination message from Windows 8 and then the IDE has the status message.

Subimage files are a pain in the tail but that is how I thought images were supposed to be managed.

I had individual tile image files when I started (one tile per image) but now I'd like to keep the tiles in 4 or 5 big png files instead because I have drawn around 1500 different tiles. Having 1500 images in my media folder seems unruly.

I'll look at setspriteanimation(). Only NPCs have animation though. The rest are just one tile (eg: grass).

I will probably only deploy to a phone as an afterthought so I don't think space is a big concern for me.
Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 23rd Jun 2013 08:18 Edited at: 23rd Jun 2013 08:24
I used build 107 to compile and I don't get this error.

I guess it's AppGameKit beta's problem but I'm sort of uneasy with that answer. Now I don't really know if it's my code or AGK's.

I have several blocks of the same code to handle different atlases for different files. It only crashes on one of them but since I have copied and pasted the code from the working blocks it is identical to the code that works (save for variable name changes). The sub image file has been gone over with a fine tooth comb. I even regenerated it using a utility. The png file has been saved with Photoshop just like the other png files. I don't know what it is.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Jun 2013 08:24 Edited at: 23rd Jun 2013 08:37
No, you misunderstand my meaning. You are definitely better off using as few images as possible, as I mention in my speeding up AppGameKit thread. You do not want to have a gagillion images in your folder, or memory for that matter. I just mean the actual subimage files are mostly not needed. If you have an image of 4x4 128x128 tiles, making your final image size 512x512 for instance. All you need to do to load the images in, is assign the image to the sprite, then use setspriteanimation(spriteID,128,128,16). Each frame would be 128x128 pixels, with a total of 16 frames. That would automatically break up your sprites image into the frames needed, without needing a subimage file to read at all. If you really need to cram the space then you would use a subimage, so you don't grab parts you don't want. Generally though, it is unnecessary.

Don't think of the sprite animation command only being useful for animations, I use it to break up tile maps and all sorts. I have recently made a basic Isometric engine using it for the floor tiles. Each floor type is a different frame. If animation is needed, it is just a matter of setting up the sprite so you use every 8(or as many as needed) frames for the base image, the rest being animation frames for each tile.

The error you are getting as I say is normally associated with array problems, not image issues. Odd you only get it when you exit the program though. Perhaps it is a bug in the version you are using? Best bet is to experiment, try remming out parts of your code to try to isolate which bit is crashing it.

Edit - If as you say it only crashes on one image, I would double check the code, typos can be hazardous to your health Also the image, is it the same as the rest? Do you use power of 2 images, such as 128x128, or 512x512 or have you got odd sized images? The PC can normally cope with them, but you can get odd padding errors if you don't stick with power of 2 sprites, especially on phones etc.

Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 23rd Jun 2013 08:33 Edited at: 23rd Jun 2013 09:39
I edited my post above since I'd discovered some more about what was causing the issue - or at least which section of code in conjunction with using a beta.

The tiles in the "offending" code are 32x32 with an image size of 1024 by 512. There are 512 tiles packed in that png file.

I'm not in love with the subimage files so if there is a better way to load an image and bust it into tiles that's great. I'll check out setspriteanimation and post what I come up with in a bit.

This bit of code compiles and runs properly on 107. It compiles on the betas, but causes a crash on exit.



I used a utility to generate the subimage file so I think it's ok. The png was saved in Photoshop so I think it's ok. I don't know why the beta takes issue to this bit of code and causes a crash when exiting the game. The official AppGameKit release (not beta) makes an exe that causes no crash with the exact same code, same subimages, same .png, etc..
Grooovy!
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location: Delray Beach, FL USA
Posted: 24th Jun 2013 16:49 Edited at: 24th Jun 2013 16:51
Weird...

Looks like some sort of 32-bit signed integer overflow... (familiar number in programming -1073741824 ... 0 ... +1073741824)

-1073741819 is very close to the negative signed limit for this...

Something amiss with the beta's array math?

EDIT:

Actually, this is half the value... ??? strange...

Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 24th Jun 2013 18:30 Edited at: 24th Jun 2013 18:35
In a further wrinkle...

Unless I've goofed in my testing...

When compiled under Windows 7 32 bit (beta 13) I get no error on exit.

When compiled under Windows 8 64bit (same code, same beta 13) I get an error on exit.

When compiled under Windows 8 64 bit (same code, 107 version) I get no error on exit.

Something about the betas and either Windows 8 or specifically Win8 64 bit is not happy.

This may be TGC's bug.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jun 2013 19:56
I've been seeing a lot of people running into issues with Windows 8 lately.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 24th Jun 2013 20:16
I hope its fixed. New PCs are coming with Win8 preinstalled.

I'll see if I can make an example program that reliably causes the crash and submit that to... Someone? As a bug report.

It might be a little later in the week though. I lost a day tracking this down and I need to make up for it.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 24th Jun 2013 21:48
Certainly sounds like a bug. Windows 8, looks horrible, so I haven't tried it yet. I wouldn't be surprised if that was the problem. 108 is still beta, so you are probably better off sticking with 107 for now.

Bug reports are handled by Ancient Lady (there could be more peeps now of course), there is a Google bug report page for that. Good luck with your project, there's nothing worse than spending ages checking your code for problems, only to find it is an AppGameKit bug.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jun 2013 22:34
Quote: "Bug reports are handled by Ancient Lady"

Actually, there were originally 5 of us (then baxslash dropped out when he became employed by TGC). But I haven't seen any of the others doing anything lately.

I do try to get to things in the google list if I have time and the right environment. But I do this as an uncompensated volunteer, so please don't beat me too badly if I can't get to everything.

I do NOT have anything with Windows 8 and have no plans of getting anything with Windows 8. So, I can't test in that environment. Sorry.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 25th Jun 2013 05:29 Edited at: 25th Jun 2013 05:29
I can always test for bugs on Win8 64bit.

Win 8 is okay once you get used to the new start menu.

If I write up a program that can duplicate this error where do I send it?

I don't mind doing bug testing.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jun 2013 16:46
To post bugs go to this page. You may need to sign up.

Then, create a new issue and include the code in the post. If it requires images, those can be added as well.

Please don't attach an entire project, we need to be able to take the code as it is and test it locally.

Of course, this means that one of the Community Testers needs to have a Windows 8 environment to test in (and I don't).

If none of us have that environment for testing, so that we can officially declare it an AppGameKit bug, then we have to hope that someone else watching the list does have the right Windows 8 environment and is willing to test and confirm the issue.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Lost Dragon
13
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 26th Jun 2013 06:38
Ok will do. Thank you!

Login to post a reply

Server time is: 2024-05-07 11:43:56
Your offset time is: 2024-05-07 11:43:56