Failing to load the wrf files

Our old place to report Bugs, it's not used anymore. To report bugs, please read this topic.
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Failing to load the wrf files

Post by Blaubaer »

Hallo,

I had some trouble running the game under Linux. As I managed to fix it, I thought I tell you
the issue and the simple fix I found.

After a successfull build process the  application failed to load by reporting:
Fatal signal: Segmentation Fault (SDL Parachute Deployed)

The message is quite confusing as it does not describe the problem itself.

The real problem is, that in function buildMapList() in file init.c the line
filelist = PHYSFS_enumerateFiles("");
has to be correct to
filelist = PHYSFS_enumerateFiles("wrf");
so the wrf files below data are enumerated by PhysFS.

The old function failes with an segfault and the ErrorHandler of SDL is called.
This results to the confusing error message above.


Greetings & and many thanks for the Linux Port.
Blaubaer
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Failing to load the wrf files

Post by DevUrandom »

That "confusing error message" tells you that some kind of wrong memory access happened. ;) (That's what is usually refered to as a segfault.)

Which version are you using? 2.0.5_rc1 or the current svn trunk?

Warzone is searching for information from mappacks in that function. This info comes in *.addon.lev files in the root of these mappacks. That would mean that the files are found to be in "" or "/" (means the same to PhysFS), but never in "wrf" or "/wrf"...

I guess this error must be something different than just a forgotten directory name.
My guess would be that filelist is NULL and trying to dereference it in *file gives the segfault. Interesting would why it is NULL...
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Re: Failing to load the wrf files

Post by Blaubaer »

Yes, sure  :) The problem is to identify the wrong mem access.

Currently I'm trying to figure out where this memory access happens.
But I also believe it is happening in the physfs library.

I've tried "" and "/" and then again it crashes as described.

Well, I installed the game on a friends machine having a Debian
Gnu/Linux 3.1 running. I expected the same things as on my
system (Open SuSE 10.1). Finally I checked on my second
machine having a Ubuntu 6.06 installed. Same behaviour here.

The graphic adapters on these systems are ATI 1600, a NVidia
Gefore 4 and a modern NVida card (I don't it currently).

Which files is the buildMapList() function enumerating for you?
For me the list is empty! So it would be interesting to know
what should go on there.

Greetings
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Re: Failing to load the wrf files

Post by Blaubaer »

Well I'm getting senile  :D

I use the latest version 2.0.5 RC1

Btw.: Do you still search contributers?
In case you could write me a private message.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Failing to load the wrf files

Post by DevUrandom »

Sure we want contributions!

The buildMapList function is to get the list of maps. Basically it hands over some names of .lev files to loadLevFile, which then extracts the map info from that files.
The filelist is used for user installed mappacks (in maps/: eg. in ~/.warzone2100/maps/ or /usr/share/warzone2100/maps/ and others). This mappacks (all are .wz files) are mounted into the applications local root ("/") directory (all through the PhysFS filesystem layer). Therefore all *.addon.lev files of the mappacks are lying in "/". The filelist should include all files in "/", which should be many (not just the .addon.lev files). In the forloop of buildMapList() the files ending in .addon.lev are searched and passed to loadLevFile, which then extracts the mapinfo from it.

PS: Could you debug your crash in gdb? An examination of where the crash exactly happens (line), and the values of the variables would be usefull. (-> bt full)
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Re: Failing to load the wrf files

Post by Blaubaer »

Ok, here ist what gdb says:

Starting program: /usr/local/bin/warzone2100
[Thread debugging using libthread_db enabled]
[New Thread -1215768912 (LWP 8075)]
error:      Registry file config is empty!
Enumerating files

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1215768912 (LWP 8075)]
0xb7c0c8f8 in strcmp () from /lib/libc.so.6
(gdb) backtrace
#0  0xb7c0c8f8 in strcmp () from /lib/libc.so.6
#1  0xb7f8ce27 in enumFilesCallback (data=0xbfe36074,
    str=0xbfe35f70 "addon.lev") at physfs.c:1468
