100% CPU usage when golem gets frozen

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
kurzedmetal
Posts: 4
Joined: Sun Sep 18, 2011 12:55 am

100% CPU usage when golem gets frozen

#1 Post by kurzedmetal »

I've been able to reproduce this several times.

I was playing my first character, which i started a few hours ago, reached to the level 3 of the Ruins of Kor'Pul, made a save close to where "The Shade" is (because the first time i went there it crashed too)
Everytime i get close to the Shade i get frozen by him, if i control my golem, he usually gets targeted, if i keep playing the golem turns, the game goes on fine; But if i switch back to my main character (the alchemist) i get 100% cpu usage and i am forced to kill the game process.

I got a similar problem with a trap earlier, in one of those rooms with which have 1 item + 1 skelly in 4 1x1 rooms, but i couldn't reproduce it until now.

I can upload my save if you want, but dunno which files are necessary. List them and i'll attach/upload them.

Frumple
Sher'Tul Godslayer
Posts: 1517
Joined: Sat May 15, 2010 9:17 pm

Re: 100% CPU usage when golem gets frozen

#2 Post by Frumple »

Have had this happen twice so far in b34, when personally stuck in an iceblock. CPU maxes out, have to kill the program.

The issue may or may not be because of ice damage being attempted to be applied to the iceblock, though this theory isn't well tested. The character I've been getting stuck with (third time, vs rantha) is doling out ice damage with its attacks, though.

Frumple
Sher'Tul Godslayer
Posts: 1517
Joined: Sat May 15, 2010 9:17 pm

Re: 100% CPU usage when golem gets frozen

#3 Post by Frumple »

Doublepost for good news: Tiger_eye figured out what was causing this, and has a tenative fix that prevents the golem's eye beam (and incidentally, arcane blade's arcane combat) from triggering the loop.

If anyone doesn't mind invalidating their save, they can fix the problem by adding

Code: Select all

if self.x == x and self.y == y then return end
to line 301 (a blank space) in ../data/talents/spells/golem.lua and

Code: Select all

if self.x == target.x and self.y == target.y then return end
to line 31 (displace the current 31 down a line) in ../data/talents/techniques/magical-combat.lua. The .team file holding these can be uncompressed, appropriate files edited, and then recompressed freely -- it's apparently just a .zip with a special name.

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: 100% CPU usage when golem gets frozen

#4 Post by tiger_eye »

Modifying the lua files invalidate the game for the online server, but modifying the C code doesn't. So, if you can compile the game yourself, want to fix this bug and still have a valid game version, please try the following:

Code: Select all

Index: src/fov.c
===================================================================
--- src/fov.c	(revision 4439)
+++ src/fov.c	(working copy)
@@ -631,7 +631,7 @@
 {
 	fov_line_data *line = (fov_line_data*)auxiliar_checkclass(L, "core{fovline}", 1);
 	bool dont_stop_at_end = lua_toboolean(L, 2);
-	if (!dont_stop_at_end && line->dest_t == line->t) return 0;
+	if (!dont_stop_at_end && line->dest_t == line->t || line->dest_t == 0) return 0;
 
 	// If there is a tie, then choose the tile closer to a cardinal direction.
 	// If we weren't careful, this would be the most likely place to have floating precision
If you don't mind invalidating your game, then the following is the modification that Frumple mentioned (and has been tested):

Code: Select all

Index: game/modules/tome/data/talents/spells/golem.lua
===================================================================
--- game/modules/tome/data/talents/spells/golem.lua	(revision 4439)
+++ game/modules/tome/data/talents/spells/golem.lua	(working copy)
@@ -298,6 +298,7 @@
 		local tg = self:getTalentTarget(t)
 		local x, y = self:getTarget(tg)
 		if not x or not y then return nil end
+		if self.x == x and self.y == y then return end
 
 		-- We will always project the beam as far as possible
 		local l = self:lineFOV(x, y)
Index: game/modules/tome/data/talents/techniques/magical-combat.lua
===================================================================
--- game/modules/tome/data/talents/techniques/magical-combat.lua	(revision 4439)
+++ game/modules/tome/data/talents/techniques/magical-combat.lua	(working copy)
@@ -28,6 +28,8 @@
 	cooldown = 5,
 	tactical = { BUFF = 2 },
 	do_trigger = function(self, t, target)
+		if self.x == target.x and self.y == target.y then return end
+
 		if rng.percent(20 + self:getTalentLevel(t) * (1 + self:getDex(9, true))) then
 			local spells = {}
 			local fatigue = (100 + 2 * self:combatFatigue()) / 100

kurzedmetal
Posts: 4
Joined: Sun Sep 18, 2011 12:55 am

Re: 100% CPU usage when golem gets frozen

#5 Post by kurzedmetal »

Good Job :)
I guess I'm gonna try to compile it when i get back from work, because i really want to play an Alchemist.

So... let me see if i got his right.
Changing Lua: breaks save compatibility and invalidates the client for the online server.
C & recompiling: doesn't invalidates the client. what about the save compatibility?

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: 100% CPU usage when golem gets frozen

#6 Post by tiger_eye »

Neither change should affect save compatibility. Modifying Lua invalidates the client for the online server; modifying C doesn't.

btw, I haven't actually tested the C change, but I'm pretty sure it should work. Good luck!

Post Reply