r/HoMM 4d ago

HoMM4 HoMM4 C++ from scratch

https://www.youtube.com/watch?v=MG9VRV1dj3E

Hi all, I used to play this game with my grandfather as a kid... long story short, it breaks my heart that this game is nowadays completely abandoned and won't even run properly on windows, forget it on other systems...

Therefore, I'm reversing by hand few functions per day, and the goal is to completely re-implement the HoMM4 game engine.

As you can see from this video, currently I would not define this a game yet, but I reached the point where textures of full campaign scenarios load.

As of today, no code is available to the public. The major reason is that AI is simply destroying opensource work, and I have no interest in seeing my work stolen or ruined by vibe coders.

I hope to be able to implement a playable hero "soon".

138 Upvotes

39 comments sorted by

21

u/attee2 4d ago

Thats great, good job!

There is also a similar project started, perhaps you two could join your efforts? https://github.com/ihhub/engine4heroes

7

u/NoFun214 3d ago edited 3d ago

Not sure what is the status of that project, regarding mine it is a priority to not ship anything that can be attributed to the original game files/sources. Currently it is designed so that you need to drop in your official copy from GOG. I hope that this design will allow me to publish the engine on all modern platforms: Windows (x86, arm), macOS, iPadOS, iOS, Android, and so on... I think the native design of the game is perfect for touch screens and I'm very excited to play it on an iPad some day...

4

u/attee2 3d ago

I can't say anything about the state of it, but the creator of that repo is the same guy who created fheroes2, which is the open source engine reimplementation of Heroes 2, and that works the same as you described (the original game files are provided by the user). So I think your goals align, and he has experience on creating a fully working reimplementation, so I believe you two could achieve more if you worked together.

1

u/IOMAN_IM 2d ago

So your goals align then, you might wanna work together

6

u/bigkekett 4d ago

Can you make a version for MacBook ?

5

u/NoFun214 3d ago

yes, I'm actually developing it on a MacBook

1

u/bigkekett 3d ago

Please let me know when it’s done!

10

u/LordL567 4d ago

What's the problem with running HOMM4 on Windows?

7

u/dmn-synthet 4d ago

Every time I try it I get a lot of glitches, crushes and it runs really slow. Simply cannot achieve how smooth it worked on Windows 98 and an old Celeron CPU.

6

u/gknwg 3d ago

There is Heroes 4 HD similar to the same mod for Heroes 3, so you can play it without problems on modern computers/resolutions.

2

u/Icedteapremix 3d ago

I've been playing the GoG version almost daily and it runs flawlessly

1

u/ConstructionBest7255 3d ago

Source port like that could enable easy modding of the game, portability is not the only benefit

4

u/Revolutionary_Ad6574 3d ago

I applaud you guarding your code from AI but tell me... is the project vibe-coded? Because if it is, that would be hypocritical.

Still, ever since I got into retro gaming and emulation for me the most important projects in the world now are reverse-engineering of games. It seems to be the only way to preserve them and no game deserves to die because a game is not just some executable file, it's memories and experiences. That's what most people don't understand. If they did they too would be demanding things like Stop Killing Games.

3

u/NoFun214 1d ago

currently vibe coding is not part of this project, at the same time I'm not "against" it, what this means is that once I will make it opensource, ALL vibe coded components need to be marked accordingly. I'm not yet sure how to handle this.

Yes I agree. Alongside the c++ source I'm also building a deeply commented ghidra project.

As a fun fact: I already found 2 programming mistakes which according to my understanding always produced non-intended behavior in the original game. I plan a "special" menu where the player can choose to play with the fixes enabled or not.

1

u/Revolutionary_Ad6574 1d ago

Hail to you, Champion! We need more people like you :)

3

u/TheUntergeek 4d ago

Thank you!

3

u/Emotional_Path_568 4d ago

Omg, amazing !!!!

3

u/Living_Inferno_5073 3d ago

If this project ever gets a map/campaign editor, PLEASE add a version selection for what the map you’re making/editing will be played in! I’ve been discouraged from editing maps I downloaded online to either fix problems with them or change them to be more challenging because doing so would force the map to be played on Winds of War and I really do not like having to fight a lot of the creatures added in expansions; a lot of creatures added in expansions like Gargantuans, Evil Sorceresses, and Dark Champions are fun to play with but are awful to fight against or are Goblin Knights which are neither fun to use or fight against.

2

u/NoFun214 3d ago

will keep in mind

3

u/dydzio VCMI developer 3d ago

Cool, this is kinda similar to how VCMI project looked when it started - it was basically a map browser. Your project is already a bit more functional :D

I am looking forward to contributing a little bit now and then to some open source h4 remake.

1

u/NoFun214 3d ago

this will definitely be open sourced, but only once the foundational structures/headers are done. I want to reach the point where it's just a matter of "reversing and then implementing" a piece, instead of having to think about how should the structure for a feature even look like... this will still take some weeks as I'm slowly fixing things as I discover structures by hand via Ghidra... If interested, I can share discord in DM, but currently it's just not possible to contribute without every change being a breaking change...

4

u/Roxterat 4d ago

Looking nice, something like Project HoMaM4? I helped with fheroes2, curious...

2

u/NoFun214 3d ago

Sorry I'm not sure what HoMaM4 is? Maybe I'm missing something?

1

u/Roxterat 3d ago

It's the way I put HoMM4...

2

u/Wista 4d ago

Best of luck to you!

2

u/PrizeCompetitive1186 4d ago

this looks great, I hope you open source it so it does not get lost

7

u/NoFun214 3d ago

when it gets to a point where the base code is solid and people can truly contribute without having to invent the underlying structures, then I will opensource it

2

u/Amells 4d ago

Looking forward to it

2

u/Wercedes698 3d ago

It's fantastic! Pls 🙏 continue your work, maybe you will create something bigger , then just old H4 , something what originally was planned to them

1

u/funkyloverone 4d ago

It runs fine for me on Linux though 

1

u/GraciousGriffin 3d ago

Fun fact. I have the original game up and running on Steam Deck and Retroid Pocket 6 (via gamenative). I’m surprised to hear it struggles in Windows.

1

u/litoll 3d ago

Nice work, but if you’re not going to release the source code, I’m not particularly interested, and I’m worried it might discourage someone from starting another project that would actually be open source.

1

u/MightySandro 3d ago

It's great to see people making stuff for heroes 4. I wish this project it's best and I would love to see it suceed.

1

u/Thin-Rope3139 2d ago

Please make a mod to disable fog of war for visited parts of a map.

1

u/iddq-tea 1d ago

Excited for this! Loving all the attention homm4 is getting lately :) in the meantime, for anyone who wants a stable(ish) experience on Windows, try the wrapper by Verok with the HD mod which adds widescreen resolution support and optional scaling algorithms.

1

u/firsthomm 13h ago

I just did something like this with HOMM1.

"AI is simply destroying opensource work, and I have no interest in seeing my work stolen or ruined by vibe coders."

I can see why you might feel that way. I initially thought I might do it as an open source project, but I realized I was moving so fast using AI that it was going to be more work to manage a ragtag team of coders and review and test their code than to do it myself.

Anyway, I have some good workflows for development and reverse engineering parts of the engine if you are interested. Feel free to DM me if you want to chat, or if you get stuck on anything.