We're a small indie-team that comes together every Friday to develop our first game called Caromble! It's based on classic breakout, changed to be 3D in art and gameplay. Caromble! has realtime physics and more diverse challenges. Have you for instance ever played a side-scrolling breakout platformer level?

Please support us if you can: Vote for us at Greenlight, so we can publish Caromble! ourselves on Steam. And tell your friends, family and every stranger you meet that you like the game! Facebook us if you like.
You'll find screenshots and media on this page - and current updates on the blog below. Comments and critique are very welcome. Your Caromble! Team.

Game Development Blog:

Crunch Time!

 

Thomas

Normally, we only work on Caromble! every Friday. This week though, for the first time ever, we will work on Caromble! full-time. We all took a few days off and the coming week + weekend we will be crunching our way through the last few levels.

After that, we can finally start to polish things up and add juiciness everywhere (although we will still be adding challenge levels).

Expect more updates during this week! Follow us on twitter: @Caromble



Since I was a kid, I loved to create something huge with Lego blocks and then… destroy it. Or make a huge card house with my grandfather, like 7 stories high, and then… make it collapse. I’m not unique in this. Many people seem to like destruction, witnessing  the several popular scientific television shows in which objects are blown to pieces or dropped from a crane.

caromble may2013 screenshot01

I think that besides seeing things collapsing, people find it even more satisfying  to be the cause of some kind of destruction. Whenever I see a structure of domino stones, my fingers itch and I want to be the one to tip over the first stone. I think we love to be the first part in a causal chain. I’m not  sure why we love it so much, but perhaps it creates a feeling that makes us extra aware of being alive. I experience a similar feeling when travelling by bus. Whenever I need to press the stop button, I also want to see the stop sign lighting up because of MY button press; “Yeah, I did that!”. Perhaps instead of “I think therefore I am”, the statement “I cause therefore I am” suits us better.

Caromble! is in its essence a breakout game. A game in which the player moves a paddle, aims and bounces the ball, hoping to destroy some blocks. Somehow it so much more interesting if one of these blocks was supporting a big structure that is now collapsing. “Yeah, I caused that… again!”. That specific feeling, that is the added value of incorporating a physics engine into Caromble! in my opinion. The core gameplay may not always be very different from an ‘ordinary’ breakout game, but the fact that the player can be the first step in a causal chain that leads to destruction, explosions and chaos , makes the experience so much more satisfying. Here is an awesome video from OK Go that demonstrates this idea through a Rube Goldberg machine. And how satisfying does this look (we use the Java port of BulletJBullet, for our physics)?

The interesting thing of incorporating a physics engine in your game, is choosing when and how to intervene in the physics simulation. Without intervention (moving, creating or destroying objects in the simulated world) there is no gameplay. In Caromble! the single action a player can perform (besides using power-ups) is moving the paddle. With the paddle, the player can influence the most important object in our  game; the ball. The ball is a peculiar object. It takes part in the physics simulation, but it is not totally governed by it. If that would be so, friction of the floor with the ball (which both are not zero) would eventually result in a ball at rest (zero velocity). That would be quite a boring game. That is why the ball is governed by more rules than those of the physics simulation: OUR rules.

physics juice For example, each level has a desired ball speed. Whenever the ball speed deviates from it, we make sure it quickly converges to the desired one. Also, we handle all ball collisions ourselves. The collision detection is done by the physics engine, but based on the ingoing direction and the normal of the object at the collision, we determine the outgoing direction of the ball ourselves. One of the reasons we do this, is to ensure that  there is some minimum bouncing angle. Whenever the ball bounces almost horizontally between two opposite side walls, we don’t want it to take forever before  it approaches our paddle again.

Finding the balance between simulation and intervention is quite the challenge. Sometimes, mostly after heated discussions, we decide to add a new intervention rule to our physics simulation for the sake of gameplay. How far should you go with this? Well, we think that you should aim for a certain level of control for the player, such that whenever he/she loses a ball, it should have been possible to prevent this using skill. However, the simulation should add a factor of unpredictability and surprise. You know that once you hit that one block, that structure will collapse, but how exactly, that should be somewhat of a surprise. We aim to get this balance right and I think we are on the right track. As long as Caromble! will make some of you players experience the feeling that I got when tipping over a Lego structure, I am very satisfied.

Java Game Programming

As you might already know, we use Java to build our game (+engine) in. While we wrote all engine code ourselves, we do use Ardor3D (in combination with LWJGL) for graphics and JBullet for physics (love them both).

