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 / Error 1049 physical objects

Author
Message
Arohas
4
Years of Service
User Offline
Joined: 31st Jul 2019
Location:
Posted: 3rd Jan 2023 22:26
This code crashes when the number of objects reaches 1049.
I did not find any mention of restrictions in the documentation. It's probably some kind of mistake.
AppGameKit Studio has this same error.




Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 3rd Jan 2023 23:29
Your creating your object inside the loop, And this will crash when you run out of memory, I tried it on my laptop and it passed 1049 and crashed with no error and just closed when i ran out of memory.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 3rd Jan 2023 23:44
Create3DPhysicsDynamicBody( NewOnjId ) in the loop is killing the memory.

try this and it works but it does not fall but you are close



Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 4th Jan 2023 00:30 Edited at: 4th Jan 2023 02:48
Somewhat related: https://github.com/TheGameCreators/AGK-Studio/issues/924.

Otherwise, i know ive created more than 1,000 physics objects but there has to be a cap based on available memory, at least. I never had a need for so many but adding multiple shapes to a single object may be more efficient than complelety separate objects (unless u need absolutely individual objects).

Meanwhile, even after learning about separately deleting physics object and 3d objects, there is still a memory leak (learned that accidently leaving my mars keeper demo running for many hours) tho never did research further.

Finally, ur still on post-moderation so give us a chance approve ur posts before starting another thread.
Arohas
4
Years of Service
User Offline
Joined: 31st Jul 2019
Location:
Posted: 4th Jan 2023 08:52
"Game_Code_here"
This code is emasculated, like a demo from the benchmark code, which creates objects until the number of frames reaches 30. Judging by the memory monitor, it consumes no more than 300 mb. I ran it on computers with 16 and 64 gb. I don't think the problem is memory.

"Virtual Nomad", I see. Thank you. The delete3dphysicsbody solution is fine.
I consider it useful to indicate in the documentation about the limit on the number of physical objects. Perhaps, when the limit is reached, cause a meaningful message about the impossibility of creating a new object, and not terminate the program abnormally?
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 4th Jan 2023 10:48 Edited at: 4th Jan 2023 10:49
Quote: " I don't think the problem is memory."


It is a memory problem, with creating to many Create3DPhysicsDynamicBody

Did you not try my code proving it was not how many objects you created?

So if my laptop slows down and freezes then the program closes that is a memory problem.
Arohas
4
Years of Service
User Offline
Joined: 31st Jul 2019
Location:
Posted: 4th Jan 2023 11:54
"Game_Code_here" In other game engines (such as Godot) I can create tens of thousands of physical objects, there are no lags or crashes.
Well, let there be problems with memory, I will not argue. Although it is strange to think that 64 gigabytes of RAM is not enough for a thousand objects. I tried your code, it doesn't solve the problem, physics doesn't work in your example, balls don't move. At least on my computer.
In any case, I think the correct behavior of the program when there is not enough memory is not to create a new object and issue a meaningful error message, not to crash.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 4th Jan 2023 21:28
Quote: " it doesn't solve the problem"


I'm sorry I was not trying to solve the problem as there is no fix for this as I know.

My example or little change shows that i can make thousands of objects with no crash, that was the point.

And you can have thousands of objects in appgamekit with no lag or crashes, I just showed you.

You just need to be smart about how when and where and how many as for physics setup your memory will leak so to speak.

As for other game engines? I do not care about them, And we are not talking about them as there not in this example.

What you can do is make 100 objects and delete them if your array grows over 100, Or you might want to look into using sprites for effects , i can do the same thing here in your example using a sprite. And there is sprite physics .

What was the reason you needed thousands of little balls falling from the sky? I am sure there is another way we can help you to achieve what you are wanting. Because like i said, I myself have created thousands of falling sprites that look the same. As long as you get the same result I say.

Sorry if anything is misspelled here lol, I am a stupid Girl when it comes to spelling.
Arohas
4
Years of Service
User Offline
Joined: 31st Jul 2019
Location:
Posted: 5th Jan 2023 06:05
Quote: "What was the reason you needed thousands of little balls falling from the sky?"

This is a code snippet from a smartphone benchmark. The idea is to add objects whose behavior calculation loads the processor until the number of frames per second reaches a certain value, in my case 30. What if the number of frames is still too high, and the program has already crashed?
Quote: " ...i can make thousands of objects with no crash... "

Quote: " ... i can do the same thing here in your example using a sprite... "

I was talking about the problem with physical objects. I didn't call sprites or anything like that, I know they work fine. Nothing to talk about them.
I understand - you are suggesting a workaround.
This is useful when your goal is a visual effect in a game.
In a benchmark - the purpose of which is to load the system and determine the threshold of optimal performance of the device under test, this makes no sense.
Imagine - you have a stand with a dozen phones - you wrote a program to sort them by performance.
result:
refusal
refusal
refusal
1 place
2nd place
...
The most productive - did not pass the test, discouraging.


Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 5th Jan 2023 07:33
I think and could be wrong, But i believe it is putting so many Physics Dynamic Bodys in the loop is the error. So what I think the best thing to do is email support from the game creators and ask them if there is a limit on Dynamic Bodys. To me this sounds like the main problem.
Arohas
4
Years of Service
User Offline
Joined: 31st Jul 2019
Location:
Posted: 6th Jan 2023 10:12 Edited at: 6th Jan 2023 14:47
Virtual Nomad gave a link to the discussion above, which shows that the developers are aware of the problem.
I received both an answer and a workaround that, while not solving the problem, helps avoid crashes. In my opinion this is enough.
Quote: "...ask them if there is a limit on Dynamic Bodys."

Before asking a question here, I reviewed the AppGameKit code hosted on GitHub. There are no explicit restrictions. This is a memory manager error or some kind of system garbage, which I do not have enough qualifications to figure out.
Do you think it is necessary to write to them again?
I don't think this can be resolved quickly, especially since they already know about the problem.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 8th Jan 2023 01:45
If you look here you will see this has been a error for a long time, so this is why I suggested to ask them but it look like a error that might never be addressed. Or Mabey can not be fixed. I could be wrong but it is a old thread.

https://forum.thegamecreators.com/thread/227616
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 8th Jan 2023 03:08 Edited at: 8th Jan 2023 03:18
nice find, GCH. i don't even remember participating in that thread

issue reported: #1068
Arohas
4
Years of Service
User Offline
Joined: 31st Jul 2019
Location:
Posted: 9th Jan 2023 07:09
Game_Code_here
Quote: "...but it is a old thread. "

Yes, it looks like you are right.
Thanks for your help; looking forward to the fix.

Login to post a reply

Server time is: 2024-04-25 06:47:20
Your offset time is: 2024-04-25 06:47:20