#2  0xb7f95393 in doEnumCallback (cb=0xb7f8cdc0 ,
    callbackdata=0xbfe36074, str=, ln=9) at zip.c:1190
#3  0xb7f95495 in ZIP_enumerateFiles (opaque=0x888f608, dname=0xbfe36020 "",
    omitSymLinks=0, cb=0xb7f8cdc0 , callbackdata=0xbfe36074)
    at zip.c:1224
#4  0xb7f8eb76 in PHYSFS_enumerateFilesCallback (_fname=0x8173609 "",
    callback=0xb7f8cdc0 , data=0xbfe36074) at physfs.c:1576
#5  0xb7f8ebfb in PHYSFS_enumerateFiles (path=0x8173609 "") at physfs.c:1539
#6  0x0809083c in buildMapList () at init.c:953
#7  0x08090985 in systemInitialise () at init.c:999
#8  0x080a538a in main (argc=1, argv=0xbfe36304) at main.c:531

So the error happens finally in the physfs library. Currently I'm looking what is happening there.

But interesting is the fact, that after one successfull start (with my change) I can redo everything
and use the orginal function call. It can be reproduced by simply erasing the complete
directory structure of .warzone2100.

And because of the contributions: I've done some changes for AI (as it is my job to do
such things ;) ). If I consider them stable, it would be quite interesting to know what you're
thinking about them.

Greetings
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Failing to load the wrf files

Post by Watermelon »

Blaubaer wrote: And because of the contributions: I've done some changes for AI (as it is my job to do
such things ;) ). If I consider them stable, it would be quite interesting to know what you're
thinking about them.

Greetings
Just curious,what have you changed for AI?I just made some heavy modification to droid struct property 'psTarget' and 'psActionTarget' in my local copy of svn source,they are array now(from 'BASE_OBJECT psTarget' to 'BASE_OBJECT psTarget[DROID_MAXWEAPS]' and 'BASE_OBJECT psActionTarget' to 'BASE_OBJECT psActionTarget[DROID_MAXWEAPS]' etc),so I doubt there will serious conflicts when applying your upcoming patch with my changes.
tasks postponed until the trunk is relatively stable again.
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Re: Failing to load the wrf files

Post by Blaubaer »

Hi watermelon

I'm trying to fix some wrong handled situations (in my opinion wrong handled!).

An example:

You have some build tanks and they are attacked by some real offensive tanks.
If you then begin to build a defensive structure like a bunker or you even have
established them, the offensive tanks would always attack the bunkers, not
the build tanks which consequently can repair those bunkers or turrets. So in
my opinion a better solution to first destroy the tanks and afterwards attack
the structures.
This is an situation you often experience in case you are rushing.

Another problem in my opinion is the fact, that the AI uses too less vtols if it uses
them for vtol attacks on enemy bases. So they are no really efficient. It's better to build
some of them (lets say 15-20) and then attack the base, as to build only 5 and then
begin the attack.

A third thing I'm currently tracking is the problem of building structures set to close
to another so they are preventing the AI to send out their tanks. This is something
I've seen for example on maps like HighGround.

Their are a few other minor issues, however these 3 things I'm currently working
on.

What do you think? Does it make sense to change the AI behavior the I described it?


And to finally answer your question  ;D : Yes, your additions will be surely compatible
to the things I've done.

Greetings.
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Re: Failing to load the wrf files

Post by Blaubaer »

Ok I've got a solution:

I've used (as it has been installed by default ;) ) the latest development version
of physfs (1.1). Well it has a mistake in its header which occured on compiling
it. I thought I fixed it, but obviously I only deferred the error. So the most simple
solution is to use the latest stable version 1.0.1. Then everything is doing fine.

Btw.: Where do I need to copy the wdg files of downloaded maps. If I simply
copy them to the ~/.warzone/multiplay/custonmaps (or something like that) they
are not found.

@watermelon?
What is your idea doing? Can your droids attack multiple targets?

Greetings
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Failing to load the wrf files

Post by lav_coyote25 »

.wdg maps can NOT be used with any of the new releases.


