Giter Club home page Giter Club logo

julgame.jl's Introduction

codecov Documentation is in progress! Trello board JulGame Logo

The Jester CoinGrabber

JulGameEditor

Example Repo

Support

If you want to support development, feel free to check out my discord server, or my YouTube channel where I make videos about game development:

What is JulGame?

JulGame is an open-source game engine meant for creating 2D games (and 3d games... eventually) using the Julia programming language. JulGame uses SDL2, and CImGui for the editor. The plan for 3d will be to use OpenGL.

Why did I make it?

Because I find Julia interesting and I've always wanted to create a game engine. I would like to see a game dev scene around it as there isn't much of one now. I am not a Julia programmer (nor an experienced game engine creator), so I am sure there is a lot I am doing wrong. If you see anything that I can fix, please just let me know with a discussion or an issue.

Why JulGame?

I thought that JulGame would be a great play on Pygame. I also think it just rolls off the tongue. Also, I recently found out that "Jul" is the etymological root of “jolly”, so it makes for a great pun :)

How to get started?

] add JulGame for the latest in the package manager

] add https://github.com/Kyjor/JulGame.jl for main - RECOMMENDED as any bug fixes will immediately go here.

] add https://github.com/Kyjor/JulGame.jl#develop for develop

Either download the latest release of the editor, or run it by navigating to JulGame\src\editor\Editor\src\Editor.jl and run julia Editor.jl

How do you use it?

Once you have the editor open, download the example, unzip it, and then enter the path to the root of the project along with the scene name (scene.json) in the editor under the Project Location window. Poke and prod around to figure things out until we have some real docs :)

🔴Warning🔴 Save often! The editor will crash with no remorse! Any big changes you make, save immediately.

JulGameEditorOpenScene

How do you run your scene?

Navigate to your project, and cd to the directory with Entry.jl, and run julia Entry.jl, and it should start!

What needs to be done?

General

  • Documentation
  • Video tutorial

2D Engine

General

  • Entities can be children of other entities, with editor support
  • Tests
  • Prefabs (like Unity Engine)
  • Engine time system

Visuals

  • Simple Rendering
  • Basic particle system

Physics

  • Better physics in general
  • More efficient collision handling
  • Raycasting

Animation

  • More options than just item crop

Input

  • Controller support

Scene Management

  • Multiple scene support

Editor Features

  • Sprite cropping tool for animations
  • Hot reloading with Revise.jl if possible
  • Profiling
  • Debug console
  • A better way to display the scene. There is no SDL backend support for the port of CImGui, so we are stuck rendering two separate windows at the moment
  • Scene Grid
  • API
  • Tile map editor
  • Multi-select entities
  • Right click context menus

3D Engine

  • 3D rendering
  • A robust list of 3D engine features...

Build Support

  • Windows
  • Mac
  • Linux - May have to use LDTK
  • Web ???
  • Mobile ???
  • Console ???

Inspirations/Credits

This is a list of references that I used in order to get JulGame where it is, along with people who inspired the creation of this (who you should definitely check out!)

  • Solar Lune, who is creating a 3d renderer. This format for the readme is also referencing theirs.
  • Coder Gopher, who has tutorials that helped me get started with SDL.
  • Lazy foo, who has tutorials that brought me the rest of the way with SDL.
  • and so many others who I will note some of in the future :)

Games Made With JulGame

Here I will be keeping a list for the first games created with JulGame :)

  1. The Jester
  2. Coin Grabber

julgame.jl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

julgame.jl's Issues

Robust features list

I've created a list of features in the engine, but it definitely doesn't cover a lot of things that should and will be added. This could also be viewed as a chance to request features for the engine

Pulling methods out of struct definitions

