Heroes 3 on mac os x

Hi there, I am a heroes 3 fan and a java / objective-c programmer ( i programmed 2 online tournaments in the early 2000 's : World Online Nation and WW Heroes:) ).

I looked for a native heroes 3 application for mac and I couldn’t find one.

During the last years I had tons of ideas on how to improve heroes 3 and this looks like a perfect project for me to participate in and to expand my c++ programming knowledge. Unfortunately I don’t have any wog experience, and I am pretty sure I cannot start heroes 3 on my mac. So if any of you will walk me through on how to get this project started on a Snow Leopard 10.6 I am sure I will be of some help to this community.

Thank you very much, Ciprian.

Here’s some (quick) attempt to make VCMI run on Mac. I’m afraid that no one else tried to launch it on that platform.

thanks, I noticed that one. First of all i was wondering , if a version of heroes 3 + wog needs to be installed , what did that guy use ? I could only find a wine port which runs in a small window, I doubt I can use it for testing/ debugging.

Can’t say for sure about Mac but on Linux you need Wine or Windows only to install H3 + WoG.

Running original H3 may be a problem.
Virtual machine with Windows and H3 is slow but reliable solution.
Or you may try to install Wine - does not require Windows but I don’t know how well it works on Mac.
Restoration of Erathia was also released on PowerPC-based Mac’s. There may be a way to run it on current Intel-based Mac’s if you’ll manage to find this version of H3. RoE does not have some features from expansions but this is better than nothing.

Debugging is not a problem - just grab the sources and compile them natively on your Mac - VCMI doesn’t need any Windows-only stuff to run.
Check linux readme for required libraries and steps to compile.

No need to use wine. The script build_data.sh can extract all it needs and put the data in the right place.
But the first step is to compile the source. Running it comes later :slight_smile:

ok just to make sure i understood it right, if i can succesfully compile the source , it will generate an executable along with needed data from the pc version + wog which can be used to run heroes 3 natively on mac. That sounds really exciting.

Yes, you can run VCMI independently of original H3 - as long as data files are provided.

Hi guys, today I got back to vcmi and tried to build it on MacOS Snow Leopard. Just wanted to share the progress so far and see if any of the issues i encountered sound familiar.

First I used svn to get the latest version from trunk.

After jiggling with macports and homebrew i finnaly got all the dependencies required in the README.linux file on my system. After the ./configure went well i ran make and i run in the following error:

make[2]: *** No rule to make target `SHexField.cpp', needed by `libvcmi_la-SHexField.lo'.  Stop.
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

I commented out the libvcmi_la-SHexField.lo because I assumed that was because of the refactorings source control said you guys did and I wanted to go on further but I found one more missing file:

make[2]: *** No rule to make target `BattleInterface/CAttackAnimation.cpp', needed by `vcmiclient-CAttackAnimation.o'.  Stop.
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

That’s when i decided to stop and ask for help :). I would be grateful if anybody can point me in the right direction.

EDIT: for the linux guys out there can you tell me the name of the IDE you use ?

SHexField is deprecated, it’s now called BattleHex. CAttackAnimation doesn’t exist too. It seems to be that you checked out a branch revision. Please clean your folders and make a clean trunk update. Makefiles are updated to use new file names, so this should work. Perhaps you have old makefiles.

i deleted the old vcmi folder and I did a :

svn co https://vcmi.svn.sourceforge.net/svnroot/vcmi/trunk vcmi

I couldn’t find the files mentioned in the VCMI Linux tutorial :

so i left the old configure and makefile

The result was the same :

make[2]: *** No rule to make target `SHexField.cpp', needed by `libvcmi_la-SHexField.lo'.  Stop.
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

nevermind i did a autoreconf -i and it got past that point. Still interested in the IDE the linux users use though:)

You’re talking about “VCMI on Linux” thread? It’s ancient. README.linux is the only file you need for instructions.

Probably that configure file in trunk is outdated. That would explain where old names are coming from. Will check this out.

I use Codelite but any IDE that can use makefiles instead of some internal project files will work.

hey I finally got vcmi to run on Mac . here is a list of issues I encountered, maybe it will help someone.

1.did a autoreconf -i to reconfigure the makefiles

  1. ./configure wouldn’t work because of some missing libraries. I used both MacPorts and Homebrew to get that dependencies.

  2. commented out a few lines to get the code to compile. I will get back to those and try to fix them to work for mac. Here are the issues :