Because Java is discredited quite a lot these days (mostly security issues), we wanted to write something about our experience using Java for game programming.

  • Is Java safe enough?

While there were numerous security issues found in Java the last few months (Java 8 even got postponed because of it), it won’t necessarily trouble you in using Java for games. The most problems found in Java all have to do in running Java Applets, not with running Java on desktop.
Of course, fewer people will install Java with all the commotion going on so it’s a little harder to make you game run out of the box. Luckily, it is pretty straight-forward to bundle the Java Virtual Machine with your game (as the good people over at Puppy Games already pointed out).

  • Is Java fast enough?

Short answer: yes! Longer answer: but like with every language, there are a few pitfalls… While it is unlikely that Java will ever reach the raw power of optimized C++ code, it does offer speed that comes very close while keeping its readability (of course, opinions will differ) and safeness (no overflow/pointer errors). On top of that, memory leaks are way easier to prevent.
On the down side, there is a warm-up time. It takes a while for the Just-In-Time compiler to compile the most used methods from byte-code. We work around this by running our menu in the game world so once you take the controls everything runs smooth. And while having a garbage collection makes 95% of working with objects a lot easier, it isn’t perfect either. This brings us to our next topic:

  • The Garbage Collector

Having a garbage collector at your side can be a real blessing when writing a game. You’ll never (well almost) have to worry about running out of memory because of memory leaks. But it comes at a price. As you know, unlike languages as C++ and C#, Java does not have structs -you cannot allocate simple groups of primitives on the stack and pass them by value. Therefore, even simple data like the typical Vector3 (basically 3 floats) have to be presented with objects. While the garbage collector normally does a great job cleaning things up for you, having this insane amount of garbage every frame will definitely lead to slowdowns.
The Java virtual machine will try to clear most garbage with minor garbage collections. That are small garbage collections that will hardly take any time (and will not slow your game down). If you leave so much garbage that the minor garbage collections cannot keep up, Java will do a major garbage collections to prevent your application from running out of memory. These major collections will make your game stutter every few seconds (killing for any game with fast-paced game-play).
The way to solve this is making sure the JVM can clean up all garbage with minor garbage collections. So, how do you do this? It’s simple; do not leave too much garbage!
We solved this by pooling our small/most-used objects. But how do you make sure that your temporary objects are always returned to the pool? We do this with the auto-closable interface in Java 7. We use (abuse?) the new “try()” functionality in the same way you would use “using()” in c# like this:

try(Vector3 temp = Vector3.getTemp())
{
… Some calculations with the temp vector …
}