look here for a new map of thepit2006...

also look here for how to do the map folder.
‎"to prepare for disaster is to invite it, to not prepare for disaster is a fools choice" -me (kim-lav_coyote25-metcalfe) - it used to be attributed to unknown - but adding the last bit , it now makes sense.
User avatar
Watermelon
Code contributor
Code contributor
Posts: 551
Joined: 08 Oct 2006, 09:37

Re: Failing to load the wrf files

Post by Watermelon »

Blaubaer wrote: Hi watermelon

I'm trying to fix some wrong handled situations (in my opinion wrong handled!).

An example:

You have some build tanks and they are attacked by some real offensive tanks.
If you then begin to build a defensive structure like a bunker or you even have
established them, the offensive tanks would always attack the bunkers, not
the build tanks which consequently can repair those bunkers or turrets. So in
my opinion a better solution to first destroy the tanks and afterwards attack
the structures.
This is an situation you often experience in case you are rushing.
I think Troman added some target 'weight' system in SVN to select the best target for droid's current weapon and ignore half-built strutures.
Another problem in my opinion is the fact, that the AI uses too less vtols if it uses
them for vtol attacks on enemy bases. So they are no really efficient. It's better to build
some of them (lets say 15-20) and then attack the base, as to build only 5 and then
begin the attack.
I never use vtol in skirmish tbh,because of their uselessness with most weapons...
A third thing I'm currently tracking is the problem of building structures set to close
to another so they are preventing the AI to send out their tanks. This is something
I've seen for example on maps like HighGround.
dont know,i think building placement is handled by .slo .vlo scripts?the AI always builds certain buildings at some fixed position it seems to me.
Their are a few other minor issues, however these 3 things I'm currently working
on.

What do you think? Does it make sense to change the AI behavior the I described it?


And to finally answer your question  ;D : Yes, your additions will be surely compatible
to the things I've done.

Greetings.
I am not very familiar with the skirmish scripts,think Troman is re-doing the skirmish AI stuff,maybe you should ask him for his opinions on your changes/additions and to avoid doing duplicated works.
@watermelon?
What is your idea doing? Can your droids attack multiple targets?
not yet,still dunno how to make them attack multiple targets with one 'DACTION'.
tasks postponed until the trunk is relatively stable again.
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Failing to load the wrf files

Post by DevUrandom »

physfs-1.1: I expected something like that when I looked at the backtrace. Fine you fixed it. :)

AI: Your ideas sound sensible. You best hook in with Troman and talk with him about AI, as he is our expert for scripting and AI.

maps: As Kim said: You can't use old .wdg files with any of the 2.x releases, because the fileformat changed. (From the old custom .wdg to the new, easier to handle .wz zip files.)
You can get a great bunch of the old maps in the map_pack Rodzilla once assembled. It is to be found at http://wz2100.net/files/maps/map_pack.wz (make sure you use r-click->download and don't open it in place. Seems like the server confuses the mime-type. :( )
Blaubaer
Greenhorn
Posts: 9
Joined: 16 Nov 2006, 23:44

Re: Failing to load the wrf files

Post by Blaubaer »

Hi all,

Well, I finally got the maps running.

@lav_coyote25: I'm using the Linux version, so I've got a different directory structure here.
Your guide is only for the Windows version, isn't it?

@DevUrandom:
So I replaced the original warzone.wz file by the one I downloaded. Now I've got all the
maps I ever wanted  :) , however: Is it the way it should be done or is only luck, it is working?
Troman
Trained
Trained
Posts: 424
Joined: 12 Aug 2006, 15:40
Contact:

Re: Failing to load the wrf files

Post by Troman »

