Topic:   Absurd Engine mobile   (Read 2921 times)


0 Members and 1 Guest are viewing this topic.

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • View Profile
    • Arcade of the Absurd
Absurd Engine mobile
« on: March 08, 2012, 03:20:36 PM »


It's alive! Absurd Engine mobile: program a game once in Java; compile it natively for Android and iOS. The test program that you see running moves a sprite around the screen on a one-second timer. Here's the code:

Code: [Select]
public class Game extends GameView
{
    public Game(Context context)
    {
        super(context);
       
        face = new Sprite(BitmapFactory.decodeResource(AbsurdGameTest.res, R.drawable.testface), 0, 0);
       
        jumpTimer = new Timer(1, this, new Delegate()
        {
            public void function()
            {
                face.location.set((int)(Math.random()*getWidth()), (int)(Math.random()*getHeight()));
            }
        });
       
        jumpTimer.start();
    }
       
    @Override
    public void onDraw(Canvas canvas)
    {
        canvas.drawBitmap(face.bitmap, face.location.x, face.location.y, null);
    }
   
    private Sprite face;
    private Timer jumpTimer;
}

There's a lot going on behind the scenes here. Notice that I've implemented delegates in Java! Less obviously, game rendering and logic (such are timing) are updated from separate threads, which makes everything silky smooth, even across platforms.

My goal in this project is to simplify simple mobile development. There's an intimidating amount of overhead involved in just getting a stable game loop running on a mobile device - I want to prototype crazy ideas as fast as they come to me without having to deal with thread concurrency issues! On that note, I want to make the unique features of mobile devices - accelerometers, GPSes, etc - as accessible to develop for as possible.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
    • View Profile
Re: Absurd Engine mobile
« Reply #1 on: March 08, 2012, 07:28:58 PM »
That's awesome!
I remember you talking about this it should be great for getting apps to more users.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Absurd Engine mobile
« Reply #2 on: November 18, 2013, 11:14:42 PM »
Whao I must have missed this.

How'd you get a java application to convert to the necessary output and run on those devices?
Is it easy? Can it be automated to be easy?
Is the main top level language in just Java?