Build IVAN with Visual Studio 2017 ?

Mar 3, 3:05 am
#1
Joined: Nov 29, 2009
Posts: 51
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, 4:59 am
#2
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,092
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
Mar 3, 11:24 pm
#3
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,092
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??
Mar 4, 1:51 am
#4
Joined: Nov 29, 2009
Posts: 51
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, 10:41 pm
#5
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,092
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.
Jump to