Author Topic: Random SDK Made Map Crashes  (Read 2981 times)

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Random SDK Made Map Crashes
« on: April 18, 2005, 07:27:58 PM »
.............. :(

Why should they crash randomly ?? or not so randomly ??
like when big battles happen, or something..

None of the dll code is runing after the game has started..

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Random SDK Made Map Crashes
« Reply #1 on: April 18, 2005, 09:24:14 PM »
It could be an invalid parameter was used during setup. Perhaps try to see if the problem occurs when something happens with one of the original units you start with. They would be the most likely culprits. (Or anything else initialized during startup by the DLL).
 

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
Random SDK Made Map Crashes
« Reply #2 on: April 19, 2005, 02:17:38 AM »
One thing's for sure: crashes are never random.
I had op2 crash early in my coding... turned out that there was a problem with the maps. Whenever a (AI or human) unit tried to move from A to B, and it would meet a ridge or something, it would try to go around it: even if the unit was already at the bottom line, it would try to go 1 line lower to pass the non-passable tile, and BOOM  (xp)  :stop: <<CRASH>>
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Random SDK Made Map Crashes
« Reply #3 on: April 19, 2005, 04:20:12 PM »
You have seen the code of the map Nolstal.. you wrote Hoovile Hooman so what could be the problem?

Happeneded won Haxtors map also, and its happened on Nostal when I wasnt playing. Sometimes it wont crash at all. It happens a lot when there are big battles... But basicly it seams random.

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
Random SDK Made Map Crashes
« Reply #4 on: April 19, 2005, 04:39:01 PM »
from the looks of it, it seems your best option is a basic trial-and-error:
play it, if it crashes, remove some item, and play it again...
keep removing items until it doesn't crash anymore. Then start putting items back ('cept the one you removed last, which also removed the crash).
If your crash doesn't come back, you found your problem...
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Random SDK Made Map Crashes
« Reply #5 on: April 20, 2005, 01:29:09 AM »
Perhaps if you got me the crash address I could figure out what's happening? The next time it crashes, if Windows error reporting comes up, take a look at the address of the instruction that causes the crash (if you can find it). It'll need to be a valid instruction address though, not the address of the data it was trying to access and hence caused a crash (which is usually 0 or close to it). With the code address, I can trace back to see what conditions led to the failure.

(If you have trouble finding the address, maybe look for the EIP register in the dump. Probably from the first thread, but it wouldn't hurt to check other threads as well. Of course, I would really need to know which one was the problem one.)
 

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Random SDK Made Map Crashes
« Reply #6 on: April 20, 2005, 04:48:39 PM »
hmm i clicked debug once wen it crashed, i think i pasted stuff in irc, so it should be in my log..

Offline zigzagjoe

  • Hero Member
  • *****
  • Posts: 626
Random SDK Made Map Crashes
« Reply #7 on: April 27, 2005, 08:36:56 AM »
In maps dlls that I'm working on, Hooville has shown to be completly stable, eg. no crashes, weird stuff happening etc. Do you use any exotic settings in it? I find it really odd that it would crash.

I have tested them with 4 players and some really huge battles, but i have never had hooville crash. (except by stupid mistakes by me  :heh: )

I have noticed if you throw it into a endless loop, it seems to have crashed. The reason i say this is that when its 'crashed', its using ~100% cpu even on my comp. This leads me to think somethink is throwing into a loop.

Like they say, crashes are never random.
« Last Edit: April 27, 2005, 08:42:10 AM by zigzagjoe »

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Random SDK Made Map Crashes
« Reply #8 on: April 27, 2005, 09:08:48 AM »
Rember Joe when playing Nostal, it crashed for no reason at 'random' times.

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Random SDK Made Map Crashes
« Reply #9 on: April 27, 2005, 11:18:37 AM »
Yeah.. as I think about it, Hooville shouldn't really be the cause of it. Like Levi and I were talking, "real" DLL code is only executing during game initialization. (Yes, it calls AIProc every cycle, but there's no tangible code inside AIProc besides the "RET" in most multi missions).

I thought, perhaps the internal limits of OP2 are being overrun. for example, OP2 has a limit of 256 ScStubs. Those are divided into smaller divisions, being maxes of 128 Triggers, and 128 Fight/Build/MiningGroups. If this internal limit is passed, OP2 will crash.

However in a typical LoS multiplayer mission this shouldn't be an issue at all. (There are no Groups, and only 1 Trigger). I doubt Hooville has a bug of creating groups/triggers randomly (this problem would manifest itself a lot more visibly).

(Oh, btw, I think that's why CTF crashes all the time... It doesn't destroy old triggers, just creates new ones on top of the existing ones. This in itself is a note to developers: If you create a one-shot (non repeating trigger, 2nd param is FALSE), and create more triggers during the course of the game, save the created instance in a global trigger variable. That way, at the beginning of the trigger proc, you can call .Destroy() on that trigger. A "delete var;" will not deallocate the trigger, only Destroy() will. After that you can re-use the variable. OP2 has no garbage collection on game objects, so you have to do that yourself by destroying unneeded triggers/groups).

Joe, what do you mean by it causing a loop and 100% CPU usage? If it crashed that wouldn't seem likely.

Hmm! I just had a thought, maybe the fault lies within the small runtime library we're using in the 2nd version of the SDK, named LIBCTINY.LIB.
I'm not certain whether this is the case, but this runtime might not be thread-safe. If it's not thread safe, it has the potential to crash the program. (However, I don't see why it would, again since no code is running from the DLL or static runtime library).

I'd encourage people to try something with their projects, compiling with the normal runtime to see if their project still crashes.

To do this, open your SDK2 based project in MSVC and do the following:
Go to Project > Settings. In this dialog click the "OP2Script" (root node of the tree on the left) to select the whole project. On the right go to the "Link" tab. In the "Category" dropdown choose "Input".
In the box labeled "Object/library modules" remove any reference to ..\lib\libctiny.lib or similar.
In the "Ignore libraries" box remove "libcmt.lib".

Press OK. Go in the menu to Build > Clean, then rebuild your project.

The DLL should now be about 30 KB larger. If this doesn't fix the problems, then the runtime library isn't the issue.

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Random SDK Made Map Crashes
« Reply #10 on: April 27, 2005, 11:23:20 AM »
Problem is, we do a test and it probly wont crash anyway, lol.

It crashes at random times, so i cant recreate the crash, just play the dll and hope for it not to, or to as the case may be.

Aint the new libary better tho?

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Random SDK Made Map Crashes
« Reply #11 on: April 27, 2005, 11:27:25 AM »
yeah, the new library is less bloated, and it's better for OP2 DLLs.

it might be useless though cuz of the multithreading in OP2. Still though, it shouldn't be much of a problem since DLL code is running only at the beginning. (And the only library calls used are implied ones like in the dll entry point, and statically constructed class vars).

Offline zigzagjoe

  • Hero Member
  • *****
  • Posts: 626
Random SDK Made Map Crashes
« Reply #12 on: April 27, 2005, 04:15:45 PM »
When i played nostal and it 'crashed', it was using ~100% cpu. This leads me to think that it got thrown into a loop. Most crashes i see are using 0% cpu. (not op2 related crashes, just general crashes)

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Random SDK Made Map Crashes
« Reply #13 on: April 28, 2005, 02:03:21 PM »
Next time it crashes, take down the module in which it crashed, and the EIP (or Code Address). The full error report would be nice, if you could paste it, that way we could determine from context what's wrong.

It's gotta be inside the EXE somewhere -- no code is running from the DLL after the game has started on a multi mission.
« Last Edit: April 28, 2005, 02:03:55 PM by op2hacker »