/vpxpp

VPX++ - Cross platform Visual Pinball X Player (Not yet working)

Primary LanguageC++

VPXPP

CI status (macOS)

What is VPXPP? I'm not sure yet myself. Visual Pinball Engine is no doubt the future of Visual Pinball.

This is more of a side project to see if I can actually make a cross platform version of VPX. It will not use COM, ActiveX, VBScript, etc. It will not run existing tables without rewritting the table script.

Setup

MacOS:

brew install nlohmann-json sdl2 freeimage v8 cxxopts jsm174/bgfx/bgfx
git clone https://github.com/jsm174/vpxpp.git
cd vpxpp
cp cmake/CMakeLists_osx-x64.txt CMakeLists.txt
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release
cmake --build build/Release

Windows:

git clone https://github.com/jsm174/vpxpp.git
cd vpxpp
copy cmake\CMakeLists_win-x64.txt CMakeLists.txt
mkdir deps
cd deps
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg install nlohmann-json sdl2 freeimage cxxopts --triplet=x64-windows
curl -sL https://github.com/tbossi/v8-builder/releases/download/9.2.230.22/v8_engine_9.2.230.22.zip -o v8.zip
tar -xf v8.zip
git clone https://github.com/bkaradzic/bgfx.cmake
cd bgfx.cmake
git submodule update --init --recursive
cmake -DCMAKE_INSTALL_PREFIX=./install -DBGFX_BUILD_EXAMPLES=OFF -DBGFX_BUILD_TOOLS=ON -DBGFX_INSTALL=ON -B build
cmake --build build --target install --config Release
cd ../..
cmake -DCMAKE_PREFIX_PATH=./deps/bgfx.cmake/install -DV8_DIR=./deps/v8 -DCMAKE_TOOLCHAIN_FILE=./deps/vcpkg/scripts/buildsystems/vcpkg.cmake -B build
cmake --build build --config Release

Usage

MacOS:

build/Release/vpxpp -f tables/blankTable.vpx

Windows:

build\Release\vpxpp.exe -f tables/blankTable.vpx

Done

  • Table loading

To Do

  • Rendering

Motivation

I've been thinking about this project for well over a decade.

After contributing to a few other pinball related projects -- VPX-JS, Visual Pinball Engine, NetMiniZ, WPCEmuCS, PinMAME for .NET, PinMAME Silk, CIs for PinMAME and Visual Pinball -- I have some more confidence to attempt this.

In mid August 2021, during some VPE downtime while @freezy was refactoring prefabs, I finally decided to do it.

So far, I've made more progress that I thought I would have, so I plan to keep going.

Help

vpxpp is very close to being able to render graphics. I'm not a graphics guy. I know a little OpenGL and not much DirectX. I was looking for a cross platform rendering library and settled on bgfx. Visual Pinball uses Direct3D 9, so there is a ton of work that will be required to port it to bgfx. If you are interested in contributing, any help would be appreciated!

Third-Party

vpxpp is built on top of giants:

Macros

Many of the game item header files use macros. I dislike macros because it makes it difficult to figure out what is implemented where. I came across this great article about expanding macros.

In ieditable.h I was able to log the macros during compile using the following:

#ifndef _CRT_STRINGIZE
#define _CRT_STRINGIZE_(x) #x
#define _CRT_STRINGIZE(x) _CRT_STRINGIZE_(x)
#endif

#define EXPAND_MACRO(x) __pragma(message(__FILE__ _CRT_STRINGIZE((__LINE__): \nmacro\t)#x" expands to:\n" _CRT_STRINGIZE(x)))

#define STANDARD_EDITABLE_DECLARES(T, ItemType, ResName, AllowedViews) EXPAND_MACRO(STANDARD_EDITABLE_DECLARES1(T, ItemType, ResName, AllowedViews)) STANDARD_EDITABLE_DECLARES1(T, ItemType, ResName, AllowedViews)
#define STANDARD_EDITABLE_DECLARES1(T, ItemType, ResName, AllowedViews) \
.
.

#define STANDARD_NOSCRIPT_EDITABLE_DECLARES(T, ItemType, ResName, AllowedViews) EXPAND_MACRO(STANDARD_NOSCRIPT_EDITABLE_DECLARES1(T, ItemType, ResName, AllowedViews)) STANDARD_NOSCRIPT_EDITABLE_DECLARES1(T, ItemType, ResName, AllowedViews)
#define STANDARD_NOSCRIPT_EDITABLE_DECLARES1(T, ItemType, ResName, AllowedViews) \
.
.

Code Formatting

Clang Format Style (Clang_format_style)

{ BasedOnStyle: LLVM, PointerAlignment: Left, UseTab: Always, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All, FixNamespaceComments: false }

License

TBD