And in the Close() of the Vector3 we put the temp vector back in the Vector3 pool of the current Thread. You will need a object pool per thread. Normally this is done using the ThreadLocal class but since we spawn our own worker threads there is no need for it; we get the temp object directly from the pool of the current Thread.
Of course, when pooling objects, it really helps to place some tactical asserts in the classes to make sure it doesn’t get altered while inside the pool (you should not hold references to those objects outside the try{} clause.
Also, it might help triggering a major garbage collection just after switching levels by calling System.gc(). This make sure all/most old data from the previous level is cleared up.
Most of the time, you only have a handful of methods that really spawn a lot of garbage, so grab the Java Visual Virtual Machine from the JDK to (easily!) find these methods and optimize those. Don’t go insane on trying to optimize all code, concentrate on the places where it matters.

  • UPDATE: Escape analysis

As Adrian Papari points out below, Java uses escape analysis to automatically place objects on the stack or replaces them with simple primitives (and thus preventing allocations & garbage). But for our game Caromble! pooling of the Vector3 at some critical places definitely was a must to get constant performance. To get to the bottom of this, I made a test app inspired by this example but made it a bit more complicated to resemble actual game code more closely. Still I made sure that only Vector3 classes where used (no string allocations etc). The results can be seen in the image:

Capture of Java Visual VM Top: escape analysis disabled Bottom: escape analysis enabled (default)

Capture of Java Visual VM
Top: escape analysis disabled
Bottom: escape analysis enabled (default)
The blue lines on the left show cpu time spend on garbage collection

As you can see, with escape analysis disabled the garbage collector was doing minor garbage collections the whole time (taking up quite a lot of cpu time) but still used heap memory was increasing still. Once it the it would have run out of heap space, a major collection would have kicked in to clean thing up.
As for the example with escape analysis, it runs a whole lot better, hardly spending time on garbage collection. But what is interesting to see is that it doesn’t keep the heap space constant! While it does take care of not allocating most Vector3′s on the heap, it does not optimize away all allocations of the Vector3 class and still some garbage collection is taking place.
This explains why in some extreme cases like game programming object pooling might still be useful.

  • DirectBuffers

While the JVM garbage collector is pretty good in handling large amount of garbage from objects, be very careful with native/direct buffers (you need those to communicate with OpenGL). Leaving a lot of direct buffers lying around will lead to major slowdowns pretty soon that can last several seconds! So be sure to reuse direct buffers (mostly mesh data) as much as possible.

To conclude, if you take note to the above and work your way around it, Java is a great language to write your game in. But yeah, like every other language, getting real time performance will always take some effort.

Bug hunting

Since my laptop crashed some time ago, I use my girlfriend’s laptop on Fridays. Somehow, the second Friday I used her laptop the game did no longer run. This could mean two things: A – we introduced a bug, or B – my girlfriend (de)installed some interesting stuff. Since I think option A is highly improbable, I first checked what my girlfriend had changed. Surprisingly, she did not change anything. So I put on my pest control gear and went bug hunting.

Searching binary through our revisions I found the version which caused the bug. It happened to be a change committed by [editor: thou shall not name and shame]. Fortunately, it wasn’t a big change.

Three hours later. The issue seemed that loading images of particular sizes made Java crash on that laptop. But, WHY?! As a programmer it’s very unsatisfying not to know what really causes the problem. For now, we treated the symptoms and changed those images to a different size.

Finally, I want to apologize to my girlfriend for blaming her, and for spilling tea on her laptop while writing this post.

Are both words that would give you a lot of points if you were allowed to use them in Scrabble. They are also (amongst many others) the building blocks of Caromble!.

For most of us, Caromble! has been the first real game we have ever worked on. The Caromble! editor is also the first level editor most of us have ever used. Since we are not using an off-the-shelf game engine, we are also not using an existing editor. We would have to create our own editor as we went along.

A screenshot of the editor. The red boxes are actors, which control the game-play  The lines indicate the relations between the objects. This system will make the camera switch position as the ball shoots over the ramp.

A screenshot of the editor. The red boxes are actors, which control the game-play The lines indicate the relations between the objects. This system will make the camera switch position as the ball shoots over the ramp.

The editor (as we call it) grew (and grows) along with the game. I would say in terms of age the editor is now in its puberty. To be more precise, the editor is in that stage of puberty where body parts lose track of each other and start growing at their own rate.

For a piece of software this means that some functionality is mature (like the stuff Raymond wrote about two weeks ago), and some other stuff not so much. It wasn’t until about a year ago that we added some sort of actor system, that allows you to control object interaction from within the Editor.

The late addition of such a core system lead to an explosion of all sorts of exotic actors with even more exotic names. Those in the title are firmly among my favorites.

To return to my analogy, puberty is a crucial phase of development, although it can be challenging at times. Because we needed the actors, this part grew a lot and right now is  a bit out of proportion. As the Editor ages and eventually will reach adulthood, everything will grow back into proportion.

Right now we are focused on creating game-play, and the editor doesn’t get all the attention it deserves. We’ll give it that attention before (and if) we release it (after we release the game).

 

 

soft_particlesSince the release of Caromble! is getting closer and closer, we spend more and more time juicing things up. Basically this means adding lots of special effects in places where a player expect feedback from the game. For example, showing sparks and smoke when the ball hits an object.
A lot of these effects are implemented through particle systems: you blend lots of 2D textures on top of each other to get a nice volumetric effect. This Friday we added some improvements in the rendering of particles.

The first problem you have with these flat particles is that you get creases where the particle intersects with the other scenery (see the ‘disabled’ image). Luckily, these artifacts are pretty easy to clean up. Since we already have the distance from every pixel towards the camera, we can easily fade the particles near the intersections. As you can see in the ‘enabled’ image, no artifacts!

The second issue we had is that some of our particles have very high velocities. A particle traveling with a high speed might cross the whole width of the computer screen within just a few rendered frames. This causes the particle movement to look choppy. But why does a ingame particle rendered at around 60fps looks choppy while a moving ball in a movie (typically 24fps) seems to move smooth? The answer is simple: Motion Blur.
For a good example about the importance of motion blur, check this website.

While I would love to add full scene motion blur, we would have to change too much of the rendering pipeline to get it to work (and it would strain slower hardware too much as well). Therefore, we chose to only fake motion blur for particles. Doing this is very easy, we simply stretch the particle in the direction it is moving in (screen space) and fade it depending on its speed. This will make the particle movement seem a lot smoother.

Level editor

Caromble! is our first game and it’s a great experience to create a fully fledged game. Although we are a small team of five, our goal is to deliver a quality game which we can be proud of.

Because we only work on Fridays, time is precious. But, beside our life of game making on Fridays, we sometimes spent time on our personal lives. We allow each other to go on a business trip, exercise for a stage play, host an art gallery, and go skiing. So occasionally our schedule takes in a critical hit when someone sacrifices a Friday to gain life experience points.

On the other hand, we recently build some time saving features into our self-made level editor. Some minor ones are a relief, like auto-completion of certain input fields or the option to ignore invisible objects while selecting visible objects. But the major one that scores most thumbs up: the game now runs within the editor! This really is a huge time saver. Designing and creating levels has always been fun, but the small and big improvements on the level editor adds to our quality of life.

Hopefully someday you may experience the delights :) of creating Caromble! levels as we consider to release our level editor.

