Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Tuesday, 7 December 2010

Modelling with DeleD

Some thoughts on a workflow within DeleD, the world editor I'm using to build my levels with for Discretion.

1. Build world
2. Triangulate world (divide non-triangular meshes into triangles)
3. Apply materials and fix U/V mapping where necessary
4. Export

It's important to do as much modelling as possible in 1. before proceeding to the next steps, because the easiest way to ensure everything is triangulated once and only once is to select all objects then do triangulate. It's necessary to do 2. before 3. because U/V mapping a non-triangular polygon doesn't always work too well.

The Wavefront .obj exporter for DeleD has an extremely useful 'scale' option which allows you to model at the scale DeleD was designed to be used at instead of at real world (game) scale (mine is 1 unit = 1 meter which in DeleD is way too zoomed in). The triangulator in the exporter is broken however, so make sure you triangulate using the geometry toolbox instead.

Hope this helps someone!

Thursday, 11 November 2010

Java.String memory leak

Or "How I just saved myself 3 meg of precious Android heap memory".

I always glazed over whenever I came across how Strings are implemented in higher level languages. The most important advice I ever came across concerning them was "use a library that does all that string stuff for you". Of course I can make reasonable assumptions about how Java does strings:

1. There's a char buffer somewhere in there storing sequences of raw characters
2. It probably does something clever with them along the lines of the same way I do textures

So what happened? A loader parses an entire object file into a string, then passes a tokenized element of that string into an object as the object's name. It all seemed fine till I ran the Eclipse Memory Analysis Tool, when I found at the top of my memory usage hitlist a bit more than 3 megabytes of char data. As in, a couple of raw char[]. Full of, guess what? My entire object file.

"What's happened here?", I thought, stroking my chin. A closer look at my object in the debugger (a Submesh) revealed that sure enough, its name (supposed to be something like "grp 1"), which is a String, has the entire object file in its buffer. The String object stores an offset and length into the character buffer. The garbage collector looks at the 3 meg buffer and says "well, this Submesh object here still has a reference to this sequence of data, so I can't delete it!".

The fix is trivial: construct a new string from the passed in string, which makes a new buffer and frees up the old one for the GC's unreferenced memory hit squad.

I thought I'd post this because without running the MAT I never would have known I was leaking 3 megs of memory. It's worth checking.

Monday, 25 October 2010

Looking for a freelance 3D Character Artist

3D Character Artist (Freelancer) required for Smartphone RPG project

Red Sky Forge is a new startup developing games for Android smartphones. It currently consists of Dave Clayton, a programmer with more than 6 years of experience in software development, including experience on two released games titles (PC and PS3).

Discretion is a Role-Playing Game with a release date of Q1 2011. We require assets for the 3D game environment including 3D character models, textures and skeletal animations. As Smartphones are low to medium resolution with small amounts of memory and graphics processing power, the assets must have a low resource footprint.

The project requires the following deliverables over two milestones:
* 13 low-poly rigged models (10 humanoid and 3 animal)
* 42 textures for the models (the game characters re-use models with different textures)
* 17 animations

The project deadline is January 2011.

Please contact creative@redskyforge.com for the creative brief with your portfolio and relevant experience.