Build IVAN with Visual Studio 2017 ?

Mar 3, 2019, 3:05 am
#1
Joined: Nov 29, 2009
Posts: 61
Hello!

Would somebody consider giving me some hints as to how one would build IVAN with VS2017 ?

I started with c++ about a year ago and make small projects such as these to improve my skills in programming:
https://www.youtube.com/watch?v=ZIwaRNmZJdo (read video description for project details)

While maybe my grasp on game loops, and design patterns got a bit better, I'm still lagging behind when it comes to actually building a project - I'm very anxious to make this work on the IDE I use and so I'd be really, really grateful if somebody would lend me a hand with this !

EDIT: I forgot to also ask this: would making the source code work on VS 2017, somehow brake "stuff" ?, like generate bugs where there wouldn't be in the first place?
Mar 3, 2019, 4:59 am
#2
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
Hey RustKnight, I've been thinking about this and I vaguely remember that either or both of the 0.50 source or CVS source has an msvc project packaged with them, which you could try opening. I don't know if they are live but if so, they could be good starting points.

Another strategy could be to start with the CVS source since it only relies on SDL, which should be straightforward to set up.

The community version on GitHub uses CMake to prepare makefiles. I wonder if it can produce makefiles for Visual Studio?

These are all just guesses at the moment, I'll need some more time to search around for answers, I'll have a look early tomorrow.

EDIT: in answer to your question, no it won't break stuff. If VS is configured correctly and has all the right dependencies, then it should compile no problems. Getting there will most likely not be trivial, but it won't be impossible
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Mar 3, 2019, 11:24 pm
#3
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
Hey RustKnight, you're in luck! I have been tooling around with Visual Studio Express 2013 for Windows Desktop (available here in m$ "hard-to-find" section): https://visualstudio.microsoft.com/vs/older-downloads/

I used the "Concurrent Version System" version of IVAN, purported to be the last version the original devs worked on, linked here: https://attnam.com/projects/official/IVAN-CVS
Download the source, which is ivan-cvs.tar.gz (you can unzip this using 7zip). I unzipped it somewhere with a handy folder name like C:\ivan-cvs

