3D Rendering Engine (game engine)

Hey, if the core team says it’s ok, I don’t mind! I just didn’t want to abuse the forum.

@asterite I haven’t tested this on macOS at all. I’ll dust off my ancient mac and see what I can find.

Wow… I get balls of trash on my mac. This will have to wait until the api is a bit more stable.

Screen Shot 2020-05-05 at 8.33.58 PM

2 Likes

You should see how much of noise I was making in Debugger support topic when I was fixing debbuging support ;)

If it gives useful information or you are expecting some feedback from community then it is not considered as a noise. But this is my opinion.

8 Likes

Ok, here’s another release https://github.com/neutrinog/prism/releases/tag/v0.10.0.
I didn’t have time to make a video on it, but there’s not much visual stuff anyway.

This was primarily a HUGE refactor and cleanup session. However, I was also able to add some low level GUI support that will serve as the foundation for a future GUI library.

See the health bar in the gif below:
Peek 2020-05-09 00-36

10 Likes

Lovely!

Could you drop some crystals in the terrain, and the health bar would grow if you picked them up? :slight_smile:

4 Likes

Ha! If anyone wants to send me custom models for the example code I’ll happily use them. :smile:

Not sure if these are in the format you need, but in my 3D engine stuff I did, I used these https://github.com/jwoertink/Waves/tree/master/assets They all came from a tutorial I have listed on that project.

it currently only has an .obj parser.

1 Like

I have a tiny little update on lights https://www.youtube.com/watch?v=2hL_qK6SGIE&list=PLf7IRQ2kP73lJp1wP-b0yszws8GLa_cR4&index=3&t=0s.

I’ve re-worked the lighting several times and I think I’m getting closer to something half-decent. When I’m not refactoring something in the code, I’m watching a Youtube video on how to build a game engine. The only problem is I have to translate someone’s definition of “game engine” into a usable API. Lights have probably given me the most trouble.

5 Likes

This is just at textual update. I’ve been getting busier with paid work so I’ve had to slow down work on prism, but I’ve still made a lot of updates.

As always, the namespaces and general organization of the API are still quite volatile. I hope to have a reasonably stable API in a month or two. And then maybe get it working on macOS.

Uniforms

Configuring uniforms now has far fewer caveats, making it much simpler to wire a glsl shader into your program.

Skyboxes

Skyboxes are working (the effect of a sky). It’s not yet as modular as I’d like, but I’m pleased with the functionality so far.

One aspect of the skybox, that I’ll eventually abstract out for the rest of the engine to use, is world time. You can specify the length of a day, and then you can give a texture to use at a time within this pseudo day.
For example, if I set the day length to 1 minute, the 24 hour clock in the game is scaled down to 60 seconds. So midnight occurs at 0 seconds, and 12 pm occurs at 30 seconds, etc. Now I can set a day texture at 5:15 am and a night texture at 5:45 pm without having to do any manual time conversions.

Textures

I finally made a proper abstraction around textures so I can add new types quite easily. I’m not sure how many texture types there are in opengl, but so far there’s support for 2d textures and cube map textures.

Dedicated demo repo

I didn’t want to bloat the engine repo with a bunch of textures so I moved the demo code into a different repo. This is just my scratch pad for testing things in the engine, so don’t expect to be impressed with the code quality https://github.com/neutrinog/tutorial-game

7 Likes

I finally tidied up the code and published another release.
You can find the notes and a short video at https://github.com/neutrinog/prism/releases/tag/v0.11.0

I’m about to start video 29 in this tutorial playlist https://www.youtube.com/playlist?list=PLRIWtICgwaX0u7Rf9zkZhLoLuZVfUksDP. If you take a look at that playlist you’ll get a good idea of what features will be coming to Prism. I haven’t decided yet if I’ll finish working through this tutorial series first, or if I’ll take a break to build a UI toolkit based on Prism. Building a UI toolkit was what first drew me to starting Prism in the first place.
It would be interesting to know what people thought would be most immediately beneficial, a finished game engine or a UI toolkit.

1 Like

A UI toolkit would be great.
That said, I would suggest you keep doing what you have most fun doing.

You’re not getting payed, and doing what you like to do will keep the burnout away.

1 Like

Yeah, I agree that a UI toolkit would probably be the most widely useful. That said, the work you’ve done so far on this game engine is fantastic, and I’d be really excited with either direction.

Why don’t you move all objects and initialization definition into JSON or YAML?
It will give ability to modify game scenes dynamically without recompilation.

1 Like

To be quite honest, because I’ve been so busy going through tutorials that I didn’t even think about it. Then, I started looking at some other game engines and realized all of them serialize their objects :stuck_out_tongue:.

That’s definitely something I’ll want to add in the future.

1 Like

I am testing (rewriting) my old opengl code (on Linux) using some of your code especially the module Prism::Model where I load a model via my method self.load which only loads some vertices (2 triangles) with the corresponding vertex indices. Problem I am having is that the triangles are not drawn.

I read that this is expected on Linux as you need to use shaders. Is this your experience as well ?

def self.load(vertices : Array(Float32), indices : Array(Int32)) : Model
    vao_id = create_vao
    vbos = [] of LibGL::UInt
    vbos << bind_indices_buffer(indices)
    vbos << store_data_in_attribute_list(0, 3, vertices)
    unbind_vao
    # TRICKY: one of the vbos is for the indices, so we don't need an attribute array for that.
    num_attrib_arrays = vbos.size - 1
    Model.new(vao_id, vbos, indices.size, num_attrib_arrays)
  end

Correct, some systems won’t render anything without a shader. I’m not sure exactly why, but I experienced the same thing.

Forgot to say, really nice and well written code. Thanks for the help.

1 Like

Just a little update. I’ve decided to take a break from the game engine and focus on building a UI library, but this will still largely affect the engine, so I’ll continue to post updates here.
My workload has increased as well so I’ll need to slow down development on this.

I’ve gleaned a few ideas on how to put together a constraint based UI framework. And the first task will be to implement a constraint solving algorithm in crystal. The post commonly used algorithm seems to be the Cassowary algorithm, so I’ll be porting this Java implementation to Crystal.

If you are curious how constraint solvers work read this overview https://croisant.net/blog/2016-02-24-ui-layout-constraints-part-1/.

1 Like

@da1nerd If you want to focus in the UI & lib aspects instead of the constraint solving you can use z3. There is a small example at https://github.com/bcardiff/crystal-z3/blob/master/playground/bar.cr .

Yet, porting cassowary to crystal is probably fun :-) good luck!