With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: sparcdr, torhu, Tequila

Windows build from VC++ (SG 1.0)

Postby ToyBox » Sat Jul 04, 2009 7:10 am

Hi everyone,

I am running into problems with getting smokinguns working properly in Windows after successfully compiling from Visual C++ using the SG trunk.

I checked out the SG trunk, and compiled it in VC++ with no problem. However, when I tried to run the resulting smokinguns.exe, it says default.cfg is missing. I had to manually create a smokinguns folder with default.cfg from the precompiled SG package for it to actually start. Even after it starts, the game will error out unless I have all the pk3 from the precompiled SG in the same directory.

Without having the precompiled SG packages, is there a way to build the game solely from source?

So right now, I can run my compiled copy of SG in the Release/ by having the smokinguns/ from the precompiled SG in Release/. Then, I went about and try to get team force model to work for multiple models and not just default model, and my changes did not do anything! So, to test my own sanity, I tried running smokinguns.exe without the dlls that got compiled with it, and it worked?!?!

I am guessing I am doing something wrong, such that the dlls are not doing anything to smokinguns.exe

Too long didn't read version:
Q1) Given that compilation is successful, I shouldn't need anything else to get smokinguns working, right?
Q2) The manually compiled version of smokinguns should interact with the compiled dlls (i.e., cgamex86.dll, qagamex86.dll), right? So, without those dlls, smokinguns should not work...right?


I really want to get involved with helping out in developing SG, so any help on this would be greatly appreciated!
ToyBox
Newcomer
 
Posts: 2
Joined: Fri Jul 03, 2009 11:11 pm



Re: Windows build from VC++ (SG 1.0)

Postby Tequila » Sat Jul 04, 2009 11:10 am

ToyBox wrote:Hi everyone,

I am running into problems with getting smokinguns working properly in Windows after successfully compiling from Visual C++ using the SG trunk.

I checked out the SG trunk, and compiled it in VC++ with no problem. However, when I tried to run the resulting smokinguns.exe, it says default.cfg is missing. I had to manually create a smokinguns folder with default.cfg from the precompiled SG package for it to actually start. Even after it starts, the game will error out unless I have all the pk3 from the precompiled SG in the same directory.

Without having the precompiled SG packages, is there a way to build the game solely from source?

So right now, I can run my compiled copy of SG in the Release/ by having the smokinguns/ from the precompiled SG in Release/. Then, I went about and try to get team force model to work for multiple models and not just default model, and my changes did not do anything! So, to test my own sanity, I tried running smokinguns.exe without the dlls that got compiled with it, and it worked?!?!

I am guessing I am doing something wrong, such that the dlls are not doing anything to smokinguns.exe

Too long didn't read version:
Q1) Given that compilation is successful, I shouldn't need anything else to get smokinguns working, right?
Q2) The manually compiled version of smokinguns should interact with the compiled dlls (i.e., cgamex86.dll, qagamex86.dll), right? So, without those dlls, smokinguns should not work...right?


I really want to get involved with helping out in developing SG, so any help on this would be greatly appreciated!

Hi & welcome ToyBox,

so you're trying to start the 1.0 game from the DLL.

You should know we won't support such tries unless you're trying to get some debugging availabilities. Why we won't ? Just because the game is not expected to start from DLLs. Using DLLs will only be authorized on local game or on unpure servers... and only one of my public servers has been set unpure for testing purpose and it is based on 1.1 game (it's the BETA something one).

You should also know the engine will start QVM game by default. And if you want to force the engine to start from the DLL game, you must add "+set sv_pure 0 +set vm_cgame 0 +set vm_game 0 +set vm_ui 0" on the game start command line. You can set them in a BAT if you're using windows build. Btw if you try to connect to a pure online server, the QVM game will be started... That's a Q3-engine feature.

Also to be sure, you'll always need the "baseq3" & "smokinguns" folder to start the game as they contain the game datas.

I think you have answers for Q1 & Q2 questions, but let us know in case I'm not clear enough ;)

Last point, as our team is very busy, we are focusing on 1.1 engine as it still contains many 1.0 bug fixes and still seems as stable as wanted... So you should also focus on 1.1 build ;)
Thanks in advance for your help
8)
User avatar
Tequila
SG Team
 
Posts: 1100
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Postby ToyBox » Sun Jul 05, 2009 9:46 am

Hi Tequila,

You mentioned that the engine starts QVMs by default. I found a buildvm.bat in the source code, and it uses q3asm to build cgame.qvm, qagame.qvm, ui.qvm, along with a bunch of .asm and .map. I am guessing the way to feed those in is by doing the +set that you mentioned before. But, how can I alter the QVM search path of the SG engine so it will load these QVMs, since the +set seems to be all boolean?

By the way, I was able to start smokinguns.exe with just smokinguns/ and without baseq3/. Is that suppose to happen?
ToyBox
Newcomer
 
