Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Runtime Error after numerous "Generate Entity" commands (Bug, Scripting Question, Feature Request, pretty much everything)
New Topic New Poll Post Reply
Poster Message
Lucky Luc
Level: Smitemaster
Rank Points: 1215
Registered: 08-19-2012
IP: Logged

File: Boulder Test.hold (12.3 KB)
Downloaded 26 times.
License: Public Domain
icon Runtime Error after numerous "Generate Entity" commands (0)  
Skell edit: this is a duplicate of this bug http://forum.caravelgames.com/viewtopic.php?TopicID=39045

I get a repoducable runtime error (the application has requested the Runtime to terminate it in an unusual way) which I believe is caused by too many existing entities at once. I'm using v4.0.2.112.

So, what I've been trying to do is basically the following:

I've been trying to "fake" functions by creating a character that takes parameters stored in hold variables and returns a result by storing it in another variable. Whenever I want another character to call that function, I set up the variables and use GenerateEntity to instantly evoke its script. I tried to kill the function executer by either calling "Imperative Die" or "End" after the result is stored (note that my character is invisible at the beginning, so I'm not sure if Imperative Die works anyway?).

So far, this is the only way I've found to fake functions within only one move, and at first I thought that was working very well. However, when playing the room for a longer time, first I've noticed the game was lagging on some turns, and after about 100 turns (with about 10 function calls per turn, admittedly), the game crahes, with the number of turns it takes seeming to be related to the number of function calls and thus to the number of "Generate Entity"'s.

So...

Bug Report: First, though it's kind of obvious the game can't handle an infinite amount of characters, it shouldn't crash. Second, I'm confused about the number of entities anyway, as I feel an NPC who dies or whose script is ended while invisible should be removed from the game engine's list of entities. Is this behaviour intended or could that be changed?

Scripting Question: Well, two of them actually:
1. Is there maybe a way to completely get rid of an NPC? The two I could think of obviously didn't work.
2. If not, is there any other possibility to fake an instant subroutine?

Which leads to the feature request: Though I'm quite amazed what can be done with the scripting system, actual functions (with parameters and return and everything) would be really nice (I think this was already suggested several times), though I can imagine it to be hard to implement. To go over the top, an OOP approach would be even nicer ;) (I'd already be happy with NPCs being able to store private variables)

I've attached an example hold that crashes on turn 120 on my pc I think.

Sorry for the long post, I hope it helps in any way,
Lukas


[Last edited by skell at 10-15-2020 01:08 PM]
08-31-2012 at 11:58 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2379
Registered: 08-07-2007
IP: Logged
icon Re: Runtime Error after numerous "Generate Entity" commands (+1)  
I guess I'm resurrecting a 7-year-old post.

Like Luc was doing, I am trying to make use of Generate Entity to create a large number of NPCs on each turn. This is causing the game to lag after just 100 moves or so. I want each NPC to exist for only 1 turn, so I call Die and End on each one (which I thought would cause the app to release any memory associated with the NPC).

That's apparently not happening. The memory usage of DROD continues to climb while playing the room and the lag gets worse. I didn't run it long enough to witness a game crash.

Has anyone figured out a trick to release an NPC completely from memory?

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.

[Last edited by disoriented at 08-24-2019 08:04 AM]
08-24-2019 at 08:03 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1055
Registered: 06-23-2006
IP: Logged
icon Re: Runtime Error after numerous "Generate Entity" commands (+1)  
I made a similar report here: http://forum.caravelgames.com/viewtopic.php?TopicID=41020

The closest to an official response at the time was that this isn't a problem, because apparently you need to create millions of NPCs for the game to ecounter issues. So NPCs don't cleaned up until you change rooms, and there's no way to clean them up from inside the game.

Three years on, I'm still don't if cleaning up dead NPCs would have an effect on the Undo Stack, but based on my current understanding of it, I don't think it would cause issues. Sounds like a project for a hypothetical DROD 6.0, but I wouldn't hold your breath for it.

____________________________
[Insert witty comment here]
Qzvlkx?
08-24-2019 at 11:20 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Smiter
Avatar
Rank Points: 406
Registered: 01-27-2017
IP: Logged
icon Re: Runtime Error after numerous "Generate Entity" commands (+1)  
I can conform this problem as well, and you certainly don't need millions of NPCs to cause problematic lag.

This was the reason for me to develop some nifty ideas on re-using NPCs instead of re-spawning them every turn.

If you send me a PM, disoriented, I might help you out with a couple of ideas. Really don't know if I'll be of any help, but perhaps, our issues are similar and my approaches could also work for you in modified form.

____________________________
Autocorrect is not my friend. Apologies for the typos.
08-24-2019 at 02:12 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Bugs : Runtime Error after numerous "Generate Entity" commands (Bug, Scripting Question, Feature Request, pretty much everything)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.