Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Irony

Pages: 1 [2]
Support / Code Snippet: Faking unlimited viewing distance
« on: December 29, 2013, 01:11:04 pm »
From time to time, I will post a few code snippets that proved useful while working on Armada. Maybe someone can use something for their own projects.

One problem that I ran into was the limited viewing distance. I thought that just setting the farplane value high enough would solve it, but there is actually a hard limit given by the hardware and/or OpenGl (not sure about that).
I wanted to have a planet that is far away but still visible (and approachable). While it would be possible to fake something with billboards, I found a solution that uses real geometry and actually pretty simple.

Code: [Select]
public class Planet extends Object3D { //It's better to not use Object3D directly for your game objects, but I do it here for simplicity

  private SimpleVector realPosition, camPos = new SimpleVector();
  private SimpleVector v = new SimpleVector; // temporary vector
  private final static MAX_VIEWING_DISTANCE = 5000; //this should be a safe value for most devices; make sure your farplane value is higher than this

  public Planet(SimpleVector position) {
      ... // init Object3D here

     realPosition = new SimpleVector(position); //Save "real" position of planet in another vector as the object's physical position will change

  // this is called in every frame update
  public void update() {
    world.getCamera().getPosition(camPos); //position of used camera

    float dist = realPosition.distance(camPos);  //calculate distance camera<->Planet

    if (dist>MAX_VIEWING_DISTANCE) { //outside of the viewing distance -> do projection magic

setScale(MAX_VIEWING_DISTANCE / dist);    //shrink the object

     // Now that we made the object smaller, put it closer to the camera

v.set(realPosition); //Set helper vector to planet position
v.sub(camPos); //calculate direction vector from camera to planet
v.normalize(v); //and normalize it
v.scalarMul(MAX_VIEWING_DISTANCE); // Calculate new position within viewing distance
        v.add(camPos);  // add camera vector to get final object position

  //Move it!

   else { //planet is within viewing distance; reset size and position to real values

Projects / Armada Alpha release!
« on: December 03, 2013, 10:58:18 pm »

The Space Combat Sim Armada has reached Alpha Status. Get the APK here:

The easiest way to get it is by opening the link above on your Android browser.
Alternatively, you can download the APK to the PC, transfer it to your mobile device and install it from here.

Alpha status means:
  • Graphics (GUI stuff mainly) and some sounds are not final
  • There will be a few tweaks to the missions etc.
  • You will encounter some bugs.

Note that you need a pretty potent device, preferable with a 5" or bigger screen, for full play experience. 
In-game payments are not active, but you get 99 instant repairs and 1000 startup credits instead.

Have fun!

edit: you can also try to scan this QR code to get the game

Support / Collision detection only working occasionally
« on: July 25, 2013, 10:04:06 pm »
That's strange.. when I fly my jet into a space station (about 5x the size), often fly right trough it. When I turn around and try it again one, two or three times, the ship crashes okay. Same thing happens when colliding with other objects (all bigger than the jet)

Code snippet that is called every frame:

Code: [Select]
if (model.checkForCollision(xAxis, (float) (speed*ticks)/100) != Object3D.NO_OBJECT) {

(xAxis points forward)

Already checked:
  • latest Engine version
  • Collision_check_self is set on jet model
  • Collision_check_others is set on space station model
  • Objects are all built
  • Tried to play around with the "step" parameter making it longer/shorter

Still, only collides 1 out of 3 times.

Support / Serialized object displaced/different center
« on: July 03, 2013, 09:19:59 am »
I used the mesh serializer plugin to convert my 3ds files.

.3ds looks like this:

.ser looks like this:

The red gun mounts are projected from child objects with identical relative positions in both cases.
Also, when playing the game and the camera is mounted at (0,0,0) looking forward, the guns are not firing symmetrical.

So it seems the ship model itself is slightly displaced or rather the center is calculated different, so relative positions change from 3ds.

btw, I'm calling world.buildAllObjects() in both cases.

Support / Billboarding causes GC [update]
« on: June 23, 2013, 02:13:15 pm »
After seeking the reason for frequent GCs in my code for half of last night I found it's the ships' engine glow (a semi-transparent plane with additive blending).
To be exact it's the billboarding on them. Removing setBillboarding(true) eliminates nearly all GCs.
I suppose I could do the billboarding calculation myself, but maybe it's possible for you to take a look. Thx!

Support / Texture error on Adreno GPU
« on: June 21, 2013, 09:10:39 pm »
Hi, this is how it's supposed to look:

When I move only a little bit away, the texture goes crazy, showing large black spots that jump around and get bigger (it looks worse in motion than on the screenshot)

That happens on the Xperia Z Tablet which has an Adreno 320 GPU. It does not happen on the Note.
Is this some depth buffer issue? Is it that bad on this chip?

It seems to be related to geometry, the more complex the worse, a simple sphere does not show it at all:

Also, the red color banding is quite bad, but this also on the Note and may be related to the screen technology (as far as I know I use 32 bit textures)

Bit disappointed after buying this 500 Euro Gadget only to find that my game looks worse than before :(

Support / Changing rotation pivot at run-time
« on: April 06, 2013, 03:24:19 pm »
There is a cylinder C with two dummy child objects at the top (T) and bottom(B).
I set C's rotation pivot to B, and do some rotations which work as expected.

When I switch the rotation pivot to T, C suddenly switches its orientation.
I suppose this happens because the new pivot point gets "melted" with the existing rotation matrix.

Is there a way that I can keep the orientation of C as it is, while still having a new pivot point for future rotations?

edit: I had a stupid error in my code that caused the orientation change. The problem now is that the object makes a "jump" when I change the pivot. Probably still an issue with my code though.

Support / 9-Patch?
« on: February 07, 2013, 12:39:41 pm »
Quick question: Is there any out-of-the-box solution to blit a 9-patch image (an image that only resizes in the center, leaving border parts in the original size - used for GUI elements)
If not, I'll implement something myself and post it if there's interest.

Projects / Bringing Space Combat to Android
« on: January 10, 2013, 09:50:41 pm »
This is the current game project from Ironman project

It's a space combat game. While simpler to play than Starlancer or X-Wing, it still has some simulation elements and missions where you need a little tactic. It's a war against bug-eyed aliens with the usual evil motives and total lack of backstory (so far)
It is not really multiplayer in the sense of head-to-head; However, you still get to play with others, as every one is playing on the same galaxy map. You can also pick other players as your wingmen; they are controlled by the AI then, but you take advantage of the weapons they bought and their pilot stats.

The models are from

It's strange to have stabilizer fins on a space missile, but every game has them so why not this.

The skybox or rather spacebox was made with a cool free program called Spacescape

Explosions are multiple billboards with transparency. Bitmaps were created with

The GUI is still pretty much alpha and should become a lot more elegant

Those yellow/green pods are the enemy missiles. Shoot them down fast or your transport ships are history
In the background is an enemy mothership. It can produce an endless number of fighters

Early version of the equipment screen

The game should be finished in late spring/early summer. It will be free but feature IAPs (which you don't have to buy if you are good enough). Runs best on medium to high class devices (like Galaxy S2 and later). Best to play on a fast tablet.

Used tools and libs:
IAP library

Hope you'll like it,
greetz Irony

Support / vertexBufferSize
« on: January 10, 2013, 10:56:30 am »
Hello Egon,
what is the default value of Config.vertexBufferSize and is it even worth playing around with the value? I guess I have around 5000-10000 vertices in a typcial scene and aim for mid- to high-class devices.

Support / GC happens when object first becomes visible
« on: January 02, 2013, 10:32:13 pm »
I make an effort to avoid any active object creation during runtime or methods that create new objects internally.
However, as soon as a certain object becomes visible by moving into the viewing frustrum, there are several GCs happening causing a delay of ~200 ms. However, this only happens one time. When they move out of the frustrum or I hide them, and show them again, no more GCs happen.
Do any memory intensive things happen when an object becomes visible, and can I preload that somehow? I am already calling build().
There is nothing in the Log besides a lot of VBO creation, but disabling them did not help.

Support / Confused about SimpleVectors
« on: December 27, 2012, 12:02:57 pm »
private static SimpleVector v4 = new SimpleVector();

Do you have any idea how this

public static synchronized SimpleVector something(SimpleVector p) {
  v4 = new SimpleVector();

.... // do something with v4

 return v4;

can, under certain circumstances, produce something different than that:

public static synchronized SimpleVector something(SimpleVector p) {

.... // do something with v4

 return v4;

Is this even possible?

Support / Low range of blitting transparency
« on: December 25, 2012, 09:34:35 pm »
first of all, thank you Egon for the great Engine. I am using it for a Wing-Commander-like space game (quite a niche on Android), which is making good progress.

My question: When I do a blit, and set the transparency value higher than ~ 10, the blit is fully opaque. Below that, it varies from fully transparent to opaque like it should. But it seems strange that the range of transparency is so low, like only 3 or 4 bits from transValue are actually used.
Is this caused by the engine, or the hardware I am using? I kinda shudder at the thought that my blits will have a different transparency on each end user device...

Pages: 1 [2]