Interview on True PC Gaming

Pascal gave an interview to Adam Ames of the truepcgaming.com – and covered quite a few areas, including his view on Downloadable Content and the current DRM struggles in the industry.
Our marketing efforts are taking us some time … lot’s to learn, but it’s nice to see them bearing fruits.

Heavy stuff

Using a physics simulation to drive important parts of the game can have some unexpected consequences. Caromble! levels often start small, and the size increases throughout the level. Initially we had the ‘bug’ that at large scales, the physics felt very slow. Almost like buildings would collapse in slow motion.

Easily fixed I thought, if the buildings don’t fall fast enough, I’ll just make ‘m really really heavy. Simple!

Except that it didn’t work. After a good afternoon blaming the physics engine, I finally sat down and did some thinking.

What if we take two imaginary, identical balls, and a 100m tower on a wind-still day. We fill the first ball with lead, and leave the second ball empty. At the exact same time you drop both balls.

Now the question is, which one will hit the ground first?

Quite unlike I expected, they will hit the ground at the exact same time.  Why? Because of Newton of course.

The formula for the speed of a falling object (on Earth) is v = gt . So the velocity is the amount of gravity, times the time the object has been falling. The mass of the object doesn’t come into it at all.

So to come back to Caromble! Heavy buildings don’t fall any faster than light buildings. But increasing gravity will do the trick.

Proof:

Q.E.D.

In Caromble! it is possible to charge the paddle and give the ball a boosting power such that it will not bounce off objects, but goes right through them. Adding the charging mechanic would make the gameplay more interesting and gives high-score hunters more possibilities. However, we have been struggling with the implementation. How can we strike the right balance between a powerful powerup and not making the game too easy?

In our first implementation, the paddle could be charged in a continuous manner; the more the paddle was charged, the more boosting power the ball would get. If the power was maxed out, we would not only boost the ball, but also give it the ability to crash through objects, instead of bouncing off them. As a trade-off for using this power, we reduced the movement speed of the paddle significantly, making it far more difficult to reach the ball.

For some reason, this did not feel right. Blocking the paddle was too annoying, and it seemed impossible to find the right speed for charging. Either players would charge all balls, or none at all.

Also it felt a bit gimmicky as it was not needed to complete any levels.  To solve this we introduced hitable blocks that could only be destroyed with a charged ball.

Now, after several tries, we finally found an implementation for the charge mechanic that feels in place. Instead of boosting the ball proportionally with the amount charged, we only have two possibilities now; the paddle is either fully-charged, or it is not charged at all.

Pressing the charge button (LMB or SPACE) fills the charge meter. While  charging, the paddle cannot move at all. When the button is released, the meter empties quicker than it was filled. If the ball hits the paddle when the charge meter is not full, nothing  happens.

However, if the charge meter is full, the paddle is charged, and stays charged until the ball is hit. The charge button can be released, and the paddle can move freely. Having the possibility of aiming the ball whilst being charged, seemed to be the missing piece of having a good charge mechanic. It works and feels good. Now all we need is an awesome graphics effects for charging the paddle and boosting the ball.

Because pictures tell more than a thousand words, here is also a video of the Charge mechanic (charge meter in upper left corner):