Git Product home page Git Product logo

Comments (6)

mode777 avatar mode777 commented on August 27, 2024

Hi @EzzypooOfNazareth , I actually thought about it a lot, even checked their code. However I couldn't figure out how Löve does this. If somebody has a hint, please let me know.

from rayjs.

EzzypooOfNazareth avatar EzzypooOfNazareth commented on August 27, 2024

@mode777 I tried doing some digging around, as well as some research into the copy command, and from what I gather I think this is a (at least somewhat accurate) run-through of how love2d handles archive files.

  1. It looks like the copy commands copies a binary into the exe itself. This binary can be parsed using a library like physfs.
  2. When love starts its bootup process, it checks whether the file is an archive, or a .lua file and copies that into a temporary memory location (looks like the bulk of that process is done here as well as in love.cpp and boot.lua)
  3. If the file is an archive then it uses physfs to read the temporary storage in memory and parses it into the correct format for the lua runtime.

Seems like this might be a huge undertaking to get it to work in a stable way on multiple operating systems. I'm by far no expert in this kind of coding, but I'll try and help in whatever way I can.

from rayjs.

jcnmsg avatar jcnmsg commented on August 27, 2024

It's fairly trivial to do this on Linux using makeself. Shouldn't be too hard to replicate on Windows using powershell and 7zip but I don't have a Windows machine ready at the moment. I've edited this comment because I originally suggested using shareutils as well but it was too convoluted and the final user would have to have it installed on their system for it to work.

Just bundle the final game directory containing rayjs and main.js with makeself ./game mygame "Final game" ./rayjs. You can safely distribute the resulting file and run it by double clicking or ./mygame on your terminal.

Let me hear your thoughts!

from rayjs.

EzzypooOfNazareth avatar EzzypooOfNazareth commented on August 27, 2024

I did several attempts with makeself on windows through cygwin. Wasn't able to get it to work, but I do think this could be a good approach, I'm going to try playing around more with makeself and some alternatives and see if I can find something that works.

from rayjs.

jcnmsg avatar jcnmsg commented on August 27, 2024

I don't think you'll be able to use makeself on Windows, as it is intended for Unix-like systems only. I fiddled a little bit on my Windows machine and was able to compile an executable using NSIS.

  1. Zip your game directory into a normal zip file (in my case, release.zip);
  2. Create a installer.nsi script as follows:
Outfile "MyGame.exe"
SilentInstall silent

Section
SetOutPath $TEMP
File ".\release.zip"
    nsExec::Exec '"powershell" -WindowStyle hidden -NoProfile -ExecutionPolicy Bypass -Command "Expand-Archive -Path $TEMP\release.zip -Destination $TEMP"'
    nsExec::Exec '"powershell" -NoProfile -ExecutionPolicy Bypass -WindowStyle hidden -Command "$TEMP\release\rayjs.exe"'
SectionEnd
  1. Run via powershell: makensis installer.nsi

If you run the resulting MyGame.exe, it will auto-extract your game contents to a temporary folder, typically C:\Users\$UserName\AppData\Local\Temp and run rayjs.exe automatically.

I don't know how to hide the raylib console, it's always present on Windows for some reason. On linux I just added the --nox11 as a makeself parameter and it was gone when I launched rayjs. Just updated the script to hide both powershell consoles that might have flashed blue before as well as raylib's console.

from rayjs.

mode777 avatar mode777 commented on August 27, 2024

Sorry for the delay. I actually thought about this a lot and I think it would be a nice feature to have. Ideally having this functionality built in the actual executable so you can generate these on the fly. However, other than Löve2D, raylib cannot run on zip-files. Even if we can fuse the main.js with the rayjs.exe we still need assets and other scripts to bundle as well. Love can use a zip file as a virtual file system, while I don't think that would be straightforward to add. While it would be possible to implement this in rayjs, I am trying to stick as close to raylib API as possible. So by now I don't think this will be possible.

from rayjs.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.