Giter Site home page Giter Site logo

Better way to run game about gamezero.jl HOT 9 CLOSED

aviks avatar aviks commented on May 27, 2024
Better way to run game

from gamezero.jl.

Comments (9)

scottbigbrain avatar scottbigbrain commented on May 27, 2024

I propose that we change things so that instead of focusing on making a module and using repl we simple require that the game script has using GameZero in it and havee the user call rungame() in the script. We would have to find a way to make rungame work with this approach though.

from gamezero.jl.

scottbigbrain avatar scottbigbrain commented on May 27, 2024

We could simply scrap having game_module and instead change rungame() so that it can run in the same scope as the game. This could be done by replacing game_module with Main.

from gamezero.jl.

aviks avatar aviks commented on May 27, 2024

I am not sure what the right answer is here, but I am willing to experiment a bit with thsi.

from gamezero.jl.

scottbigbrain avatar scottbigbrain commented on May 27, 2024

The part of this that irks me the most is how the current implementation prevents using include("other_program.jl"). On my fork I just committed a function game_include("other_program.jl"). It is a simple implementation, defined as game_include(jlf::String) = Base.include(game[].game_module, jlf). It bypasses the problem of including other programs, but it still feels like healing the symptoms instead of the disease. Anyway, I'll do some more testing on it then send a PR.

from gamezero.jl.

dustyirwin avatar dustyirwin commented on May 27, 2024

I am currently using Windows shortcut with a custom icon to launch the games from the desktop. The shortcut's Target field looks like this:

C:\Windows\System32\cmd.exe /c "C:\path\to\Julia 1.5.2\bin\julia.exe" --project start_game.jl

start_game.jl here is just a script that loads some packages (including GameZero) and executes rungame("my_cool_game.jl"). Further package loading is done in-game thanks to #22 :)

This assumes the user already has Julia and the game code installed, but that's it. The only issue I have is that I don't know how to launch the game without the terminal...

from gamezero.jl.

scottbigbrain avatar scottbigbrain commented on May 27, 2024

What exactly do you mean by, "I don't know how to launch the game without the terminal."

Also, I like the idea of having a script that uses the rungame function, as that could work for things like PackageCompiler.jl so that games could be distributed to people without julia. Using the repl is still best for testing because it eliminates the need to wait for using GameZero multiple times. If there are any changes we should make them so that the repl is still a legitimate option for this reason.

from gamezero.jl.

dustyirwin avatar dustyirwin commented on May 27, 2024

By that I mean to load Julia (and the game) without showing the terminal to the user: https://youtu.be/kwyfj0D0LnY
I haven't precompiled any packages yet so it's slow to launch--the game finishes loading at 0:28.

If I could hide the terminal window or launch Julia in a "headless" way, that would be nice, but not a big deal for development

from gamezero.jl.

scottbigbrain avatar scottbigbrain commented on May 27, 2024

@dustyirwin To my knowledge there is no way to do this without the terminal because your windows shortcut has to link to some file and therefore will have to open up the command line to do anything. To make it run without the command line on windows you would have to make an executable using something like PackageCompiler.jl.

from gamezero.jl.

dustyirwin avatar dustyirwin commented on May 27, 2024

Have either of you tried compiling a binary of your game using PackageCompiler? I'm trying to work through this but I am running into this error:

julia> create_app(".","compiled")
┌ Warning: ImageFiltering has a dependency on Requires.jl, code in @require will not be run
└ @ PackageCompiler C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:513
┌ Warning: ImageShow has a dependency on Requires.jl, code in @require will not be run
└ @ PackageCompiler C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:513
┌ Warning: ImageCore has a dependency on Requires.jl, code in @require will not be run
└ @ PackageCompiler C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:513
┌ Warning: Package FFTW has a build script, this might indicate that it is not relocatable
└ @ PackageCompiler C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:526
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...
ERROR: ArgumentError: Package Argentum [f943f3d7-887a-4ed5-b0c0-a1d6899aa8f5] is required but does not seem to be installed:

  • Run Pkg.instantiate() to install all recorded dependencies.

Stacktrace:
[1] _require(::Base.PkgId) at .\loading.jl:999
[2] require(::Base.PkgId) at .\loading.jl:928
[3] require(::Module, ::Symbol) at .\loading.jl:923
ERROR: failed process: Process('C:\Users\dusty\AppData\Local\Programs\Julia 1.5.3\bin\julia.exe' --color=yes --startup-file=no '--sysimage=C:\Users\dusty\AppData\Local\Temp\jl_Yd9CFI\tmp_sys.so' '--project=C:\Users\dusty\Documents\Active_Projects\Argentum\' -e 'import Argentum', ProcessExited(1)) [1]

Stacktrace:
[1] pipeline_error at .\process.jl:525 [inlined]
[2] read(::Cmd) at .\process.jl:412
[3] read(::Cmd, ::Type{String}) at .\process.jl:421
[4] do_ensurecompiled(::String, ::Array{String,1}, ::String) at C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:186
[5] create_sysimg_object_file(::String, ::Array{String,1}; project::String, base_sysimage::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, cpu_target::String, script::Nothing, isapp::Bool) at C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:249
[6] create_sysimage(::Symbol; sysimage_path::String, project::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::String, isapp::Bool) at C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:426
[7] (::PackageCompiler.var"#7#8"{Bool,Bool,String,String,String})() at C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:636
[8] cd(::PackageCompiler.var"#7#8"{Bool,Bool,String,String,String}, ::String) at .\file.jl:93
[9] create_app(::String, ::String; app_name::Nothing, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, audit::Bool, force::Bool, c_driver_program::String, cpu_target::String) at C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:625
[10] create_app(::String, ::String) at C:\Users\dusty.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:591
[11] top-level scope at REPL[2]:

Argentum is the working name of my project and I'm not understanding why it thinks I need to install Argentum--that's the game I'm currently developing...?

from gamezero.jl.

Related Issues (20)

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.