Since I did a post on how to get HoMM3 working online without any third-party tools, here's a post on how to do it with Heroes of Might and Magic IV!
Short version: 1) Server and client: Install patches to get to version 3.0; 2) Server and client: install DirectPlay; 3) Server: forward UDP ports 6073 and 2302; 4) Server: set the game port in the game's host dialogue to 2302; 5) Profit!
Long version follows.
While HoMM3 used DirectPlay 7, HoMM4 instead uses DirectPlay 8, which is much, much better. It has NAT traversal, so clients don't need to forward ports. All the communication goes through only two UDP ports: an advertisement port (6073) and a game port. The game port by default is set to 4377, but the default DirectPlay port is 2302, and my testing shows that clients tend to try connecting to 2302 first no matter what, and if they don't get a reply they give up. So setting the port to 2302 and forwarding it seems to be the way to go.
In addition to that, DirectPlay 8 seems to be much less deprecated and at least up to Windows 8 it is possible to host the game without messing with DirectPlay DLLs. For reference, the DirectPlay 8 server executable is called dpnsvr.exe (as opposed to dplaysvr.exe for DirectPlay 7).
Also, the game itself got patched to the feature versions of the expansion packs: Patch 2.0 is equivalent to The Gathering Storm and Patch 3.0 is equivalent to Winds of War, which allows vanilla players to play with expansion pack players fine (vanilla is aware of the expansion packs). Original vanilla (1.x) doesn't even have networking altogether! The different localisations can play together just fine too, though a funny side-effect is that artifact names and other messages may appear in different languages.
Note to Wine users: you still need to run winetricks directplay to install DirectPlay (whereas it's in Add/Remove Windows Features on Windows). By the way, Wine is much better performance-wise than Windows, since you can run the game in a virtual desktop, so it thinks it's fullscreen (and you can see the game in 1280x1024 on a 1080p screen, because it doesn't fuss about the system tray and window decoration sizes!).
What I still haven't figured out is whether the game uses a client/server or a peer-to-peer model (both are available in DirectPlay 8). That might have an effect on what ports need to be forwarded on clients for matches with 3 or more players. I also haven't tried Equilibris online yet.
HoMM4 TCP/IP networking howto
- GreatEmerald
- CH Staff
- Posts: 3330
- Joined: 24 Jul 2009
- Location: Netherlands
HoMM4 TCP/IP networking howto
Last edited by GreatEmerald on 02 Aug 2017, 20:40, edited 1 time in total.
- fightknightHERO
- Leprechaun
- Posts: 4
- Joined: 27 Oct 2017
- Location: The holy Land
Re: HoMM4 TCP/IP networking howto
Have you tried Gameranger? Heroes IV works effortlessly with that
- GreatEmerald
- CH Staff
- Posts: 3330
- Joined: 24 Jul 2009
- Location: Netherlands
Re: HoMM4 TCP/IP networking howto
It doesn't work on Linux, so that's right out. It's also adware and a gross hack. The way I detailed above is the proper way to do it as the developers indended.
Who is online
Users browsing this forum: No registered users and 3 guests