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 / 100% BUG! 108.24 tier1 or 2

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 18th Sep 2014 16:47
Add this code in any AGK-example and you'll see that AppGameKit creates new sprites with new numbers(1001,1002,1003...9999999999999), instead of using numbers of deleted sprites. I hope you'll understand me.
In my code after couple of hours the sprite numbers will be over a billions...

For Tier1


For Tier2
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Sep 2014 16:52 Edited at: 18th Sep 2014 16:53
I think this is 0% bug and 100% defined behaviour

The way it is currently done is the most efficient. It may also lead to less bugs or unexpected behaviour in your game since every asset has a completely new and unique identifier using this system.

Of course you are also free to use your own system so they have covered all bases

Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 18th Sep 2014 16:57 Edited at: 18th Sep 2014 16:58
Thanks! Please close my post.
I forgot, that I can use the CreateSprite(MYNUMBER,image);
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Sep 2014 16:59
I'm not sure, I have a feeling that it used to use deleted sprite ID's over 10000 if they no longer existed but you are right for sure about one thing Matty, it is not hard to create your own numbering system if you are likely to get into the billions...

Handling ID's is pretty basic stuff and as you said Matty it is probably safer not to re-use ID's particularly when Box2D is involved as if you delete one physics sprite with a particular ID and then create a new one with the same ID in the same loop it's possible it might cause problems with connected joints, velocity etc.
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Sep 2014 17:18 Edited at: 18th Sep 2014 17:47
Quote: "I have a feeling that it used to use deleted sprite ID's over 10000"

It definitely did at one point. When I was first learning AppGameKit, I often checked IDs of pretty much everything when bug hunting and noticed (for example) that sprite and image IDs were reused but touch IDs were not (thankfully).

No idea when the behavior changed, but I too don't think its an issue as there are still a heck of a lot of IDs before we overflow a 32 bit integer.

As a side note, the command DeleteAllSprites() does reset the value, if it needs to be reset.

Edit:

Just for fun, I did the maths;

My PC runs AppGameKit at about 3000fps with sync off, so doing nothing but create/delete sprites (1 per loop) it will create/delete;

3,000 sprites per second
180,000 sprites per minute
10,800,000 sprites per hour

So would take nearly 400 hours (16.5 days) of continuous running to create/delete 4,294,957,296 sprites ( 2^32 - 10,000 )

This is seriously not going to be a problem
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Sep 2014 17:56
Yes, I guess as most games don't run over 60fps anyway you would realistically be looking at around 10000 hrs...

I think I spent about 200 hours on Final Fantasy VII over a few months and that felt like a lifetime! None of us are likely to write an app that anyone will play for 10000 hours none stop
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Sep 2014 19:18
Quote: "None of us are likely to write an app that anyone will play for 10000 hours none stop"


You clearly have not played my game, The Worm Game

Just kidding

CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 19th Sep 2014 00:25
..also in your T1 example, you are creating sprite "i", but deleting sprite "sprite". Don't know if that was your intention, but that code will only ever create new numbered sprites.

Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 19th Sep 2014 21:15
No, no CJB, I just create this code specialy for the forum. And didn't test it for tier1. Any way I understood why AppGameKit works in that way...

Login to post a reply

Server time is: 2024-11-25 09:55:09
Your offset time is: 2024-11-25 09:55:09