Hello warzone developers,
I've created a small mod using among others a user defined script event, called every 2 seconds.
This event is added to each playerx.slo file under warzone\multiplay\skirmish\.
It uses following scriptfunctions:
isHumanPlayer, isStructureAvailable, structureComplete
initEnumStruct / enumStruct
structureBuiltInRange, distBetweenTwoPoints, numEnemyWeapDroidsInRange
completeResearch
addStructure, destroyStructure
Basically the mod works well and there are no errors in the stderr.txt or stdout.txt files,
but warzone crashes after at least 5 to 30 minutes playing a multiplayer map.
*.rpt and *.mdmp files are attached, do you need more informations for debugging this special problem?
Greetings, Tiuz.
2.1 beta4 crash using scripts
Re: 2.1 beta4 crash using scripts
The script and the exact steps to reproduce the crash would help.
Re: 2.1 beta4 crash using scripts
Looks like a division by 0 error to me.
It could be script related, but as Per said, we need to see it.
It could be script related, but as Per said, we need to see it.
Re: 2.1 beta4 crash using scripts
unfortunately there is no defined way to reproduce this crash.
However, when i start wz with an arbitrary multiplayer map, it crashs each time after about 5 to 30 minutes independent of used computer.
Following the used script event. By the way, it adds a rudimentary gate functionality to wz.
I also attached the complete mod, because there are some additional bulidings, stats etc.
Can you maybe give me a hint, where to find this problem?
Thanks, Tiuz.
However, when i start wz with an arbitrary multiplayer map, it crashs each time after about 5 to 30 minutes independent of used computer.
Following the used script event. By the way, it adds a rudimentary gate functionality to wz.
Code: Select all
// ------------------------------------------------------------------------------------------------------------------------
// Gate functionality
event Torfunktion(every, 20) {
// Locals
local bool antep, gse, ks, mex;
local int k, i, j, range1, range2, n_max, dx, dy;
local STRUCTURE ggs, gss, gmm, todes;
local STRUCTURESTAT cg, cs, cm;
n_max = 5;
range1 = 1200;
range2 = 150;
// Only for humans
if (isHumanPlayer(me)) {
// Make both components available (Horizontal and vertical gate)
if (isStructureAvailable(GateG, me) && not isStructureAvailable(GateGH, me)) {completeResearch(GateRX, me);}
k=0;
while(k < 2) {
// Which component?
if (k==0) {cg = GateG; cs = GateS; cm = StakeM; dx = 0; dy = 128;} // vertical
if (k==1) {cg = GateGH; cs = GateSH; cm = StakeMH; dx = 128; dy = 0;} // horizontal
// Loop over all gate grounds
j = 0;
initEnumStruct(FALSE, cg, me, me);
ggs = enumStruct();
while(ggs != NULLOBJECT && j < n_max){
// Building ready?
if (structureComplete(ggs)) {
// Set gate marker, if not existing
gmm = structureBuiltInRange(cm, ggs.x + dx, ggs.y + dy, range2, me);
if (gmm == NULLOBJECT) {addStructure(cm, me, ggs.x + dx , ggs.y + dy);}
// Enemy ante portas?
antep = false;
if (numEnemyWeapDroidsInRange(me, ggs.x, ggs.y, range1, FALSE) > 0) {antep = true;}
// Gate stake existing?
gss = structureBuiltInRange(cs, ggs.x + dx, ggs.y + dy, range2, me);
// If not, should it exist?
i=0; gse = false;
while(i < n_max && gss == NULLOBJECT){
if (distBetweenTwoPoints(px[i][k], py[i][k], ggs.x + dx , ggs.y + dy) < range2 && GateE[i][k]) {gse = true;}
i = i + 1;
}
// Add gate stake
if (not gse && antep && gss == NULLOBJECT) {
gss = addStructure(cs, me, ggs.x + dx , ggs.y + dy);
// Save position on map
GateE[j][k] = true; px[j][k] = ggs.x + dx; py[j][k] = ggs.y + dy;
}
// Remove gate stake
if (not antep && gss != NULLOBJECT) {
destroyStructure(gss);
GateE[j][k] = false;
gse = false;
}
// If gate stake is destroyed, remove associate gate ground
if (gse) {
destroyStructure(ggs);
GateE[j][k] = false;
}
}
ggs=enumStruct();
j = j + 1;
}
// Loop over all gate stakes
initEnumStruct(FALSE, cs, me, me);
gss = enumStruct();
while(gss != NULLOBJECT) {
// Remove associate gate stake, if gate ground is destroyed
if (structureBuiltInRange(cg, gss.x - dx, gss.y - dy, range2, me) == NULLOBJECT) {destroyStructure(gss);}
gss = enumStruct();
}
// Loop over all gate markers
initEnumStruct(FALSE, cm, me, me);
gmm = enumStruct();
while(gmm != NULLOBJECT) {
// Remove associate gate marker, if gate ground is destroyed
if (structureBuiltInRange(cg, gmm.x - dx, gmm.y - dy, range2, me) == NULLOBJECT) {destroyStructure(gmm);}
gmm = enumStruct();
}
k=k+1;
}
}
}
// ------------------------------------------------------------------------------------------------------------------------
Can you maybe give me a hint, where to find this problem?
Thanks, Tiuz.
Re: 2.1 beta4 crash using scripts
Well, I haven't forgotten about this.
Have you tried it with branch 2.1, and not beta 4?
About the best way to help us help you would be to run a debug build of the game under a debugger.
If possible, can you do this?
You need gdb, if it isn't already installed, (http://sourceforge.net/project/showfile ... e_id=20507)
and then you cd to where the game is at, and type
gdb ./warzone2100.exe
>run
Then when you crash, you type:
bt full
and you can post that information.
When I get some free time, I will look into this some more.
*edit, did a quick test:
widthScatter = ((psBuilding->pStructureType->baseWidth) * TILE_UNITS/2)/3;
So issue is that baseWidth = 0 , baseBreadth = 0, and it crashes on a division by 0 error.
Have you tried it with branch 2.1, and not beta 4?
About the best way to help us help you would be to run a debug build of the game under a debugger.
If possible, can you do this?
You need gdb, if it isn't already installed, (http://sourceforge.net/project/showfile ... e_id=20507)
and then you cd to where the game is at, and type
gdb ./warzone2100.exe
>run
Then when you crash, you type:
bt full
and you can post that information.
When I get some free time, I will look into this some more.
*edit, did a quick test:
widthScatter = ((psBuilding->pStructureType->baseWidth) * TILE_UNITS/2)/3;
Code: Select all
- psBuilding->pStructureType 0x035a0bc8 {ref=852122 pName=0x0355aad0 "StakeMark" type=REF_DEFENSE ...} _structure_stats *
ref 852122 unsigned int
+ pName 0x0355aad0 "StakeMark" char *
type REF_DEFENSE _structure_type
techLevel TECH_LEVEL_ALL _tech_level
strength STRENGTH_HARD _struct_strength
terrainType 1 unsigned int
baseWidth 0 unsigned int
baseBreadth 0 unsigned int
foundationType 0 unsigned int
buildPoints 250 unsigned int
height 1 unsigned int
armourValue 15 unsigned int
bodyPoints 420 unsigned int
repairSystem 10 unsigned int
powerToBuild 150 unsigned int
resistance 150 unsigned int
sizeModifier 0 unsigned int
+ pIMD 0x033a7e58 {texpage=27 sradius=181 radius=128 ...} _iIMDShape *
+ pBaseIMD 0x00000000 {texpage=??? sradius=??? radius=??? ...} _iIMDShape *
+ pECM 0x034eebe8 {ref=393216 pName=0x03502af8 "ZNULLECM" techLevel=TECH_LEVEL_ALL ...} _ecm_stats *
+ pSensor 0x03569600 {ref=327680 pName=0x03502d70 "ZNULLSENSOR" techLevel=TECH_LEVEL_ALL ...} _sensor_stats *
weaponSlots 0 unsigned int
numWeaps 0 unsigned int
+ psWeapStat 0x035a0c24 _weapon_stats * [4]
numFuncs 1 unsigned int
defaultFunc -1 int
+ asFuncList 0x032fa318 _function * *
Re: 2.1 beta4 crash using scripts
Then i think i know what cause this problem :-S
The mod contains a stucture with zero expanse, which marks the pass of gates. Because it has no expanse it does not block movement of droids.
But obviously this is no proper workarround ...
Thank you for your help!
Tiuz.
The mod contains a stucture with zero expanse, which marks the pass of gates. Because it has no expanse it does not block movement of droids.
But obviously this is no proper workarround ...
Thank you for your help!
Tiuz.