PortsMaster / PortMaster-New

New PortMaster repo
https://www.portmaster.games
MIT License
69 stars 70 forks source link

ports/sneggpit pull request #499

Closed eludi closed 2 months ago

eludi commented 3 months ago

New Port for Sneggpit

Game Information

Submission Requirements

CFW Tests

Ensure your game has been tested on all major CFWs:

Resolution Tests

Test all major resolutions:

File Structure

Remarks

This is my first attempt to contribute to the portmaster project using my stand-alone Javascript game engine arcajs. So any comments or suggestions are warmly welcome. If this eventually works, I will contribute also a few other games currently pusblished only at the eludi.net website.

Cebion commented 3 months ago

Feel free to open a testing thread in our discord so we can test all other combinations. Hats off if this really works. We've don't have any JS ports since they require a browser of some sort and we don't have that because of missing X11 on most CFWs.

I hope our documentation was helpful so far =)

Testing channel you can find here https://discord.com/channels/1122861252088172575/1122885073507733625

Our basic launchscript with the needed headers can be found here

https://portmaster.games/packaging.html#basic-launchscript

Simple example port with our current standards https://github.com/PortsMaster/PortMaster-New/tree/main/ports/freesiege

eludi commented 3 months ago

Thank you, Cebion, for your encouraging words, the PortMaster documentation is fine! As suggested, I've asked for testing assistance in the discord channel.

Indeed the used arcajs JS runtime runs both within and without a browser. This is accomplished by introducing a lightweight API layer on top of the standard browser APIs, which better fits to the SDL2 APIs used by the stand-alone runtime. Porting existing JS games therefore requires some specific adaptations, mainly in the graphics and input interfaces. In some sense it resembles Löve2D, but with Javascript instead of Lua as programming language.

JohnnyonFlame commented 3 months ago

Thank you, Cebion, for your encouraging words, the PortMaster documentation is fine! As suggested, I've asked for testing assistance in the discord channel.

Indeed the used arcajs JS runtime runs both within and without a browser. This is accomplished by introducing a lightweight API layer on top of the standard browser APIs, which better fits to the SDL2 APIs used by the stand-alone runtime. Porting existing JS games therefore requires some specific adaptations, mainly in the graphics and input interfaces. In some sense it resembles Löve2D, but with Javascript instead of Lua as programming language.

This is incredibly interesting. I attempted something using NodeJS but failed spectacularly due to how the audio APIs available would behave. Managed to go as far as boot Constuct2 games but your average game would require 8gb+ RAM and music streaming would block the execution loop resulting in some disgusting audio playback despite the games being ""playable-ish"".

How much of the browser APIs are you expecting to be in-scope for your project? Could we use this to port RPGMV and C2 games?

eludi commented 3 months ago

Indeed my original goals for arcajs were to create a lightweight stand-alone Javascript runtime on top of SDL2 providing a subset of the standard web APIs: mainly 2D canvas, web audio, and input events. However, this direction turned out to be not feasible or at least beyond my capabilities: Mainly the canvas 2D API turned out to be too different / too high-level to reasonably map onto low level APIs such as the SDL2 renderer or OpenGLES2. The performance penalty caused by this mismatch was so high that it only ran fine on devices capable of running a full web browser - leaving not much justification for such an ambitious project.

Due to that the perspective of arcajs was reversed: now the starting point was a slightly more high-level abstraction on top of the SDL2 APIs, which turned out to be also quite easily implementable with standard browser APIs. In its current state, only arcajs's input events and localStorage API widely adhere to the web standards, whereas its graphics and audio APIs only vaguely really resemble canvas or web audio.

I am fairly content with the current APIs for writing smaller game sketches from scratch, and the performance is usually fine also on entry-level single board computers, so I currently don't have any plans to do major changes. But porting existing browser games requires a substantial rewrite of their graphics/audio code. For some games which have some sort of an internal abstraction layer this is not so much effort (can be a single day project), but for others it is almost a complete rewrite.