Orion’s Gate – Introducing new engine, “Reason”

Today, I want to share some of the features I put into the engine, what it is currently capable of, and where it is going from here. As of the moment it’s nothing truly superbly impressive, however it is my own work and is not borrowing code from other places. In other words, it has been written from scratch.

Introducing Reason Engine

I created the engine because I noticed that, at least for me, MiniB3D had a few downfalls I could not live with for my game. While shadows are implemented in Klepto’s extended remix, they do not work with my models and it also does not work with my bloom technique.

So why not go the whole 5 yards and do everything? I learned quite a lot by doing this.

It’s important to understand that the engine utilizes a naming system. Everything you define has a name that, so I hope, should be easier to work with. No need for ints, IDs, or stuff like that. You don’t name your child “1″ or “56735678″ – do you? :)

The engine is far from complete – I just want to share how far I have gotten in recent weeks. I’ll update this post as the engine progresses.

Engineered for simplicity in use and horsepower under the hood, the engine features:

* Utilizes OpenGL, thus platform independent
* Naming-based system
* Built-in texture catalog that stores your textures
* Textures added are automatically mip-mapped
* Unlimited textures
* Unlimited models
* Unlimited soft-lights (8 hardware lights, as usual)
* Up to 16 cameras, one can switch between them at run-time
* Automatic shadow generation for lights
* Shadows bend around arbitrary geometry
* Adjustable shadow quality, even at run-time
* Built-in Frustum Culling to ensure rendering speed
* Built-in W-A-S-D movement, can be enabled with one line
* Built-in 2D emulation for elements such as images

If you are interested in seeing some actual coding with it and the engine perform live, in color, HD and in stereo, please have a look at my latest DevBlog video (bonus feature length!) that shows how it’s supposed to work.

So here are a few screenshots.

Showing a simple cube and an Orion Relay, both casting shadows

Depending on resolution, shadow quality can be adjusted at run-time


There is support for 1024x1024px shadow maps, if your graphic card can support it. The setting is called “Ultra”. Possible shadow quality depends on the vertical resolution the engine is running at. If you run at 1920×1080, the Ultra setting becomes available. Also bear in mind that the higher you go, it obviously requires more memory.

I put in a little function that shows you where the light is, and in what direction it is shining. It will draw a line on screen (for now! I’ll improve it) so that you know what’s happening.

RN_EnableLightDebugging set to True

As soon as light is created, shadows are automatically added to the model you define as main terrain/indoor part.

Therefore, they automatically bend around non-planar geometry. Automagically!

Shadows bend around arbitrary geometry

Oh uh, one more thing. I put in a few 2D functions as well. They are not based on Max2D or any module in BlitzMax. These are pure OpenGL calls, allowing you to display and, of course animate, 2D elements (images for now, text to come).

Images can be the usual suspects – bmp, jpg, png. Each of those can be given a certain transparency value, much like SetBlend ALPHABLEND and SetAlpha. Except that this is performed in OpenGL and ortho-projection.

Two images being displayed – one without additional setting, the second with 50% transparency

This is the current command set:

----------------------------
CREATE REASON APP
----------------------------

RN_CreateApp(name:String , w:Float , h:Float, fs=False, mt=False)

----------------------------
SHORT CUTS
----------------------------

RN_CreateCube(name:String, noshadow:Int = False)

----------------------------
MODEL CALLS AND PROPERTIES
----------------------------