CVideoHandler.cpp: In member function ‘bool CVideoPlayer::playVideo(int, int, SDL_Surface*, bool)’:
CVideoHandler.cpp:965: error: ‘GH’ was not declared in this scope
// Plays a video. Only works for overlays.
bool CVideoPlayer::playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey)
	// Note: either the windows player or the linux player is
	// broken. Compensate here until the bug is found.

	pos.x = x;
	pos.y = y;

	while(nextFrame()) {
		if(stopOnKey && keyDown())
			return false;

		SDL_DisplayYUVOverlay(overlay, &pos);

		// Wait 3 frames
        //--CT commented those out so it will compile on Mac        

	return true;
  CXXLD  vcmiclient
ld: library not found for -lrt

removed the -lrt flag from the client/Makefile.am

vcmiclient_LDADD = $(top_builddir)/lib/libvcmi.la @[email protected] @[email protected] @[email protected] @[email protected] @[email protected] @[email protected] @[email protected] -lz

CGameHandler.cpp: In member function ‘void CGameHandler::spawnWanderingMonsters(int)’:
CGameHandler.cpp:5527: error: no matching function for call to ‘CCreature::getRandomAmount(int ()()) const’
../lib/CCreatureHandler.h:67: note: candidates are: int CCreature::getRandomAmount(RanGen&) const [with RanGen = int ()()]
void CGameHandler::spawnWanderingMonsters(int creatureID)
	std::vector<int3>::iterator tile;
	std::vector<int3> tiles;
	ui32 amount = (tiles.size()) >> 6;
	std::random_shuffle(tiles.begin(), tiles.end(), p_myrandom);
	tlog5 << "Spawning wandering monsters. Found " << tiles.size() << " free tiles. Creature type: " << creatureID << std::endl;
	const CCreature *cre = VLC->creh->creatures[creatureID];
	for (int i = 0; i < amount; ++i)
		tile = tiles.begin();
		tlog5 << "\tSpawning monster at " << *tile << std::endl;
        //putNewMonster(creatureID, cre->getRandomAmount(std::rand), *tile);
		tiles.erase(tile); //not use it again
CEmptyAI.h:9: error: expected class-name before '{' token
CEmptyAI.h:17: error: expected ',' or '...' before '&' token
CEmptyAI.h:17: error: ISO C++ forbids declaration of 'TryMoveHero' with no type
CEmptyAI.h:19: error: 'CSelectableComponent' was not declared in this scope
CEmptyAI.h:19: error: template argument 1 is invalid
CEmptyAI.h:19: error: template argument 2 is invalid
CEmptyAI.cpp: In member function 'void CEmptyAI::init(CCallback*)':
CEmptyAI.cpp:7: error: 'human' was not declared in this scope
CEmptyAI.cpp:8: error: 'playerID' was not declared in this scope
CEmptyAI.cpp: At global scope:
CEmptyAI.cpp:21: error: expected ',' or '...' before '&' token
CEmptyAI.cpp:21: error: ISO C++ forbids declaration of 'TryMoveHero' with no type
make[3]: *** [libEmptyAI_la-CEmptyAI.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1


#include "../../AI_Base.h"


#include "../../lib/AI_Base.h"
  1. after i did a make install and copied over the data ,mp3 the maps folder, it worked!.

I get an error which keesp repeating itself on the console :

2011-12-30 11:41:57.603 vcmiclient[17931:6107] *** __NSAutoreleaseNoPool(): Object 0x119ded500 of class NSWindowGraphicsContext autoreleased with no pool in place - just leaking
  1. TODO. Need to get it in an IDE so it will be easier to compile, debug and source control.

Should be fixed in trunk now.

Anything apart from libraries mentioned in linux readme?

bugzilla.libsdl.org/show_bug.cgi?id=870 - looks to be the same issue

No in fact, I didn’t need to fetch zlib which was mentioned there. However the port system is faulty and i had to install the same library twice once with MacPorts and second time with HomeBrew.

After I looked for a suitable IDE i decided to use none and I went with gvim and command line interface with GCC make and gdb.

I am excited about this project because I couldn’t find any heroes 3 version which runs on Mac !. There used to be one for powerpc but it isn’t supported by the newest intel architecture.

So i bet every mac user heroes 3 fan will own the VCMI client. And the best part is that once the clone is ready if we can find a way around the legal issues using the data files it can be easily ported on iPads which would be truly amazing.

So I am more then ready to help you guys here. I don’t have any experience in c++ programming but I am a decent objective c / java programmer + a quick learner so I could start out by squashing some little bugs until I get a better picture of what is going on here.

I took a look over the wiki and I couldn’t fully grasp how you get things done around here. Should i just signup for a sourceforge/ mantis account and from then on someone should assign me some things to work on ?

The usual way is to post patches, that one programmer will then commit. After a few correct patches, you’ll get direct access to svn.

probably unnecessary to post, but -lrt flag should also be removed from server/Makefile and the like.

Yes sorry forgot to mention it.

Just wanted to add that I got rid of the annoying

2011-12-30 11:41:57.603 vcmiclient[17931:6107] *** __NSAutoreleaseNoPool(): Object 0x119ded500 of class NSWindowGraphicsContext autoreleased with no pool in place - just leaking 

Following Ivan’s Link I used mercurial to get the latest version of libsdl and compile it instead of using macports or homebrew. This required some other libraries which depended on it ( SDL_Mixer, likmikmod, ffmpeg) to be downloaded and compiled as well but it worths it.

On the other hand I discovered that XCode has a decent makefile type project support so I am using it at the moment.