Blaubaer wrote: You have some build tanks and they are attacked by some real offensive tanks.
If you then begin to build a defensive structure like a bunker or you even have
established them, the offensive tanks would always attack the bunkers, not
the build tanks which consequently can repair those bunkers or turrets. So in
my opinion a better solution to first destroy the tanks and afterwards attack
the structures.
Droids will now pick targets more carefully, with half-built structures having low priority while trucks on the other hand get a higher priority.
Blaubaer wrote: Another problem in my opinion is the fact, that the AI uses too less vtols if it uses
them for vtol attacks on enemy bases. So they are no really efficient. It's better to build
some of them (lets say 15-20) and then attack the base, as to build only 5 and then
begin the attack.
You have to modify playerX.slo files to change this behaviour.
I have plans on giving 8 (since there are max 8 players in the game) 1.10 AIs some personal touch, they should differ a bit from each other. One (or more than one) of the personalities could be a VTOLs user, while other will probably not like VTOLs as much.
Blaubaer wrote: A third thing I'm currently tracking is the problem of building structures set to close
to another so they are preventing the AI to send out their tanks. This is something
I've seen for example on maps like HighGround.
This is not really a big problem, although it does happen sporadically. It seems like WZ's obstacle avoidance is not perfect but there's no elegant way to fix it with scripts. One thing you can do is to test if some location is clear enough for a big structure (like a factory) before trying to build a smaller structure on that spot (like a hardpoint), but that's an ugly way around.
Blaubaer wrote: Their are a few other minor issues, however these 3 things I'm currently working
on.

What do you think? Does it make sense to change the AI behavior the I described it?
Having an 'aviator' 1.10 AI personality would be nice, it would make skirmish games more fun and less predictable. I don't think it is a good idea to make all 8 1.10 personalities put more stress on VTOLs, it would weaken them, you can't have all technologies at the same time. Some can prefer arty, some direct weapons etc.

The only constrain I think we should set for ourselves is that personalities of the same AI (like 1.10 which is used now) should not differ way too much from each other, they should only have certain preferences. If we want AI to have a totally different behaviour pattern it would make more sense to introduce a brand new AI.

I don't know if first issue is now obsolete for you and whether you have a way of fixing the third one.
Sign Up for Beta-Testing:
?topic=1617.0
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Failing to load the wrf files

Post by DevUrandom »

Would be cool if you two could get together to work on this. :) (Forums, mail, IRC, whatever...) Would be bad to loose "workers", because one thinks that the other one is already working on it and that they shouldn't work on it concurrently...

Blaubär: I think what you did is just working by accident... (It really shouldn't.)
You _always_ need the warzone.wz and the mp.wz, but can have additional files with enhancements.
If you delete the original warzone.wz and rename eg the map_pack.wz to warzone.wz to replace it, it should _not_ work. Maybe Warzone is accessing another warzone.wz you have installed somewhere in your system.

I wrote somewhere how this system works, but can't find it anymore, so I'll explain it again...

We have to differ between general locations where Warzone searches and subdirectories of those, where Warzone searches for specific information.

General locations (in order):
1. runtime supplied datadir (eg. ./warzone2100 --datadir /my/custom/path)
2. User/Home directory (eg. /home/me/.warzone2100 or C:\DokumentsAndSettings\me\MyFiles\Warzone2100)
3. data/ subdir (usually for svn environments, eg. /home/me/wzsvn/data, when the exe/bin is in /home/me/wzsvn/src, this depends on the location of the _exe_ and not on your workingdir!)
4. PREFIX/share/warzone2100 (again depending on the location of the exe, eg. /foo/share/warzone2100 if the exe is /foo/bin/warzone2100)
5. Same directory as the exe is in (mostly for Windows envs, eg. /opt/warzone2100 if the exe is /opt/warzone2100/warzone2100.bin or C:\ProgramFiles\Warzone2100)
6. Default data directory supplied on compilation or /usr/share/warzone2100 as last fallback.

Special subdirs:
- maps/ for custom maps (all files/directories inside, eg. maps/map_pack.wz or maps/map_pack)
- mods/global for multiplay and singleplay mods (eg texturepacks)
- mods/multiplay
- mods/campaign

Yes, this is a bit complicated, especially the subdirs. I hope to improve it for 2.1...

PS: This should really go to the wiki, if it isn't there already. Maybe I find time for it on the weekend, but probably not. *hint; thanks!*
Locked