Is Julia good for game development?

Hi there
I want to develop server based games via Julia.

It’s going to be awesome if you write about your honest experience and opinion.

julia_is_ideal = readline()
parse(bool, julia_is_ideal)

if julia_is_ideal == 1
   print("please suggest libraries")
   ###
           not for call of duty of course, just 2D games 
           however I expect high potential
   ###
else
   println(" why not? ")
   println(" what programming lang do u suggest for it? ")
end
3 Likes

No. If you’d like to use Julia, you may need to build/resurrect many packages in the ecosystem, whereas C#/C++/Unity has ready-to-use infrastructures.

7 Likes

I wish Julia had better support for building games. Python and Java are also some alternatives, but Gnimuc’s recommendations might be better.

2 Likes

This is the only effort in Julia that I am aware of.

https://github.com/aviks/GameZero.jl

4 Likes

It depends on your goals.

I’ve found Julia to be super fun for developing a little game where I can live-code new game rules while my children are playing it. See: https://github.com/c42f/Gameoji

Gameoji is very much a quirky bespoke game which I doubt anybody else will play, but we’re having fun with it. Some features:

  • Terminal-based tile rendering of emojis (with low-res raycast visibility :slight_smile: )
  • 2D dungeon crawler like gameplay
  • “In-person” multiplayer (multiple devices with keyboards can connect, but all rendering happens on the main screen)
  • Change the game logic and game state interactively via RemoteREPL.jl

I highly recommend using an Entity-Component-System abstraction for your game logic; I use @louisponet’s Overseer.jl and this hugely cleaned up the game logic in my game.

I think there’s a few reasons not to use Julia for a game:

  • Distribution! Creating a reasonable-size game bundle for low-latency startup and distribution could be hard. If you care about game distribution you should investigate this early on (see PackageCompiler.jl and related tools).
  • The library ecosystem isn’t very complete (though for 2D you might be fine with the SDL bindings (maybe via GameZero.jl?) and an ECS via Overseer.jl?)

Although the ecosystem of game-specific libraries in Julia isn’t large, many of Julia’s scientific and technical computing libraries are very useful for game development. For example, Julia has various high quality libraries for geometry and image processing, many of which are very applicable to game programming.

30 Likes

Thanks for reply.

Thank you, so I start this with Julia and see what’s gonna happens
it is worth it for sure
after a week if it doesn’t make sense, ill switch to C++

and wow this RemoteREPL.jl is really cool
I left a star

5 Likes

I’ve been in the game industry for 35 years, and have been playing with Julia.
I think it’s a pretty solid language for using as a game scripting language -ie a replacement for things like LUA, C#, in-house languages, and I have integrated it into my distributed simulation engine. The ability to run at compiled code speed and easy integration with the mainstream game dev language (c++) are strong positives.

The risks I would say are GC, and big issues about load-time compilation. I think the first is maybe not such a problem, and because of the ability to do code introspection, you could define “allowed” and “not allowed” constructs in your game logic scripting. The second seems a bit problematic though, julia’s startup times for even relatively simple code packages could easily become the bottleneck in game/level startup time.

8 Likes

I’d think sysimages should help solve number 2. once you’ve deployed, you know all the code you need.

Yes that was my thought too- that you’d link your whole game and Julia code into one dumped .exe.
Wouldn’t help with user mods though

Thanks for the link, Overseer seems like a really nice library.

The ECS paradigm is quite underrated and probably could be used in many places where it isn’t right now. It’s used for example in the rust compiler.

If you mean “the logic in server” and “the UI is in browser” games when you say “server-based game”, yes Julia may be a nice choice if you use a web framework to handle HTTP connections, cookies, and sessions. Genie is a good candidate for this.

2 Likes

Right, if a game is latency sensitive or creates a lot of garbage then GC pauses could be an issue. People have used Julia for realtime control of robots which is even more demanding, so low latency is possible. I think they had to pay a lot of attention to avoiding allocation though.

That’s basically the same problem that the main Julia audience faces with time-to-first-plot. There’s been a lot of effort put into this but there’s still no really slick solution for end users. I guess we’ll have streamlined sysimage creation at some point via the REPL and this may be less of a problem. Separate compilation has also been discussed.

Thank you

1 Like

Link to timestamp discussing the problems faced by robotics user (2018) with 1-millisecond cycle time:

At 37:00 he says it would be much easier to debug memory management issues if there were a macro that disallows allocations in its context, turning allocation into error. At ~39:00, Jeff responds positively to this suggestion. Is this macro possible now?

2 Likes

, if a game is latency sensitive or creates a lot of garbage then GC pauses could be an issue. People have used Julia for realtime control of robots which is even more demanding, so low latency is possible. I think they had to pay a lot of attention to avoiding allocation though.

Yes. For a 3d game to be viable, it’s got to get through a whole simulation+rendering loop every 10-15ms or so. For VR, you really want 8ms, and much longer will make people nauseous.

If you can architect your game to work that way, you may be able to run the Julia parts in another thread walled off from the c++ parts

Thanks, its helpful
so as u said latency in solvable.
And for GC, I think trying to create as less as possible garbage, can be the solution for me.
Then the Julia GCA should take care of the rest.

I don’t think so. For reference, the relevant github issue is linked below:

3 Likes

In the short-term I think where Julia can shine right away is for game tools, e.g. level editors, baking tools, optimizers, etc.

1 Like

Yeah, I’ve used Julia as data management & balancing tool in my previous mobile game project. Free to play game requires a lot of calculation and sometimes simulations with game data, and I think Julia is perfect for such task

I have been working on developing a general data manager tool with Julia. It’s still in the early stage, but if anyone is interested; here is the link to my package

2 Likes