Then I downloaded SDL 1.2 (not SDL 2.x) from here: https://www.libsdl.org/download-1.2.php
I downloaded the SDL-devel-1.2.15-VC.zip for Visual C++. I unzipped this folder into C:\ivan-cvs and re-named it just "SDL" (so now I have a folder located here: C:\ivan-cvs\SDL

Next I opened the IVAN.dsw (found in C:\ivan-cvs) with Microsoft Visual Studio Click OK and it does the conversion step automatically, it will say it's no longer backward-compatible but you can ignore this.

IMPORTANT STEP: Once in Visual Studio, my very first step is to change the "Solution Configuration" in the drop-down menu to "Release"

Next I followed the incredibly well written SDL setup steps from https://thenumbat.github.io/cpp-course/sdl2/01/vsSetup.html
These steps are the same for SDL1.2 as they are for SDL2.0, except you should use SDL where they write SDL2 etc
Other changes were: I used absolute paths for the location of SDL, both the header files (where SDL.h is found) and the library files (where SDL.lib and SDLmain.lib are found)
IVAN is a little bit different in that the "Main" project (ivan.exe) is dependant on "FeLib" (a.k.a. the "Fatal Error" library - the original devs' custom C++ library). Simply follow the same configuration steps to both Main and FeLib. For instance, for FeLib, the Additional Dependencies can be found under "Configuration Properties- > Librarian -> General" and you can add

C:\IVAN-cvs\SDL\lib\x86\SDL.lib
C:\IVAN-cvs\SDL\lib\x86\SDLmain.lib

(This contrasts with Main, where this is done under "Configuration Properties- > Linker -> Input", as per the instructions in the SDL setup guide I linked).

You can press F7 now to build, but you will get errors. I made them go away by doing the following:

1. Added _USE_32BIT_TIME_T to "Preprocessor Definitions" which I found under Alt-F7 "Configuration properties -> C/C++ -> Preprocessor"
2. Added WIN32 and _WIN32 to Preprocessor Definitions (this seemed not ti fix anything, but I did this for superstition)
3. Replaced #include "afxres.h" with #include "windows.h" in Ivan.rc (seemed to overcome the "afxres.h not found" error, thanks to this answer here: https://stackoverflow.com/questions/3566018/cannot-open-incl...)
4. I used absolute paths for SDL.lib and SDLmain.lib, like so:
C:\IVAN-cvs\SDL\lib\x86\SDL.lib
C:\IVAN-cvs\SDL\lib\x86\SDLmain.lib

Then I pressed F7 to compile and build. It magically builds IVAN.exe located at C:\IVAN-cvs. If you click on it to run, you will get another error saying SDL.dll not found. Copy SDL.dll from C:\IVAN-cvs\SDL\lib\x86 to the folder where IVAN.exe is and then open IVAN again. It will run the game.

Please let me know if you get stuck and I will see what I can do to help. If you're unsure about my VS configs, I can post screenshots if you like

Corollary: I wonder if Appveyor does Visual Studio builds in the cloud??
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Mar 4, 2019, 1:51 am
#4
Joined: Nov 29, 2009
Posts: 61
Wow!!
Thank you for all the richly described instructions Fejoa!
I'm sure now with all that help, I will be able to make it run - I'll start tinkering on the game source. If after some months I become more comfortable with the source code and understand it's architecture, I'll for sure tag along on Github and help out with bugfixes where I can.

Speaking of architecture - I can clearly see it's object orientated, but does it uses any Design Pattern consecrated in the gang of four ? How would you describe the game engine ? Tidy, logical, neat ? Has a good structure in the big picture ?

I imagine, given with such a huge numbers of features and mechanisms interacting with each other, that one would simply NEED to have a good structured game engine to properly scale the complexity and numbers of features.

Anyway Fejoa thank you very much for time you spent on the post, and thank you for believing me This will prove invaluable in my self-learning programming journey! I'll post a reply here saying how it went with VS. (I'm sure trying it out with VS2017, shouldn't be a problem).

PS: yes, I'm actually fine with just using the last version of the original DEVs - this version and the latest github version, I would imagine they aren't that different architecture/codewise ?
Mar 4, 2019, 10:41 pm
#5
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
While tooling around with the configs a bit more, I figured you can set relative paths in VS Express 2013 like this:

$(ProjectDir)SDL\lib\x86\SDL.lib
$(ProjectDir)SDL\lib\x86\SDLmain.lib

So no need for those absolute paths I mentioned earlier. I think VS 2017 will allow you to evaluate the expression in a window below so you can check the result is what you expect.
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Mar 27, 2019, 2:10 am
#6
Joined: Nov 29, 2009
Posts: 61
So I managed to get to the final steps - added libraries and all, and everything seems to go long nicely.
The only 2 errors that still persist are the ones you see in the screenshot. Any ideas why I hit them ?
Mar 27, 2019, 2:28 am
#7
Joined: Nov 29, 2009
Posts: 61
Hm - actually there seems to be errors also in the source files of IVAN - they seem to be missing some includes....
Mar 28, 2019, 6:30 pm
#8
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
Let's try fix the first thing first. I actually remember seeing this error, but I don't remember how the hell I fixed it. The message about '>>' operators might be related to the size of int64 a la: https://support.microsoft.com/en-nz/help/168440/you-may-rece...
You need to tell Visual Studio the whole code needs to be handled as 32 bit.

Did you follow these steps?

Quote
1. Added _USE_32BIT_TIME_T to "Preprocessor Definitions" which I found under Alt-F7 "Configuration properties -> C/C++ -> Preprocessor"
2. Added WIN32 and _WIN32 to Preprocessor Definitions (this seemed not ti fix anything, but I did this for superstition)

It could be that step 2 helped me overcome the compile error after all. Here are my settings:

Under preprocessor definitions (Configuration->C/C++->Preprocessor) for Main, I have:

NDEBUG;USE_SDL;WIN32;_WINDOWS;VC;WIZARD;_WIN32;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)

and for FeLib, I have:
NDEBUG;USE_SDL;WIN32;_WINDOWS;VC;_WIN32;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)

Have a look in the attached pictures. Let me know if it helps or not
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Jun 6, 2019, 11:49 pm
#9
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
Some work has recently been done by someone on this: https://github.com/Attnam/ivan/pull/559
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Jul 19, 2020, 6:24 am
#10
Joined: Jul 13, 2020
Occupation: Hardware engineer
Location: Belgrade, Serbia
Interests: All
Posts: 14
I report that I have successfully built IVAN using Visual Studio 2017 by following the instructions from INSTALL. Everything was very clear and worked without any problems. Well written manual!
Jul 31, 2020, 3:58 am
#11
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
Vladivarius wrote
I report that I have successfully built IVAN using Visual Studio 2017 by following the instructions from INSTALL. Everything was very clear and worked without any problems. Well written manual!

Thanks. It's great to hear people can just pick up the codebase and compile straight away, based on the humble install instructions we have. I think it gives us the chance to collect more developers.
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Aug 17, 2022, 12:50 am
#12
Joined: Apr 2, 2014
Occupation: Navastating
Location: Aslona
Posts: 773
So I've finally decided to give Visual Studio a try. Instructions in INSTALL work like a charm, thanks!

Only thing to note, if you have VS other than 2017, change the generator in CMakeSettings.json on line 5 to something appropriate.

Also at least for me, no support files were copied to the build location, so before you can launch your game, you have to manually copy Graphics, Music, Script and Sound folders.
Aug 20, 2022, 7:22 am
#13
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
Heh, awesome thanks.
Have you noticed that running the MSVC executable of IVAN feels silky smooth? Like there’s less jank. Such a weird sensation.
Yeah if you can think of improvements to the install step, then feel free to add them.
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Jump to