Страницы

воскресенье, 6 сентября 2015 г.

Making fast performance complex animations in android

Recently, I've ran into a problem with animating item's height inside a list for some devices with poor performance. And I've done a library for that. It animates RecyclerView or ListView item's height, but isn't heavy-bounded to that containers - see on github. That animation is also known as expand-collapse animation. Here I describe main problems and solutions founded so far, which is used in library. Library is finished and I'll be very glad if you find some issues or propose pull requests.

So, let's start. To be more clear, I'll write some straightforward code which does what I'm telling about:

ValueAnimator animator = ValueAnimator.ofInt(100, 300);
animator.setDuration(1000);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
  @Override
  public void onAnimationUpdate(ValueAnimator animation) {
    listViewItem.getLayoutParams().height = (Integer) animation.getAnimatedValue();
    listViewItem.requestLayout();
  }
});
animator.start();
Many libraries, I so before, use this technique. But that is heavy because of requestLayout() - it causes layout and measure steps repeated again each call. From the other side,

суббота, 2 мая 2015 г.

LibGDX: Kotlin setup

In my previous post I wrote how to configure gradle files to increase build and open IDE speed. Those steps needs to be done if you want to configure kotlin in your libGDX project. Otherwise, you'll get really poor IDE responsiveness and even gradle daemon crashes. Assuming, that you've done all instructions from my previous post, here is the magic steps to use Kotlin. It's easy now:

1. Android Studio (AS) / IDEA -> Settings -> find by "plugin" -> Click "Jetbrains" -> find by "kotlin" -> install kotlin and kotlin for android (optional) plugins and click restart IDE to complete install plugin
2. Open core/src/main directory and create "kotlin" directory there. Recreate directories for your package, like they are in "java" directory. If your app's package is com.mycompany.mygame, then create directory com, open it, create mycompany and so on.
3. Return to IDE. You may try tools -> Kotlin -> Configure kotlin in project... or add bold lines to your core/build.gradle:

Speed up libgdx gradle build in Intellij IDEA

This article describes how to exclude running unnessary tools when building for concrete platform. Here I will make an example for desktop and Android platform, but builds for other platforms can be optimized that way too. The main idea is to move all gradle staff, related to project to it's gradle's build file. So, the way it's designed. Nothing new. While this post may be outdated, see complete and update example project on github . I'm using Android Studio, but IDEA may be used too. And yes, only gradle is here and no Eclipse. I'm a professional programmer and I believe, that Android Studio is far way better than Eclipse if it is set up well.

So, here are the steps to make IDE build fast.

Will Kotlin be the future for libGdx to target Web platform?

Currently, libgdx uses GWT plugin to target web platform. And GWT doesn't support even Java 1.6! See official docs. And it allways needs source files! (see GWT/html section in libgdx docs) It's not allways affordable.

What about Kotlin? It's robust, brand new language which is fully compatible with JVM, starting from Java 1.6+!

Let's see what's about integration in modern IDE's. Kotlin plugin for Android Studio / IDEA successfully compiles both .kt and .java files to .class! (see here and here for android)

And what about starting to code best libGDX projects in Kotlin and deploy them to web now? Now we have libgdx backends only for GWT...

What we may try now?

1. Kotlin can be converted to javascript thanks to JetBrains. Here is an example of web project, where javascript is generated from kotlin code. So, we may do that generation for now (hoping things become better in the future) and add generated javascript to GWT's web project to use with libgdx gwt backends as usual. In theory, it could work.

2. Or we may try investigating about current possibilities of Kotlin in conversion to javascript, running HTML5. Get gwt backend sources as an example and write our own backend for Kotlin's javascript and contribute to libGDX?

What will you say? Interesting, isn't it? I'll be glad to see your thoughts! Post comments, please


понедельник, 6 октября 2014 г.

I'm seeking for a job

Hello, everyone! I'm seeking for a job as a libGDX / Android / Java game developer. I'm living in Saint-Petersburg, Russia. We'll be glad to cooperate. Mailto: vnms11@gmail.com.

Here is my experience.
I'm most interested in: libGDX, cross-platform, AI, fuzzy logic, 2D game development from scratch, OpenGL, java, interesting algorithms.
Can sometimes do jobs, associated with: pure Android SDK, Python, Android NDK, jUnit, client-server, SQL.
See my old-old game on google play market.
Or my site with portfolio (sorry for advertisements there).
If you seek for commercial developments, see navigational simulator. Here I worked as a part of team for 2 years. And another 3 years I've been developing different integration software for ENOVIA V6, SmarTeam, CATIA, SolidWorks and I've been working with clients (see Dassault site).

Serpent's Madness 2012


Serpent's Madness is back! It was first developed for windows platform. Now you can play on android. Improved serpent movement, smarter AI and respawn feature included. Here serpent AI has "weights" and done like in fuzzy logic. Code is open, listed in my post on habrahabr. Graphics is done by professional designer.

Platform: android
View on market
Download
Developed with Android SDK

Rock Carrier

Rock Carrier is my try to write a free fan game to Space Rangers 2, developed by Elemental Games. It's a complete new game with graphics and sound from original game. As allways, I developed it from scratch. It is an arcade space real-time shooter. Game is loading for 2-5 minutes. When done, press space bar to play. You control dominator space ships with 2 type of attacks (on left and right mouse buttons). Pirate ships try to destroy you. There is a giant star, asteroid rings and space stations on the level. If you'll get killed, you will respawn at left top corner of level. Your health is displayed in left bottom corner of the screen. Your ship follows the mouse cursor.

Developed with own engine IZeng, C++, corona library
Download
Platform: Windows