WolfgangSt's blog

GSoC project: Sprite engine overhaul - Weekly A&O report

Weekly A&O report

Hi everyone!
This is the very first of my weekly "Achievements and Objects", which will give you some ideas on what I've done so far and what i've planned for the next week.

Achievements

The first big piece of work that I already finished - actually I have done this during GSoC application period - is the rectangle packer.

The general problem is to fit a set of given small rectangles inside a larger rectangle which shall be as small as possible. The reason for wanting this is that graphics hardware prefers working with a single or few large textures over hundreds of small ones.
Unfortunateley there are no known algorithms that solve this problem perfect within feasable time.
Thats why some algorithm that doesnt necesarrily produce perfect results but at least "quite good" results is required.

In particular I've ported the MAXRECTS packer using the bssf heuristic as described here:
More Rectangle Bin Packing
This page contains quite a lot of in depth information about the general problem and as well visualizes different approaches.

The packers are licensed as public domain and thus the port is safe to be used for hedgewars.

You can take a look at my port here uBinPacker.pas.
As well try the test app test.pas

Last week I pretty much started messing around with the games code base.
Currently in the engine a sprite is represented like this: (ommiting irrelevant members)


TTexture = record
w, h: LongInt;
rx, ry: GLfloat;
vb, tb: array [0..3] of TVertex2f;
end;

w and h represent the physical dimension of the sprite in pixels.

GSoC project: Sprite engine overhaul.

Hey everyone,

I'm yet another of the few selected students, who is gonna work on Hedgewars during this summer. As Medo42 I'm located in Germany.

My work will be under the hood of Hedgewars.
I am gonna bring the sprite engine from a rather ancient version to recent OpenGL. I'll as well do several internal changes that will decrease the memory and communication stress between the system and graphics hardware.

For those having some interest of the strategies involved to achieve this, I'll refer to OpenGL ES Programming Guide for iOS

Even tho the topic of the link above is iOS specific you can expect that my work will improve performance on almost any system.

As you might have figured, the main purpose is groundwork for bringing/optimizing Hedgewars to mobile systems that support OpenGL ES2. Hopefully this might as well contribute as a foundation for the javascript (WebGL) port, which itself is covered by another student this year.

You might expect quite some cooperation between these two projects due to the overlap.

Syndicate content

User login

Copyright © 2004-2017 Hedgewars Project. All rights reserved. [ contact ]