# Some new design thoughts

**URL:** <https://forum.vassalengine.org/t/some-new-design-thoughts/76627>\
**Category:** Development\
**Tags:** v4\
**Created:** [February 26, 2023, 1:15pm UTC](https://forum.vassalengine.org/t/some-new-design-thoughts/76627 "2023-02-26T13:15:10Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [April 29, 2025, 7:46pm UTC](https://forum.vassalengine.org/t/some-new-design-thoughts/76627/25 "2025-04-29T19:46:13Z")

</div>

I got the engine to work on Windows 11. There were a few surprises.

It is best practice to be able to build the engine for all platforms on a single platform. The single platform is Linux. Cross-compilers must exist on Linux that can build the other platforms.

I will go through the Windows 11 version of the engine.

* * *

Downloaded the Windows version of Luau (/0.671/luau-windows.zip) from [Luau](https://sourceforge.net/projects/luau.mirror/).

Extracted to folder `luau`.

In folder `luau` README.md describes how to build the libs.

Cmake must be installed. A cross-compiler must be installed. The obvious choice is g+±mingw-w64.

Read about g+±mingw-w64 [here](https://www.mingw-w64.org).

Set the compiler Cmake uses like this:

```
cmake .. -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_BUILD_TYPE=RelWithDebInfo

```

The Windows versions of `libLuau.VM.a`, `libLuau.Compiler.`a, `libLuau.Ast.a` and `libisocline.a` are made.

* * *

You now need to compile the engine source code with the cross-compiler.

First download the Windows version of Qt. In a [previous post](https://forum.vassalengine.org/t/some-new-design-thoughts/76627/20) I described how this is done. Click Windows x64 under _Download Qt for open source use_. The downloaded installer is called **qt-online-installer-windows-x64-4.9.0.exe**. Run it (with Wine) and log in to your Qt account.

Compile the engine with:

```
CPLUS_INCLUDE_PATH=/data/Utvikling/Alben/Windows/Qt/6.9.0/mingw_64/include;export CPLUS_INCLUDE_PATH

LD_LIBRARY_PATH=/usr/bin/x86_64-w64-mingw32-g++:/data/Utvikling/Alben/Windows/Qt/6.9.0/mingw_64/lib;export LD_LIBRARY_PATH

x86_64-w64-mingw32-g++ -Wall -static-libgcc -static-libstdc++ -o main main.cpp luau.cpp counter.cpp window.cpp repository.cpp frame.cpp overlay.cpp io.cpp scale.cpp toolbar.cpp settings.cpp -I/data/Utvikling/Alben/Windows/luau/VM/include -I/data/Utvikling/Alben/Windows/luau/Compiler/include -I/data/Utvikling/Alben/Windows/Qt/6.9.0/mingw_64/include/QtWidgets -Wl,--copy-dt-needed-entries -L/data/Utvikling/Alben/Windows/Qt/6.9.0/mingw_64/lib -lQt6Core -lQt6Gui -lQt6Widgets -L/data/Utvikling/Alben/Windows/luau/cmake -lLuau.VM -lLuau.Compiler -lLuau.Ast -lisocline

```

The flags `-static-libgcc` and `-static-libstdc++` are for portability.

* * *

Now the great surprise. When I compiled I got an error in `io.cpp` line 142

```
if (Settings::playerSide == "")
{
	Settings::playerSide == findSide();
	Luau::updateSide(Settings::playerSide.c_str());
}

```

It should of course be

```
if (Settings::playerSide == "")
{
	Settings::playerSide = findSide();
	Luau::updateSide(Settings::playerSide.c_str());
} 

```

This was just a typo but it was `x86_64-w64-mingw32-g++` who detected it. `g++` just ignored it !!

This corrected, another error showed up on line 385:

```
string filename{i->path().relative_path()};

```

This was a type mismatch and was corrected to:

```
string filename = string(i->path().relative_path().generic_string()); 

```

In both cases `g++` never issued a warning or error. I am very impressed with `x86_64-w64-mingw32-g++`.

* * *

A `main.exe` is made, the Windows version of the engine.

Copy` main.exe` to your Windows 11 platform. Make sure Qt for Windows is on the Windows platform. For me it is in C:\Qt.

Open a `cmd` and write this:

```
set PATH=%PATH%;C:\Qt\6.9.0\mingw_64\bin

```

so that `main.exe` can find the Qt dlls.

* * *

When I first ran `main.exe` I got this message:

```
The program can't start because MSVCP140.dll is missing from your computer.
Try reinstalling the program to fix this problem.

```

The missing dll is a Visual C++ 2015, 2017 and 2019 redistributable.

[Link to Microsoft](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).

Choose the X64 version. With the dll installed, the engine ran. But now came another problem. Many of the the resources (images) were not found. The resource names had back-slashes. Good, old Windows with back-slashes in its file path that can be mistaken for escape characters … lol.

In `io.cpp` line 374 this:

```
string str = i->path().parent_path().string() + "/" + i->path().stem().string();

```

was replaced by this:

```
string str = i->path().parent_path().string();
			
// convert back-slashes to fore-slashes
std::replace(str.begin(), str.end(), '\\', '/');

str = str + "/" + i->path().stem().string();

```

* * *

The engine now ran and looked like this:

[![](https://forum.vassalengine.org/uploads/default/original/2X/7/7eea836ac26da3c33be898078532ddf146a8a258.jpeg)](https://imgbox.com/ZOaaGdgX)

But what? No menu bar? Only an arrow to the right? The menu items were found there:

[![](https://forum.vassalengine.org/uploads/default/original/2X/0/03c753b069bf02138480f70b17baaf4fa199b21f.jpeg)](https://imgbox.com/J1HKboKp)

I realized that the problem had to do with the height of the menu bar. In line 224 of `main.cpp` I changed this:

```
menuBar->setFixedHeight(20);

```

to this:

```
menuBar->setFixedHeight(22);

```

That was it. The engine works under Windows. Wow !!!

[![](https://forum.vassalengine.org/uploads/default/original/2X/9/986e31b95b64b11b8f5a2b04cf1ec6d3661faf73.jpeg)](https://imgbox.com/c4SrSb41)

I am glad this was possible with little hassle. The code that runs under Windows is exactly the same as the code that runs under Linux. The small changes made had no influence on how the engine ran on Linux. This is very important from a practical point of view. No different versions of code for different platforms … arrg.

* * *

Regarding Windows 7 it is clearly stated that Qt6 does not support Windows 7.

It is possible to use the old Qt5 … but I do not want to use time on that now.

* * *

Besides platforms I wanted to look at deployment. I wanted to check out how the engine could run independently, not only in my development environment.

The first thing to do was to collect all needed files in one folder. They are:

- The resource files \_\_images and images
- The Luau script files
- main
- The needed Qt libraries

By using `ldd` I could see the dependencies of the Qt .so-files. I ended up with this collection:

[![](https://forum.vassalengine.org/uploads/default/original/2X/9/9c80e2ef225eaf789d182fcf864374ffaaa5b73e.jpeg)](https://imgbox.com/huRMIobG)

This is a complete list of all Qt files needed to run the engine. The file `libicudata.so.73.2` is the largest at 32 MB.

The total size of all the needed files for the engine (the size of the folder) was 75,9 MB (72 items).

Fortunately this size can be reduced substantially by using compression. There is a tool called _makeself_ ([https://makeself.io/](https://makeself.io/)) that can both compress and run a script when decompressed. I call the compressed file `main.run`. It is generated by this call:

```
makeself --nox11 ./makeself ./main.run "Game engine" ./run.sh

```

The `--nox11` option is there to not show a terminal. The 75,9 MB folder is called `./makeself`.  
`./run.sh` is a script that is run after decompression. It is:

```
#! /bin/bash
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:./Qt
export QT_PLUGIN_PATH=./Qt
export QT_QPA_PLATFORM_PLUGIN_PATH=./Qt
./main

```

It sets needed environment variables relative to `./makeself` and calls `main`.

makeself creates a self-decompressing and self-starting application called `./main.run`. In order to run `./main.run` create a Linux launcher shortcut as:

```
/home/me/Utvikling/Alben/main.run &

```

The ‘_&_’ has the effect of starting a new thread for `main`. The downside is that the user clicks on the shortcut and “nothing” happens for a second or two while the decompression takes splace. I am sure there are other ways of doing the deployment than _makeself_.

`main.run` is 32,1 MB, substantially less than 75,9 MB. Yet, a module will always have about this size. With hard disks of 1 TB and download speeds of 10+ Mbps this should not pose a problem today. `main.run` is totally self-contained. It has its own copy of the Qt library, which means that the module never becomes “out of date”. Only the computer runtime can make a module not run anymore.

* * *

Obviously more work has to be done regarding platform and deployment. I have shown that the engine can run on a major platform besides Linux. I have shown that the engine can run on a platform without Luau or Qt installed.

Now comes what I look forward to: a prototype for a totally new game, _Paths of Glory_. This game is of course far more popular that _Verdun: A Generation Lost_.

It will still just be a prototype, not a full game. In this prototype cards will be introduced.

---

_[View the full topic](https://forum.vassalengine.org/t/some-new-design-thoughts/76627)._
