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 / Possible bug involving load/create functions

Author
Message
NoUJoe
11
Years of Service
User Offline
Joined: 8th Jul 2013
Location:
Posted: 22nd Dec 2013 01:39
So, if you let AppGameKit handle the IDs of sounds/images/sprites it will start at 1 or 10001 accordingly. Now in a full on game, you're most likely going to be loading and unloading resources. So lets say you're loading 30 sounds per level. Regardless of whether there's 100 levels or 5 levels, each time you load a level, it's going to load the sound files each time. AppGameKit has a 299 sound file limit (which limits the max ID to 299, so if you have AppGameKit handling the IDs, eventually the ID that is assigned to whatever sound file is going to reach 300 and throw out an error.

A good way to show this is:



I know this is easily avoidable by just assigning the ID yourself but you know...
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 22nd Dec 2013 09:38
I thought AppGameKit would go around and check for empty slots.

However, 300 unique sounds is a lot. If I were you I would only load each sound once and not delete them for each level. If you do have a total of over 300 sounds then you would have to manage the IDs yourself for now. You can make your own function to handle it.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Dec 2013 10:57
If he has different sounds for each level, you don't want to keep them all loaded in memory the whole time on a mobile device that has limited ram.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Dec 2013 12:02
what version u use?
108 beta 19 no problem


AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
NoUJoe
11
Years of Service
User Offline
Joined: 8th Jul 2013
Location:
Posted: 24th Dec 2013 01:48
Quote: "what version u use?"


V2 Alpha 1. Your code also yields the same result as my code for me.

Quote: "If he has different sounds for each level, you don't want to keep them all loaded in memory the whole time on a mobile device that has limited ram."


Yeah, this is what I mean. To demonstrate further, lets say for example someone plays one level (which loads 30 sounds), so now when another sound file gets loaded, it will have the ID of 31. If the person quits the level, it will unload the 30 sounds previously loaded. Now if they were to do the exact same level again. When the sound files are reloaded, they will now have the IDs between 31 - 60. It is avoidable. I'd describe it as a avoidable annoyance!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Dec 2013 02:06 Edited at: 24th Dec 2013 02:07
in the load/delete loop i see only id=1
it does not increase.
i did not have testet with agk v2 alpha yet.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Dec 2013 15:23
Your code doesn't go past 1 because it is deleting the sound.
Take off the delete and viola, we get a crash at 299
So that gives us actually 299 sound objects loaded... yes, not 300.

So if you are deleting the sounds, there is no problem because that ID is freed.

The below code illustrates that removal of a sound by DeleteSound() indeed frees up the ID assignment.



Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Dec 2013 22:11
@Naphier
i test it because
"A good way to show this is:Code Snipped" at top.

@NoUJoe
i think you mean if the last id is not deleted you run over the 299 limit.
but i believe the limit is only 299 actual loaded sounds,
the limit is not bind at the id.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670

Login to post a reply

Server time is: 2024-11-24 23:25:09
Your offset time is: 2024-11-24 23:25:09