Monday, October 6, 2014

Random Thoughts #0

99% of programers work is not visible to the end user. You can render a texture on screen or play an audio file and people can more-or-less tell how much work it was put into making it. But how can you tell how much work did it take to get that texture even appear on the screen ?

Bla, bla, bla... On the left of the blog in the Broken Mug Engine section is a link to the "Changelog" page, where I will be listing the changes and fixes made to the engine, so you can see what is going on behind the screen.

***

I had big problems with dynamic light, so I rage quit, and didn't touch the code for several weeks. Then I bought a new PC after 9 years. I spent a lot of money, just to be sure it will be a build that will last. And what happened ? The Corsair power supply doesn't work properly, so I had to send it back. Now I'm waiting for it to get either replaced or fixed.

So I'm back in 2005 with a PC that takes forever to build the engine. At least it never needed any fixing. To get back on topic, I fixed the dynamic light problem and since I have no idea what to do with it, or what to do in general with the engine, I just clean all the messy and crash-friendly code. Some of the GUI features now run automatically, so I don't have to write redundant code. Also connecting and disconnecting various in-game entities is also done in the background and hopefully it will prevent crashes, like when I was doing it manually.


Tuesday, September 2, 2014

Dynamic 2D light

Since I have no AI that could use line of sight, I revisited my old dynamic light code(which was used to make line of sight in the first place), and replaced it with the line of sight stuff. It inherits a sensor class which keeps track of objects inside it, and then calculates the shadows/final light shape for rendering. You may notice lights are rendered with additive blending.

If you look at the health packs you will see this methods flaw. It is vertex based, so if a texture has transparent areas, you can see obvious gaps.

It also currently only supports convex shapes, and I would like to make light outlines on the sprites that the light hits.


Thursday, August 28, 2014

Line of sight

Working on some kind of 2D line of sight.

It's cool that I can get the area of the enemy/player which is visible, so let's say if enemy can see only a small part of the player it doesn't have to attack right away, but come closer or something... Just like for the destructible terrain I am using Clipper for this.


Thursday, August 21, 2014

Worms like destructible terrain using Box2D and Clipper

I made a little demonstration of Worms like destructible terrain made using Box2D chain loops and polygon clipping library called Clipper.



You can download it or read how it's done here:

Friday, August 8, 2014

Event listeners - player controls

I've made a new type of event listener which triggers an action when player presses a keyboard key or mouse button. Still need to make it block/unblock player controls, so the player sprite doesn't move if it controls something else, but whatever...

As an example I made a vehicle which can go left, right and break, all via event listeners and actions that control a Box2D joint motor. It's all done in the map editor.


Tuesday, August 5, 2014

Poly2tri and Box2D

Using poly2tri to triangulate complex polygons, then using the triangles to form Box2D bodies with multiple fixtures (triangle=>fixture). Box2D only supports convex polygons, this way I can make concave ones too. This way I could simulate almost pixel perfect collision, but that is overkill in most cases.


Wednesday, July 30, 2014