Another Cycle, Another Update
by Simon Love · 07/18/2014 (1:21 pm) · 4 comments
Another 54 hours of work gone by...Another Blog post to show off!
Read the headers at least, you might find a few tips and tricks of interest!
First up, let's see what we're talking about.
Urg, Video capture doesn't really translate how smooth this runs or how clean it looks. Oh well...
I have spent a few hours implementing this odometer-like system to display the score.
It uses Scrollers and is 100% configurable. You can set however many digits you need (6 in the video example), you can add a value to the score and the digits will automatically roll for a preset amount of time to display the final score. You can interrupt this and add or subtract more points.
It's really dynamic and really cool. And it makes you love the Modulus operator.
This Score is displayed in a separate Scene/SceneWindow placed on top of the main game Scene/Scenewindow. As long as the SceneWindow's Modal property is set to false, all mouse input goes "through" it and is processed by the underlying game Scene/SceneWindow.
I have started playing with LiquidFun, thank to Mich Perry's implementation. Physics-enabled Particles with fluid and soft-body simulation? Yes please!
I've added a few things, the ability to change particle colors, apply impulses and Force, change the gravity scale, cohesion and the density of particle groups.
The above video starts out with a gravity scale of 0.0 and then switches to 1.0 after a schedule. It happens at around 8 seconds in the video.
The constant motion and waves is enabled by an ApplyForce method. Instead of pushing objects around, you actually push groups of particles. Lots of work to be done on this one but it's very very cool and opens up many possibilities.
Also updated it to 1.1, which was pretty trivial.
Every time I wanted to create something, I had to write custom script for it.
I always started out with good intentions but 10 minutes later and it's customized Spaghetti-code time!
Here's the way my new system works.
First I add a SceneObject and assign it a class via a simple function. In this example, the Class is WaterBody_GOT. GOT stands for Game Object Template. I love acronyms.
This calls an initialization function of objects of class WaterBody_GOT and returns the SceneObject in %MyObject. It also adds it to the Scene called MainScene.
WaterBody_GOT creates a Sprite blue rectangular sprite, two scrollers for the waves on top, a Buoyancy Controller and the LiquidFun Particles as seen in the video above.
I then add helper functions to WaterBody_GOT, easily manipulating everything which the compound object contains by sending commands to %Myobject. With this, I have managed to make a moving Buoyancy Controller, where the sprites and Scrollers move around with the body of water's physics object.
In WaterBody_GOT's initialization function, I create behaviors for everything.
- A RenderImage behavior creates a new sprite and joins it via WeldJoint to the SceneObject.
- A RenderScroller behavior creates a new Scroller and joins it via WeldJoint to the SceneObject as well.
- A BuoyancyController Behavior creates the Buoyancy Controller.
- An EdgesCollision behavior not only handles Collisions for this CompoundObject but allows me to
create Edges around the object by stating in plain English which sides I want Edges on.
Since this is a behavior, I can then easily use it anywhere I please. For instance, create a SceneBackground Game Object Template, choose the Background sprite and tell it to create Edges on all 4 sides with one simple command.
And if you want to customize your instance of your GOT, you simply need to write the helper functions, which will speak to the desired behaviors. Add to that the fact that if a Method cannot be found on your base SceneObject, T2D will search all Behaviors for the Method.
Anyways, super-powerful, extremely flexible and it means I can finally stop hand-coding everything a zillion times over. Import the GameObjects module in a new project and voila!
After messing around with LiquidFun, it became quite apparent that simply rendering dots for liquid particles wouldn't look right in a professional production. Even the basic rendering suggested by the API was modified as T2D didn't know of certain "recent" OpenGL commands.
I've thus started Frankenstein-ing T2D's openGL implementation. So far, I've managed to get all the modern OpenGL definitions in! No functions yet but they're a-comin'!
This way, I'm pretty sure that I'll be able to add in a few functions at a time without breaking everything. This allows me to test single systems properly and slowly add the features I want in a super-hacky way. Might do a few tutorials on these as I go along.
The goal being, obviously, shaders for the LiquidFun particles.
I have also made a simple module for a tabbed options screen. Resolution-Independent, it's not pretty but it works and saves your choices to a prefs file.

Audio volumes can be set independently (up to 32 channels) and the Master Volume fader actually controls the Simulation's listener volume.