RN_LoadModel(name:String, file:String)
RN_SetModelColor(name:String, r:Float, g:Float, b:Float)
RN_HideModel(name:String)
RN_ShowModel(name:String)
RN_PositionModel(name:String, x:Float, y:Float, z:Float)
RN_RotateModel(name:String, p:Float, y:Float, r:Float)
RN_SetModelTexture(name:String, texname:String)
RN_ScaleModel(name:String, scale:Float)
RN_ScaleModel3v(name:String, x:Float, y:Float, z:Float)
RN_SetModelIsMainTerrain(name:String, value:Int)
RN_SetModelAmbientAndDiffuse(name:String, r:Float, g:Float, b:Float, a:Float=255.0)
RN_SetModelSpecular(name:String, r:Float, g:Float, b:Float, a:Float)
RN_SetModelShininess(name:String, s:Float)
RN_SetModelPickable(name:String, value:Int)
RN_FlipNormals(name:String)
RN_ModelX:Float(name:String)
RN_ModelY:Float(name:String)
RN_ModelZ:Float(name:String)
RN_ModelWidth:Float(name:String)
RN_ModelHeight:Float(name:String)
RN_ModelLength:Float(name:String)

----------------------------
LIGHTS
----------------------------

RN_CreateLight(name:String)
RN_SetAmbientLight(r:Float=51.0, g:Float=51.0, b:Float=51.0)
RN_SetLightPosition(name:String, x:Float, y:Float, z:Float)
RN_SetLightColor(name:String, r:Float, g:Float, b:Float)
RN_SetLightSpecular(name:String, r:Float, g:Float, b:Float, a:Float=255)
RN_SetLightConeValues(name:String, wideradius:Float=70.0, focusradius:Float=60.0)
RN_SetLightDirection(name:String, p:Float, y:Float, z:Float)
RN_SetLightRange(name:String, range:Float)
RN_TurnOnLight(name:String)
RN_TurnOffLight(name:String)
RN_EnableLightDebugging(debug:Int)
RN_LightX:Float(name:String)
RN_LightY:Float(name:String)
RN_LightZ:Float(name:String)

----------------------------
TEXTURE CATALOG
----------------------------

RN_AddTexture(file:String, name:String)

----------------------------
COMMON PARAMETERS
----------------------------

RN_SetClearColor(r:Float , g:Float , b:Float) 
RN_SetBloomTo(bloom:Int)
RN_AntiAlias(value:Int)
RN_EnableWireframe(value:Int)
RN_SetShadowQualityTo(value:Int)

----------------------------
CAMERAS
----------------------------

RN_SwitchToCam(name:String)
RN_RenameCamera(currentName:String, newName:String)
RN_NewCamera(name:String, x:Float=0.0, y:Float=0.0, z:Float=0.0, rp:Float=0.0, ry:Float=0.0, rr:Float=0.0)
RN_PositionCamera(name:String, x:Float, y:Float, z:Float)
RN_RotateCamera(name:String, x:Float, y:Float, z:Float)

----------------------------
MAX 2D EMULATION
----------------------------

RN_Text(x:Int, y:Int, text:String)
RN_LoadImage(name:String, file:String)
RN_ReplaceImageFromFile(name:String, file:String)
RN_ReplaceImageWithImage(name:String, pixmap:TPixmap)
RN_RenameImage(current_name:String, new_name:String)
RN_ResizeImage(name:String, x:Int, y:Int)
RN_DrawImage(name:String, x, y)
RN_SetImagePosition(name:String, x:Int, y:Int)
RN_SetImageAlpha(name:String, alpha:Float)
RN_SetImageVisible(name:String, value:Int)

----------------------------
BUILT-IN CAM CONTROLS
----------------------------

RN_EnableWASDMovement(value:Int)
RN_SetCameraMovementSpeedTo(speed:Float)

----------------------------
RENDERING
----------------------------

RN_Render() 
RN_Render2D()

Obviously that expands as I progress with the engine.

Reason is going to be available in 3 flavors, one which is free. If you’re eager to try this out yourself, I’ll let you know when I have something ready for you.

I am currently building a Wiki for the engine, so as soon as it’s ready to show for the public, I can also tell you if you like.

That’s it for the moment. I hope you find this project a little interesting.

See you around. And thanks for reading.




Related posts:

  1. Introducing Orion’s Gate, Reticulum, Corona UI
  2. Orion’s Gate: Real Time Ray Tracing concept
  3. [L-Day] The new wallpaper
  4. The calm before storm
  5. iPhone in UK

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>