Currently, much of the logic is stored in anonymous functions within struct definitions by overloading getproperty. This does allow OOP style code with scene.method() calls but it has two drawbacks:

  1. Stack traces contain anonymous functions with uninformative names. It would be nice to see init(::Main) in the stacktrace instead of a gensymed string of characters.
  2. Julia is designed for a more functional style so you're probably going to see a performance penalty for always having to go through the if s == :init ... elseif.. elseif... on every get property call. Using normal method calls allows multiple dispatch to do its thing and resolve the correct function, inline where appropriate, etc.

You could solve the first problem by just pulling these anonymous functions out, giving them names, and then still using get_property to dispatch to the correct function. Or you could go all the way and remove the OOP style and mayb see a performance benefit.

Anyway, I'm happy to do the work, but I wouldn't want to do such a major refactor without checking on the direction you'd like to go.

Can't Open the Editor

So I tried opening the editor by downloading the JulGame repo and going to here JulGame.jl-main\src\editor\Editor\src\ and then running julia Editor.jl and I get this

image

ECS support

Are you planning to implement an entity component system (like the one in Bevy)? :)

JULgame for Linux next ?

Hi Kyle,
Just wondering if you'd be planning on doing some game development "tools/utility" for the Linux plateforms anytime in the future ?
Cheers,
/Terii

Some performance ideas

From discourse... https://discourse.julialang.org/t/im-creating-a-2d-platformer-using-julia/108057/10

Hopefully these help!

Profiling

It would be good to use ProfileView.jl on some running code if possible to find the hot spots. Is there a basic demo game we can use for benchmarking that can e.g. run for 10 seconds then stop? Something that showcases a bunch of commonly used things so we can see where the real costs are.

The rest of my comments might be a bit random because I'm not sure what the hot paths are exactly, but they should roughly be helpful!

Use concrete types in struct fields as much as possible

I fell like this is the biggest room for improvement. Unstable struct field propagate type instability through all of your code. For example here you have Array{SomeType} in a lot of places, but that isn't type-stable because the dimensionality of the array is not known. So the value will be boxed and julia will need to inspect it at runtime to see if its a matrix or vector.

Vector{SomeType} will be stable, as will Array{SomeType,3}. Obviously Any and Array{Any} are also not stable. Knowing if its at lease a small union helps a lot ::Union{Nothing,Int} is much faster to access than ::Any because julia has optimizations for "small unions"

collisionEvents::Array{Any}
currentCollisions::Array{Collider}
currentRests::Array{Collider}
diameter::Float64
enabled::Bool
isGrounded::Bool
isTrigger::Bool
offset::Math.Vector2f
parent::Any
tag::String

Here you use Integer which is and abstract type, when Int would be concrete and many times faster to access and use

layer::Integer

Put types on vectors

This gives a Vector{Any}

A = []

But if you Know exactly what will go in it, you can instead do:

A = Int[]
# Or a small union
A = Union{Int,Missing}[]

scripts = []

Try to use regular struct rather than mutable struct in your really hot paths. (this might be only 1% of type instability tho)

Julia can optimize the hell out of struct but mutable struct has state the compiler can't track - so they have to exist on the heap as actual constructed objects. Often regular struct never actually exist - they get optimized away to just a few values in registers.

You can also mark some fields of mutable struct with const so the compiler knows they don't change.

Also a comment more than something I'm at all sure is an actual problem!
You are writing some of the most OOP style julia I have ever seen! It makes sense for game dev where things really are object-like. But leaning on getpropery might have some performance and compilation costs too (this is an unproven hunch) because probably compiler people are not targeting this coding style, and julia has a few performance gotchas with variables in closures being boxed or unstable. See:

https://discourse.julialang.org/t/closures-over-types-are-type-unstable/82337
https://discourse.julialang.org/t/documenting-when-the-closure-bug-15276-binds-and-how-to-avoid-it-for-introductory-users/12642

Cannot load sound in editor

When trying to load a sound in the editor, we are getting an error. We should be able to use either the "Load Sound" or "Load Music" to set the sound as one or the other. Instead, we get an error:
image

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.