Elsewhere there are things that we all miss, yet it takes just one to notice...

LibGdx and Overlap2D issue (and HNY!)

Oh yeah…

Happy New Year!

Anyway, just like the classic meme, I carried on from Dec 31st into Jan 1st. I did watch some fireworks on the CCTV and heard them. That was about as much as I could put up with. Definitely a grump but I don’t care.

The issue I’m having at the moment lies with the latest version of LibGdx, which is 1.9.8, and it’s animation class which doesn’t work with the Overlap2D package. That’s kind of a big ‘DAMN!’ thingy. Apparently it works with version 1.9.4 or less. I found the problem also on stackoverflow too.

Another problem is the Overlap2D website has been down for quite some time, a month or more maybe.

The project is hosted on github, but I’m as of yet unfamiliar with building it even though I’ve downloaded the source. I’ve still yet to get around to that.

So… I’m stuck…

I’ve got my scene loaded up and displaying perfectly. As soon as I add an animated sprite to the scene, it doesn’t want to work. I’ll dig deeper later on today maybe.

One thing I do like about LibGdx is, after spending a lot of time with DarkBasic Pro, many writing C++ plugins, it is much faster and smoother. The only thing I need to add is native libraries to cover all CPU’s.

EDIT:

Up until I find a solution, it’s back to Linux. I can do much more with that OS.

Java vs C++ for 3D mesh building

A few days ago, playing around with LibGDX again I was getting back into 3D programming and created a very simple demo of a load of spheres and the camera rotating around the scene as below:

Which on my laptop ran just fine. It took about a second to generate all the meshes for each of the spheres.

Took bloody ages on my phone though, even though it’s a quad core 64 bit android phone. Approximately 5 to 8 seconds. Ouch.

None of this nonsense in C++ for starters. I know this from a very old project I was working back in the day. Procedural map generator. More about that here: PROCMAP DBP LINK

So for the last couple of days (actually on the evenings because of work), I’ve looked into creating a single sphere mesh and then duplicating it. In LibGdx

A minor problem to start off with is that a lot of LibGdx’s mesh generators have been deprecated and I don’t know how long for now, and I can’t find examples on how to use the new stuff. This would have made things easier, but that minor problem got bigger.

It seems that ModelBuilder only runs on the GL thread, so I tried the MeshBuilder. No luck there after trying to hunt info down on google, (Maybe google is hiding it from me :P) how to use the thing.

So I gave up, closed the project, might go back to it if the next step fails.

I’m waiting on a huge update from Qt. Oh! At this time it has finished downloading and updated.

The previous versions of Qt didn’t work with the latest Android SDK/NDK. Fingers crossed with this one…

Next…

LibGdx TextureAtlas (non .pack file)

Okay, I hit a block when I was starting to think about writing a quick networked multiplayer shoot em up game in LibGdx.

LibGdx texture atlas’s are very handy things because you can store a load of smaller images in one image. This also optimises the GPU draw routines because it doesn’t have to keep swapping textures for each sprite drawn.

I found pre-made free to use sprites fromĀ Kenney.nl, below is a section of what they look like:

spritesheet

Unfortunately though, LibGdx uses .pack files for it’s texture atlas’s and this one come with one that looks like this:

<TextureAtlas imagePath="sprites.png">
 <SubTexture name="spaceAstronauts_001.png" x="998" y="847" width="34" height="44"/>
 <SubTexture name="spaceAstronauts_002.png" x="919" y="142" width="37" height="44"/>
 <SubTexture name="spaceAstronauts_003.png" x="824" y="0" width="50" height="44"/>

...
</TextureAtlas>

Which is completely different to a .pack file.

So without further ado I decided to test out an xml parser to retrieve all the sub-regions from the xml file.

Test code as follows:

[snippet id=”19″]

So, armed with this now, all thanks mainly to working with GWT, I can quickly move on to creating my own class to generate the texture atlas in LibGdx.

Scroll to top