Page 1 of 1

Slow game?

PostPosted: Thu Feb 16, 2012 8:12 pm
by Duncan_B
I just loaded up one of my old projects and noticed it runs more slowly than other adventures. My assumption is that it's because of the amount of events in the game being run immediately for one turn and repeating, of which there are safely more than 60. Is there a way to re-write these without getting rid of the effects they would create (triggered tasks) that might speed up the gameplay? I was thinking of maybe collapsing these events into a single "Run every turn" event which would be sectioned up into regions and execute the tasks, but I think that would be re-creating the same problem.

Suggestions?

Re: Slow game?

PostPosted: Thu Feb 16, 2012 9:07 pm
by Campbell
I seem to recall the number of events can impact performance in v4.

Re: Slow game?

PostPosted: Thu Feb 16, 2012 9:37 pm
by Duncan_B
I will try to collapse them then The ALR is also huge since it is in third person so maybe that could be another part of it

Re: Slow game?

PostPosted: Fri Feb 17, 2012 4:29 am
by DCBSupafly
What's "huge"? My biggest ALR is probably under 50k.

Re: Slow game?

PostPosted: Fri Feb 17, 2012 1:45 pm
by ralphmerridew
The time it takes to process one round of the ALR is largely proportional to (the number of entries in the ALR) times (total length of text to be processed).

How does your game run compared to _The PK Girl_? Since that game ran acceptably 10 years ago, I doubt sheer scale is the problem.

Are there the same slowdowns when run under SCARE? (For example, IIRC, whenever the player completes a task, ADRIFT Runner loops over all events to see if they should start. SCARE will build up a table with that information when it loads the game.)

Re: Slow game?

PostPosted: Sat Feb 18, 2012 11:09 pm
by Duncan_B
The ALR is only 36 kilobytes. It isn't slowed down at all in Gargoyle. So getting rid of events is the way to do it, 'ey?

Re: Slow game?

PostPosted: Sun Feb 19, 2012 3:03 am
by ralphmerridew
Regarding the ALR, what matters is how many entries it has, not how big they are.
An ALR with 1000 10-byte entries will be slower than an ALR with one megabyte-long entry.

Re: Slow game?

PostPosted: Sun Feb 19, 2012 1:49 pm
by DCBSupafly
ralphmerridew wrote:Regarding the ALR, what matters is how many entries it has, not how big they are.
An ALR with 1000 10-byte entries will be slower than an ALR with one megabyte-long entry.


Cool, makes sense.

Re: Slow game?

PostPosted: Mon Feb 20, 2012 5:00 pm
by DCBSupafly
My current project has 164 ALR lines and doesn't suffer at all for it. Safe to say ALR searching is not a significant factor?

Re: Slow game?

PostPosted: Mon Feb 20, 2012 11:37 pm
by ralphmerridew
I checked. PK Girl had 1700+ ALRs, and 300+ events, so I doubt that it's so solely the number of those that's causing trouble.

First, download PKG and see if it runs at a decent pace. If it doesn't, there's a problem with your computer.

What parts of your game are slowed down? I remember that ADRIFT would have very slow performance on tasks that heavily used Advanced Command Construction (braces / brackets / references), but I thought that was fixed.

Do some testing to see whether events actually are the cause of the slowdowns.

First thing, back up your game. Make multiple backups, if you can.

Next, open up one backup, and remove the ALR completely. See if that fixes the problems.

If it doesn't, try removing all the events completely and see if that does.

Re: Slow game?

PostPosted: Tue Feb 21, 2012 2:23 am
by phkb
For comparison, the ALR in "Cursed" has 9861 lines, and is about 1mb in size. There are 156 events. The game itself is fine during play, although it takes a while to index the ALR at the start of play.
When I hit slowdown issues I found the issues were more about the following:
- wildcard commands (ie. using "*" in commands too often). Solution was to restructure the command to eliminate the need for the wildcard. Not always possible, obviously.
- having very complex commands (eg having commands like "[kill/hit/maim/destroy/murder/attack/fight] person {[with/using] [ax/axe/mattock/pick]}"). Solution was two-fold: restructuring the commands, and judicial usage of synonyms. Have to be careful, though. I shot myself in the foot a few times with adding synonyms.