Posts: 2
Joined: Fri Jul 03, 2009 11:11 pm



Postby /dev/random » Sun Jul 05, 2009 12:38 pm

The QVMs belong into vm/ inside your mod's path.
Either just create a plain folder with these files inside and use "sv_pure 0" or put them inside vm/ inside a pk3 and place this pk3 inside your mod's path.
If you wan't to use "smokinguns" as the mod, be sure your pk3's name is after "sg_pak0.pk3" in alphabet, so the original QVMs get overwritten with the ones from your pk3. If your mod's name is different, don't forget to "+set fs_game modname".

Please note that none of the methods above will work on online servers, unless they are unpure or have the same pk3 you're using.

You usually don't have to set any cvars to use QVMs.

P.S.: "Your request didn't go through" five times, that's annoing!
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Postby sparcdr » Sun Jul 05, 2009 4:30 pm

Make sure you use 1.0 trunk and not 1.1 branch. The release was based on r48 or so mixed with r25 sound files. It predates our openal backport so it uses DirectSound and depends on DirectX SDK on Windows.
sparcdr
SG Team
 
Posts: 334
Joined: Wed Jun 13, 2007 3:41 pm



Postby Lucky Bro » Mon Jul 06, 2009 10:56 am

ToyBox wrote:I really want to get involved with helping out in developing SG, so any help on this would be greatly appreciated!

Good day ToyBox,
I don't know much about Q3 engine, so keep this in mind, while you'll be reading the following :)
I'll share with you some of simpliest knowledge that helped me to start understand SG code.

The game parts
At first, there are two separate things when you have the game installed:
1. The game engine. Which is Tech3 (or Q3 engine in short). And which consists of four components:
1.1. Game Exutable. The smokinguns.exe file under Windows OS. This one is entry point for the whole game. It sends requests to Quake Virtual Machines (QVMs) and handles responses. Since on non-Windows platforms there are no .exe files, Tequila will be call it the Engine (keep this in mind when you'll be talking with him).
1.2. Game QVM (qagame.qvm). The file is stored inside smokinguns\sg_pak0.pk3 file in vm directory. This one handles server behaviour of the game.
1.3. Client Game QVM (cgame.qvm). The file stored inside the same package as previous file. This one is about client behaviour of the game.
1.4. User Interface (UI) QVM (ui.vm). The file stored inside the same package as previous file. This one is about everything you see in user interface.
2. The game other files. Everything you may found in your installed SG game folder. All packages, configuration files, installation routine, etc.

What am I building?
The source code under SVN is about first part (the game engine) only. You are able to build only the engine (1.*) of the game from SVN, but you won't start it without the second part.
With VC you may compile and build only the exutable (yeah, the 1.1. point).
So, after building the source code with VC you'll get the smokinguns.exe file.
The same source code is shared between QVMs.
To build QVM you'll need QVM compiler. Which is lcc. Latest version from original (vanilla) Quake3 source code is 3. The ioQuake team introduced the improved version which is 4.
SG 1.0 uses lcc version 3 to build QVMs. And SG 1.1 uses lcc version 4 to build QVMs.
lcc compiler is included into the game source code and could be rebuild (yeah, the source code of it is included into the game source code too).
lcc has few files to build the QVM:
lcc - the compiler (translates c code into assembler code speciefic for the compiler)
asm - linker for asm files. Will create QVM from asm files.
(yeah, it also have a few more files, but let not compilcate things).
To make the process of QVM compilation easier SG source code has bath file for such purpose: buildvm.bat (you may take a look inside it to understand how it compiles the QVMs).
After building with buildvm.bat (just by launching it) you'll get three VMs (1.1., 1.2, 1.3).

How am I testing my code?
After you built the source code you'll have four files:
Exutable (smokinguns.exe)
Three VMs (qagame.qvm, cgame.qvm, ui.qvm).
To have game working you'll need both game parts - the engine and all other files (yes, the 1.* and 2.).
If you don't want to mess with your vanilla SG game - just make a copy of whole folder (that won't affect your current game then).
Now, you may replace current smokinguns.exe with your new one. Or just rename new to something and put it near the original (like smokinguns_test_fix.exe). Or you may rename original .exe to something like Vanillasmokinguns.exe. It will be playable anyway.
And QVMs should be placed into quake package file. Yeah, the pk3 file.
The first thing to know about package file that it is zero comression zip file. Yeah, you can open it with any archiver you like (winrar can do it well).
The original QVMs are stored in smokinguns\sg_pak0.pk3 file. Inside that package under vm directory.
So, to test your fix you may just replace the original ones.
You may also create completely separate package for your new QVMs. To make it read by the exutable name it as sg_pak1.pk3.
Inside the package create vm directory and place all your new QVMs there.
Now you are able to test your code in game.

