Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better way to run game #9

Closed
aviks opened this issue Aug 2, 2020 · 9 comments · Fixed by #38
Closed

Better way to run game #9

aviks opened this issue Aug 2, 2020 · 9 comments · Fixed by #38

Comments

@aviks
Copy link
Owner

aviks commented Aug 2, 2020

We currently suggest users start the Julia repl to run the game. We should provide shell and cmd scripts to run games to make it easier to start from the shell.

At the same time, we should find a better way to start a game programatically, that plays well with modules and include

@scottbigbrain
Copy link
Contributor

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.

@scottbigbrain
Copy link
Contributor

scottbigbrain commented Oct 21, 2020

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.

@aviks
Copy link
Owner Author

aviks commented Oct 21, 2020

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

@scottbigbrain
Copy link
Contributor

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.

@dustyirwin
Copy link
Contributor

dustyirwin commented Nov 1, 2020

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...

@scottbigbrain
Copy link
Contributor

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.

@dustyirwin
Copy link
Contributor

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

@scottbigbrain
Copy link
Contributor

scottbigbrain commented Nov 2, 2020

@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.

@dustyirwin

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants