pph
pph copied to clipboard
Pocket Palm Heroes – a turn-based strategy made in the style and feel of the old-school "Heroes of Might and Magic" game. Native full version: https://github.com/SerVB/pph-native
Pocket Palm Heroes

This project tries to bring good old Palm Heroes/Pocket Heroes back to life. The work was started in 2017.

Pocket Palm Heroes is an original turn-based strategy for different devices, that is made in the style and feel of the old-school "Heroes of Might and Magic" game. Pocket Palm Heroes plunges you into the atmosphere of exciting fantasy adventures and epic battles! Lead your heroes as a barbarian orc chief, a noble knight, a mighty wizard, a fast beautiful sorceress, a warlock, or a creepy undead necromancer! As your kingdom grows in size, and your heroes get more powerful, you will discover new places, learn new skills and magic, and fight different monsters!
Play online!
It's available at GitHub Pages: https://servb.github.io/pph/.
Running from sources
To run the game, clone the repo and execute the following commands:
# Pack resources (needed only once or after changes in resources):
./gradlew :packResources # for Linux/Mac
.\gradlew.bat :packResources # for Windows
# Run app:
./gradlew :runJvm # for Linux/Mac
.\gradlew.bat :runJvm # for Windows
Java needs to be installed on the computer.
What we have
Sources of different versions
Unsurprisingly, this project is based on the following source codes:
- https://github.com/sigman78/pocketheroes/ (available under Apache 2.0 license) — 1.04 beta. Can be compiled even in Visual Studio 2019 (Community) but with some effort (feel free to ask for help at Discord if you want to compile them).
- https://sourceforge.net/projects/palmheroes/ (available under Apache 2.0 license) — seems to be 1.03. Can't be compiled because of lack of some files. Also, there is many code that is related to licence registration (take a look at commits).
The sources are old (not the latest 1.05). Let's primarily use the 1.04 beta version.
Change logs
Change logs are needed to fix the old sources and upgrade the version to the final known one — 1.05.
File prefixes
Many source files has prefixes.
| Prefix | Possible description |
|---|---|
| gxl | Main framework |
| xxl | Extensions for the main framework |
| xau | Audio compression |
| xjp | Image compression |
| he | "Helium" library |
Game menus
| Menu classes | Description | Menu items |
|---|---|---|
MenuView/iMainMenuDlg |
Main menu screen | TRID_MENU_NEWGAME, TRID_MENU_LOADGAME, TRID_MENU_HIGHSCORE, TRID_MENU_CREDITS, TRID_MENU_EXITGAME |
GameMenuDlg/iGameMenuDlg |
Small menu dialog in the corner of the screen during the game | Settings, Save game, Main menu, Quit, Return to game |
What we do
Port the existing sources to Kotlin. Use KorGE (available under Apache 2.0 license) to draw picture, process user input, and provide binaries for different platforms.
Progress
The progress can be seen under the Issues tab.
There are some screencasts of what's working:
Practices
There are some practices of rewriting C++ code to JVM-related code.
Constant references
Many objects are passed to functions as constants. To archive this in Kotlin, it's needed to write an interface with constant (read-only) methods and another interface or class with other methods that extends/implements the constant interface. The interface should have the "I" prefix (from "Immutable"). You can find many examples in the ported sources.
Maybe Kotlin will have such a concept in the future: KT-44173.
Pointers
Some arguments are passed as pointers and are modified inside the function. For these purposes, just pass mutable
object. If the type is immutable, for example, String or Int, we have a special wrapper called Mutable<T>. Find
examples in the ported sources.
Remove super classes
iIListNode.TypeAware.
Use standard Kotlin classes
| Kotlin class | Initial type |
|---|---|
String |
_T("String content"), L"String content", LPCTSTR, iStringTemplate<E>, iStringW, iStringA, iStringT |
Byte |
sint8 |
UByte |
uint8 |
Short |
sint16 |
UShort |
uint16 |
Int |
sint32 |
UInt |
uint32 |
Long |
sint64 |
ULong |
uint64 |
Code folding
IDEs such as IDEA or NetBeans can fold code. It's useful to hide huge pieces of code by default:
//<editor-fold defaultstate="collapsed" desc="hashCode & equals">
custom hashCode and equals methods here
//</editor-fold>
Other links
- Pocket Heroes aka Palm Heroes history — http://wiki.ioupg.com/doku.php/ioupgteam:pocket_heroes. Has some info about the game resources compression. Interesting in general ;)
- Group with fans of Palm Kingdoms, the descendant game — https://vk.com/palmkingdoms.
- Previous repo of this porting effort — https://github.com/anonymous-frog-studio/new-ph-legacy — obsolete and archived.
License
This work is available under Apache 2.0 license.