Short questions and aswers
Q. What are those DLLs for then?
A. For another way of holding/requesting functions. Windows already has dynamic linking - when what for those QVMs if we may just create a dynamic linking library and call it each time for required function?
MSVC solutions wich are stored inside SG source code have DLL projects. You may compile them and you'll get three dlls (with the same purpose as original QVMs). To use them - just place them to your SG folder and launch the game with some additional parameters (use the ones Tequila has written above).
Q. What is the pure and unpure server?
A. The pure server will allow to connect only the clients who have the same QVMs as the server has.
Q. What will happen if I'll connect to pure server and if I have unpure (modified) QVMs and exutable?
A. You may have any exutable. Current SG doesn't have any check for your exutables.
And in case of different QVMs the server won't allow you to do so.
Q. What will happen if I connect to unpure server and I have unpure (modified) QVMs?
A. You'll use the QVMs from the server. In other words, you'll download the servers QVMs and then game will use them instead of yours.
Q. How will I check my server behavior at home then?
A. Just by starting a local server. That it - just create a new multiplayer game.
Q. What differences do have 1.0 and 1.1 SG versions? Concerning source code/compilation/build.
A. Not many, but the are exist.
1.1 is about ioQuake backporting. So, you may apply almost every way to compile it like you'll do it with ioQuake. ioQuake has beuatiful guides about how to compile the code.
For example, check this (may be you'll need to register there first to be able to read it, but it is free, so do it - it worth it)one. This is about VC game compilation. Hope one day SG will have more coders and someone will create manual for dummies like me here too.
Other major point is directories structure. But you'll get used to it soon.
And not concerning code, but the testing stage - 1.1 SG has different place to store its configuration files. It is in your documents and settings directory in Application data. Be aware of that.
Q. The linux users just do the make command and then they have whole engine built. Is there any way to do so under windows?
A. No. But you may use some tools which will help you to emulate linux environment. Like MinGW. The SG 1.1 could be build with one make command with MinGW. You may use the same instruction as ioQuake has (in the same ioQuake forum, just other topic).

I hope I've given you at least one way to build your modified version of SG and then to check it before post patch here. I think that is enough to start coding/testing.
Don't hesitate to ask simple questions! These ones are the best ones. The better your start the better results you may achieve during the process ;)
I'm very glad to see a new coder here!

P.S. You may also read a topic somewhere around here wich is full of links to Quake3 engine coding guides.
But that is not so fun to do it alone.. and actually the community is about to help each other, isn't it? :)
Last edited by Lucky Bro on Mon Jul 06, 2009 6:48 pm, edited 1 time in total.
"You should know that the lies won't hide your flaws/No sense in hiding all of yours/You gave up on your dreams along the way" (c) "Fake it" by Seether
P.S. English isn't my native language.
User avatar
Lucky Bro
Gunslinger
 
Posts: 143
Joined: Mon Mar 09, 2009 4:12 pm



Postby /dev/random » Mon Jul 06, 2009 5:19 pm

Lucky Bro wrote:Q. What will happen if I connect to unpure server and I have unpure (modified) QVMs?
A. You'll use the QVMs from the server. In other words, you'll download the servers QVMs and then game will use them instead of yours.


I'm not quite certain about this. Afaik you can use any files on an unpure server, which includes the qvms of course. Thus, with unpure QVM on unpure server, your unpure QVM will be used and nothing will be downloaded.

Downloads will happen if server and client have download enabled and the client either has unpure or missing pk3s.

And as a last note, iirc the HUD is part of cgame, not ui.
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Postby Lucky Bro » Mon Jul 06, 2009 6:43 pm

/dev/random wrote:I'm not quite certain about this. Afaik you can use any files on an unpure server, which includes the qvms of course. Thus, with unpure QVM on unpure server, your unpure QVM will be used and nothing will be downloaded.
Downloads will happen if server and client have download enabled and the client either has unpure or missing pk3s.

I had an ui QVM with broken server list refreshing mechanizm maded by me. And I connected to unpure Tequila's 1.1 Beta server which has non-broken server list. After disconnecting from the server I had Tequila's fixed server list in my ui QVM until I left the game.
That is the expirience I had. I don't know well engine, so if you can say that the statement above is wrong - do it :) Since I'm not sure as well too.
/dev/random wrote:And as a last note, iirc the HUD is part of cgame, not ui.

I don't want to check it now (may be later - I have suspicion that it is part of UI.. I did something with it while was working with money system).. I've fixed it in previous message. Thank you!
"You should know that the lies won't hide your flaws/No sense in hiding all of yours/You gave up on your dreams along the way" (c) "Fake it" by Seether
P.S. English isn't my native language.
User avatar
Lucky Bro
Gunslinger
 
Posts: 143
Joined: Mon Mar 09, 2009 4:12 pm




Return to Code

Show Sidebar
Show Sidebar

User Control Panel

cron