Qestion about Coding-Setup

For code related discussions and questions
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Qestion about Coding-Setup

Post by Puhdoo »

Hello,

regarding a mod for Warzone2100 2.3.9 I'm currently working on, I need some help with the coding setup...

I'm on a Windows 7 64bit machine and have already installed flex&bison, Visual Studio C++ Express 2010.
I downloaded the sourcecode from https://warzone2100.svn.sourceforge.net ... nches/2.3/,
should be correct to mod v2.3.9 I hope?

In the compileguide (http://developer.wz2100.net/wiki/Compil ... ndows/MSVC) under 'Prerequesites'
it says I must download the 'Latest Warzone Developer's Package' with a link given.
I scanned through the directories there but couldn't find a Developers Package, now I'm not sure what exactly that
package contains and where to find it.

Thanks and Regards,
Puhdoo
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

Re: Qestion about Coding-Setup

Post by Berg »

If you going to make mods might be best to get the latest version they are testing 3.1 now and it has a good deal more features then the old stable http://developer.wz2100.net/wiki/Download
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

mmh actually I'd like to create my mod for 2.3.9 because this is the version which I know from playing the game...
so it's much easier to see when I made sth buggy etc

And in case I'm able to finish the mod, I could still try to adjust it for 3.x later.

So where do I find that devpkg? :wink:
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Qestion about Coding-Setup

Post by NoQ »

You don't need to compile the game from source to be able to make a mod.
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

I know that it's possible e.g. to insert a new body into the game without compiling from source, I did so already with making the pie-model, a basic texture, editing the txt-files etc...

but for the changes/features I'd like to implement it's necessary to do some source-code modifications/extensions :ninja:
Therefore it would be very helpful to get the latest devpkg with the libs etc, and I couldn't find it on that sourceforge-link
given in the compilation-guide.

So if anyone knows where to get it, please tell me - thanks in advance!
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

http://developer.wz2100.net/attachment/ ... 102705.rar

here's a devpkg with many libraries already included, just in case someone else needs that too.
Was already half around the planet with grabbing files from everywhere on the internet :shock:
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

1>------ Build started: Project: Warzone2100, Configuration: Debug Win32 ------
1> Revision unchanged (11744). Skipping.
1> old = "11744M"; new = "11744M"
1> Generating parser based on grammar...
1> Generating parser based on grammar...
1> Generating lexical analyser...
1> Generating lexical analyser...
1> Generating lexical analyser...
1> scriptvals_parser.tab.c
1>c1 : fatal error C1083: Cannot open source file: '..\src\scriptvals_parser.tab.c': No such file or directory
1> scriptvals_lexer.lex.c
1>c1 : fatal error C1083: Cannot open source file: '..\src\scriptvals_lexer.lex.c': No such file or directory
1> message_parser.tab.c
1>c1 : fatal error C1083: Cannot open source file: '..\src\message_parser.tab.c': No such file or directory
1> message_lexer.lex.c
1>c1 : fatal error C1083: Cannot open source file: '..\src\message_lexer.lex.c': No such file or directory
1> level_lexer.lex.c
1>c1 : fatal error C1083: Cannot open source file: '..\src\level_lexer.lex.c': No such file or directory
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 12 up-to-date, 0 skipped ==========

I found those files in the ..\src directory with endings .l (.lex.c) and .y (.tab.c). So I tried it with just renaming them,
but that would have been to easy XD
bison and flex I now have in a folder without any spaces in the pathname, and that directory is mentioned in my "Path" environment-variable.

Does anyone have an idea what is wrong with my setup?
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

1>Using "BisonParser" task from the task factory "XamlTaskFactory".
1>Task "BisonParser"
1> cmd.exe /C "C:\Users\Dave\AppData\Local\Temp\f243cdd463b146a997779ce17ad4a6f1.cmd"
1> bison.exe -d -l -b message_parser -o C:\Users\Dave\Desktop\wzproj\win32\..\src\Warzone2100.tab.c -p message_parser ..\src\message_parser.y
1>
1> C:\Users\Dave\Desktop\wzproj\win32>bison.exe -d -l -b message_parser -o C:\Users\Dave\Desktop\wzproj\win32\..\src\Warzone2100.tab.c -p message_parser ..\src\message_parser.y
1> bison.exe: kann Datei ä..\src\message_parser.yô nicht ÷ffnen: No such file or directory
1>C:\Users\Dave\Desktop\wzproj\devpkg\FlexBison.targets(136,5): error MSB3721: The command "bison.exe -d -l -b message_parser -o C:\Users\Dave\Desktop\wzproj\win32\..\src\Warzone2100.tab.c -p message_parser ..\src\message_parser.y" exited with code 1.
1>Done executing task "BisonParser" -- FAILED.
1>Done building target "_BisonParser" in project "Warzone2100.vcxproj" -- FAILED.

This is what I get when having the files renamed to lex.c/tab.c respectively.
Then it doesn't find the .y file and fails. I never used bison before, so could anyone point me the right direction please? :|

(I had bison 2.4.1 before and now switched to 2.1 regarding another forum-post, but that didn't solve the problem)
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

I found out that those .l and .y files from the /src folder...

- level_lexer.l
- message_lexer.l / message_parser.y
- scriptvals_lexer.l / scriptvals_parser.y

...are not flex&bisoned into corresponding lex.c/tab.c/tab.h files
because they alltogether form the Warzone2100.lex.c, Warzone2100.tab.c and Warzone2100.tab.h files instead.
The compiler expects to get level_lexer.lex.c, message_lexer.lex.c, etc. :?

My flex&bison works fine now (probably), as there are other such files (e.g. /lib/script/chat_lexer.l) which correctly produce
and reproduce the lex.c's etc. during the build.

Do I need to direct the compiler on those Warzone2100-files?
Or should I change sth so that flex&bison create level_lexer.lex.c etc.?

Anyway I will investigate this further, but if anyone knows about that, help is very welcome
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: Qestion about Coding-Setup

Post by Andrie »

Where did you get Flex&Bison?
"My IRC en multiplay naam is Andrie"

Groete Andrie
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

I followed the links in the compile-guide (http://developer.wz2100.net/wiki/Compil ... ndows/MSVC)
look under 'Prerequesites'
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: Qestion about Coding-Setup

Post by Andrie »

The flex and bison links don't work.
"My IRC en multiplay naam is Andrie"

Groete Andrie
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

For me they work O_o , you should be directed to sourceforge.
If you are not on a windows machine you should check for links in other compile guides.
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: Qestion about Coding-Setup

Post by Andrie »

When I want to open this it says

Google Chrome Says:

No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.

Internet Explorer Says:

Internet Explorer cannot display the webpage
What you can try:
Diagnose Connection Problems
More information
This problem can be caused by a variety of issues, including:
•Internet connectivity has been lost.
•The website is temporarily unavailable.
•The Domain Name Server (DNS) is not reachable.
•The Domain Name Server (DNS) does not have a listing for the website's domain.
•There might be a typing error in the address.
•If this is an HTTPS (secure) address, click Tools, click Internet Options, click Advanced, and check to be sure the SSL and TLS protocols are enabled under the security section.
For offline users
You can still view subscribed feeds and some recently viewed webpages.
To view subscribed feeds:
1.Click the Favorites button , click Feeds, and then click the feed you want to view.
To view recently visited webpages (might not work on all pages):
1.Press Alt, click File, and then click Work Offline.
2.Click the Favorites button , click History, and then click the page you want to view.
:stressed: :stressed:
"My IRC en multiplay naam is Andrie"

Groete Andrie
Puhdoo
Trained
Trained
Posts: 45
Joined: 20 Sep 2009, 17:54

Re: Qestion about Coding-Setup

Post by Puhdoo »

Finally my build works :) ,
so here's what I had to change in order to get it through (in Debug Configuration):


(With the "sourcecode"-directory I refer to the folder where I downloaded the Warzone2100-sourcecode from the repo into,
the "Property Pages" in VS2010 you can open under the "Project"-Tab --> "Warzone2100 Properties")

1. Compile-Stage
- Property Pages --> Bison Parser --> Output file name
Change "$(SolutionDir)..\src\$(ProjectName).tab.c" to "$(SolutionDir)..\src\%(Filename).tab.c"
- Property Pages --> Flex Generator --> Output File
Change "$(ProjectDir)..\src\$(ProjectName).lex.c" to "$(ProjectDir)..\src\%(Filename).lex.c"

Maybe you need to remove the following files from your sourcecode-folder:
- Warzone2100.lex.c, Warzone2100.tab.c, Warzone2100.tab.h in \src
- cl.command.1.tlog, CL.read.1.tlog, CL.write.1.tlog, Warzone2100.write.1.tlog in \win32\Debug

2. Link Stage
I had to rename some library-files.

Property Pages --> Linker --> Input --> Additional Dependencies
"libpng-static.lib" to "libpng_static.lib"
"ogg_static.lib" to "libogg_static.lib"
"vorbis_static.lib" to "libvorbis_static.lib"
"vorbisfile_static.lib" to "libvorbisfile_static.lib"
"physfs.lib" to "physfs_static.lib"
"zlib.lib" to "zlib_static.lib"

(It should also work to rename the files in your lib folder instead)

3. After Build

At the end of the build process it might fail to copy "Warzone2100.exe" from win32\Debug to \data.
This is just because the file is named "Warzone2100-Dbg.exe" (probably only in Debug Configuration),
so you have to copy this manually, or rename the file and build twice.

EDIT --> you can change the Output name in Project Properties to "Warzone2100.exe" as well

Go to "sourcecode\data" and run "Warzone2100.exe", it might take a while until the game starts, but in TaskManager you should already see the process running.


Regards,
Puhdoo
Last edited by Puhdoo on 26 Aug 2012, 03:27, edited 1 time in total.
Post Reply