If you've ever wondered what my eyes look at whenever I'm writing these blogs, make sure to take the tour.
See y'all in 9 days!
Read the headers at least, you might find a few tips and tricks of interest!
First up, let's see what we're talking about.
Urg, Video capture doesn't really translate how smooth this runs or how clean it looks. Oh well...
What's in the video
Score Scroller
I have spent a few hours implementing this odometer-like system to display the score.
It uses Scrollers and is 100% configurable. You can set however many digits you need (6 in the video example), you can add a value to the score and the digits will automatically roll for a preset amount of time to display the final score. You can interrupt this and add or subtract more points.
It's really dynamic and really cool. And it makes you love the Modulus operator.
This Score is displayed in a separate Scene/SceneWindow placed on top of the main game Scene/Scenewindow. As long as the SceneWindow's Modal property is set to false, all mouse input goes "through" it and is processed by the underlying game Scene/SceneWindow.
LiquidFun 1.1
I have started playing with LiquidFun, thank to Mich Perry's implementation. Physics-enabled Particles with fluid and soft-body simulation? Yes please!
I've added a few things, the ability to change particle colors, apply impulses and Force, change the gravity scale, cohesion and the density of particle groups.
The above video starts out with a gravity scale of 0.0 and then switches to 1.0 after a schedule. It happens at around 8 seconds in the video.
The constant motion and waves is enabled by an ApplyForce method. Instead of pushing objects around, you actually push groups of particles. Lots of work to be done on this one but it's very very cool and opens up many possibilities.
Also updated it to 1.1, which was pretty trivial.
GameObjects Component system
Every time I wanted to create something, I had to write custom script for it.
I always started out with good intentions but 10 minutes later and it's customized Spaghetti-code time!
Here's the way my new system works.
First I add a SceneObject and assign it a class via a simple function. In this example, the Class is WaterBody_GOT. GOT stands for Game Object Template. I love acronyms.
%MyObject = GameObjects.CreateGO(WaterBody_GOT, MainScene);
This calls an initialization function of objects of class WaterBody_GOT and returns the SceneObject in %MyObject. It also adds it to the Scene called MainScene.
WaterBody_GOT creates a Sprite blue rectangular sprite, two scrollers for the waves on top, a Buoyancy Controller and the LiquidFun Particles as seen in the video above.
I then add helper functions to WaterBody_GOT, easily manipulating everything which the compound object contains by sending commands to %Myobject. With this, I have managed to make a moving Buoyancy Controller, where the sprites and Scrollers move around with the body of water's physics object.
In WaterBody_GOT's initialization function, I create behaviors for everything.
- A RenderImage behavior creates a new sprite and joins it via WeldJoint to the SceneObject.
- A RenderScroller behavior creates a new Scroller and joins it via WeldJoint to the SceneObject as well.
- A BuoyancyController Behavior creates the Buoyancy Controller.
- An EdgesCollision behavior not only handles Collisions for this CompoundObject but allows me to
create Edges around the object by stating in plain English which sides I want Edges on.
%collision.initialize(%this._area, "left right bottom");
Since this is a behavior, I can then easily use it anywhere I please. For instance, create a SceneBackground Game Object Template, choose the Background sprite and tell it to create Edges on all 4 sides with one simple command.
And if you want to customize your instance of your GOT, you simply need to write the helper functions, which will speak to the desired behaviors. Add to that the fact that if a Method cannot be found on your base SceneObject, T2D will search all Behaviors for the Method.
Anyways, super-powerful, extremely flexible and it means I can finally stop hand-coding everything a zillion times over. Import the GameObjects module in a new project and voila!
What's NOT in the video
OpenGL 4.4
After messing around with LiquidFun, it became quite apparent that simply rendering dots for liquid particles wouldn't look right in a professional production. Even the basic rendering suggested by the API was modified as T2D didn't know of certain "recent" OpenGL commands.
I've thus started Frankenstein-ing T2D's openGL implementation. So far, I've managed to get all the modern OpenGL definitions in! No functions yet but they're a-comin'!
This way, I'm pretty sure that I'll be able to add in a few functions at a time without breaking everything. This allows me to test single systems properly and slowly add the features I want in a super-hacky way. Might do a few tutorials on these as I go along.
The goal being, obviously, shaders for the LiquidFun particles.
Options Screen
I have also made a simple module for a tabbed options screen. Resolution-Independent, it's not pretty but it works and saves your choices to a prefs file.

Audio volumes can be set independently (up to 32 channels) and the Master Volume fader actually controls the Simulation's listener volume.

Studio Tour
If you've ever wondered what my eyes look at whenever I'm writing these blogs, make sure to take the tour.
See y'all in 9 days!
About the author
I am here to help. I've worked at every imaginable position in game development, having entered the field originally as an audio guy.
#2
In any case, I really doubt I'll be using 4.4 features, what I want it easily handled by OpenGL 2.x
07/18/2014 (8:27 pm)
@Jeff : Good to know and thank you!In any case, I really doubt I'll be using 4.4 features, what I want it easily handled by OpenGL 2.x
#3
07/19/2014 (7:45 am)
Very cool. Glad to see my base implementation being put to good use. Now I just need to finish my uber-water implementation, which includes surface splashes, metaballs, and new LiquidFun rendering.
#4
There's plently of sites out there that let us donate money, we need to find one where we can send you some extra time Mich, to work on all these cool things you have planned. :-)
07/19/2014 (3:19 pm)
Do I really have to wait 9 days for the next update?! (ok maybe it is only 8 now) Great stuff Simon. Keep up the good work.Quote:
Now I just need to finish my uber-water implementation, which includes surface splashes, metaballs, and new LiquidFun rendering.
There's plently of sites out there that let us donate money, we need to find one where we can send you some extra time Mich, to work on all these cool things you have planned. :-)

Torque 3D Owner JeffH
Otherwise great job Simon! :D