May 29, 2010

Motion Detection in Mobile Games


Motion Detection as Interaction Technique for Games & Applications on Mobile Devices


source: http://www.blogger.com/post-create.g?blogID=6576334769086421977

Here they are discussing a concept of an intuitive interaction technique using optical
inertial tracking on mobile phones.



Optical Motion Detection as Interaction Technology for Mobile Phones

source:http://wiki.forum.nokia.com/index.php/Optical_Motion_Detection_as_Interaction_Technology_for_Mobile_Phones

Mobile phones have small keys and mass market phones are usually equipped with a sub-QVGA-screen. Therefore the possibilities for concepts of interaction with the device are limited to some extent.



Analysis of Built-in Mobile Phone Sensors for Supporting Interactions with the Real World


http://www.medien.ifi.lmu.de/permid2005/pdf/KarinLeichtenstern_Permid2005.pdf

In this paper its investigated that which sensors are already built-in in modern mobile phones and analyze and how they can be employed in real world interactions.

Apr 27, 2010

Kalman filter Java code

source: http://mathstat.asu.edu/~eubank/kalman/kalman.html


abstract class kalman{
//members
int t;
matrix Sm1, S, R, HTRinv, M, Sn, A;
vector eps, x, xn, a;

//default constructor
kalman(){}


//Algorithm 4.3

void forward(matrix Sm1m1, vector xm1m1, vector y){
Sm1=F(t-1).times(Sm1m1.times(F(t-1).trans())).plus(Q(t-1));
R=H(t).times(Sm1.times(H(t).trans())).plus(W(t));
HTRinv=R.chol(H(t)).trans();
matrix temp1=Sm1.times(HTRinv.times(H(t)));//temporary storage
S=Sm1.minus(temp1.times(Sm1));
M=F(t).minus(F(t).times(temp1));
vector temp2=F(t-1).times(xm1m1);//temporary storage
eps=y.minus(H(t).times(temp2));
x=Sm1.times(HTRinv.times(eps)).plus(temp2);
}

abstract matrix Q(int i);

abstract matrix F(int i);


abstract matrix H(int i);

abstract matrix W(int i);

//A variant of Algorithm 5.1 that initializes a and A as 0 with updating
//at the beginning of each step rather than the end. Note the ``typo'' in the
//text where M(t-1) is not defined for the last step with t=1. Since a and A
//do not require updating in this case, the algorithm works as written provided
//the last two lines of the for loop are implemented conditionally on t>1.
void smooth(vector aIn, matrix AIn, matrix HTRinvIn, vector epsIn){
a=M.trans().times(HTRinvIn.times(epsIn)).plus(M.trans().times(aIn));
A=M.trans().times(HTRinvIn.times(H(t+1).times(M))).plus(M.trans().times(AIn.times(M)));
xn=x.plus(Sm1.times(a));
Sn=S.minus(Sm1.times(A.times(Sm1)));
}


//access to members

int Gett(){
return t;
}

matrix GetSm1(){
return Sm1;
}

matrix GetS(){
return S;
}

matrix GetR(){
return R;
}

matrix GetHTRinv(){
return HTRinv;
}


matrix GetM(){
return M;
}

matrix GetSn(){
return Sn;
}

matrix GetA(){
return A;
}


vector Getx(){
return x;
}

vector Geteps(){
return eps;
}

vector Getxn(){
return xn;
}

//useful for setting xn=x for last step in forward
//(first step in backward) recursion
void Setxntox(){
this.xn=new vector(x);
}

//useful for setting Sn=S for last step in forward
//(first step in backward) recursion
void SetSntoS(){
this.Sn=new matrix(S);
}



vector Geta(){
return a;
}


//utilities

void printQ(int i){
System.out.println("Q("+i+")");
Q(i).printMatrix();
}

void printF(int i){
System.out.println("F("+i+")");
F(i).printMatrix();
}

void printH(int i){
System.out.println("H("+i+")");
H(i).printMatrix();
}

void printW(int i){
System.out.println("W("+i+")");
W(i).printMatrix();
}

void forwardPrint(){
System.out.println("eps("+t+")");
eps.printVector();

System.out.println("x("+t+"|"+t+")");
x.printVector();

System.out.println("S("+t+"|"+t+")");
S.printMatrix();
}

void backPrint(){
System.out.println("x("+t+"|n)");
xn.printVector();
System.out.println("S("+t+"|n)");
Sn.printMatrix();
}

}

Apr 13, 2010

What is Java2 Micro Edition?

Java is known primarily as a server-side programming environment, centered around the technologies that make up the Java 2 Enterprise Edition (J2EE), such as Enterprise JavaBeans (EJBs), servlets, and JavaServer pages (JSPs). Early adopters of Java, however, will recall that it was originally promoted as a client-side application environment. In fact, Java was originally designed as a programming language for consumer appliances. Now Java is returning to its roots with Java 2 Micro Edition, or J2ME for short.

The Java 2 Platform

What we commonly refer to as "Java" is more formally known as the Java 2 Platform. The Java 2 Platform is split into three editions: Java 2 Standard Edition (J2SE), Java 2 Enterprise Edition (J2EE), and Java 2 Micro Edition (J2ME). Each edition of the platform provides a complete environment for running Java-based applications, including the Java virtual machine (VM) and runtime classes.

The three editions all target different kinds of applications running on different kinds of devices. Desktop-based applications are developed using J2SE, which provides the necessary user interface classes. Server-based applications are developed using J2EE, which emphasizes component-based programming and deployment. Handheld and embedded devices are targeted by J2ME.

What separates one edition from another, then, is primarily the set of class libraries that each edition defines. Loosely speaking, you can think of J2ME as a subset of J2SE and J2SE as a subset of J2EE. It is possible to run the same Java bytecode in each edition, providing the classes referred to by the bytecode are available in all three editions. The catch, of course, is that J2ME-based devices have fewer classes than what J2SE and J2EE provide, especially the smaller devices. After all, there are several thousand core J2SE runtime classes, taking up ten to twenty megabytes of space, which is simply too big for the majority of devices out there today and in the near future.

The various specifications that comprise J2ME are all defined through the Java Community Process (JCP), as is done with J2SE and J2EE. Today, there are close to forty separate Java Specification Requests (JSRs) dealing with J2ME: Small device programming is definitely a hot topic within the Java community. (For more information, see the main JCP Web site at www.jcp.org.)

Java 2 Micro Edition

In J2ME, the Java runtime environment is adapted for constrained devices - devices that have limitations on what they can do when compared to standard desktop or server computers. For low-end devices, the constraints are fairly obvious: extremely limited memory, small screen sizes, alternative input methods, and slow processors. High-end devices have few, if any, of these constraints, but they can still benefit from the optimized environments and new programming interfaces that J2ME defines.

Learning about J2ME is not hard: Once you understand the new terminology, it's mostly about learning new APIs (application programming interfaces) and learning how to work in constrained environments. (If you think writing an applet is challenging, wait until you try to fit an application into the 30K of memory some cellphones provide!) You can use most of the same tools you already use in your code development, and with careful coding you can develop libraries of classes that are portable to any device or computer with a Java virtual machine.

PersonalJava and EmbeddedJava

J2ME is not the first attempt at adapting Java for constrained environments. Two other technologies, PersonalJava and EmbeddedJava, made it possible to run Java 1.1.x applications on high-end devices.

PersonalJava uses the basic Java 1.1 runtime classes and throws in a few features from Java 2. Support for some of the runtime classes is optional, but a PersonalJava implementation still requires a couple of of megabytes of memory and a fast processor to run, so it's not a practical solution for truly constrained devices like cellphones and many personal digital assistants.

EmbeddedJava makes every behavior of both the Java VM and the runtime classes optional - the implementor can choose exactly which classes and methods are required. There is one limitation, however: The Java runtime environment can only be used by the implementor and cannot be exposed to third parties. In other words, you can use it to write Java code that runs inside a device, usually as part of the software to control the device, but no one else can write applications for the device. This is done to preserve the "write once, run anywhere" nature of Java, since an EmbeddedJava environment can do away with fundamental things like runtime class verification and change the public interfaces of core classes. EmbeddedJava is really a way to build a "private" Java runtime environment.

Both PersonalJava and EmbeddedJava are being phased out. There is a migration path from PersonalJava to J2ME, as we'll see later in this series, though the current version of PersonalJava continues to be supported. EmbeddedJava is no longer supported because J2ME defines suitable small-footprint runtime environments.

source:http://www.developer.com/ws/j2me/article.php/1378921

Apr 12, 2010

Developing Java-Based Mobile Games

For game development GUI development experience with AWT and SWING will be helpful though not mandatory.Browser games are played using mobile phone's built-in microbrowser (net browser for mobile devices), either in online or offline mode. Players can play such games online through their cellular carrier's or a third-party game provider's game Web site, or download them for offline gaming. This category includes a wide range of games, such as solo or multiplayer games, network games, offline games, arcade games, and so forth.

Mobile games can be developed using C++, Java (Java 2 Micro Edition, to be precise), and the Binary Runtime Environment for Wireless (BREW) platform from Qualcomm.


Although C++ has the advantage of being compiled into native code with direct access to system resources, and with BREW the platform provides end-to-end solutions to mobile game developers while allowing them to work with any desired language (including C++, Java, XML, and Flash), Java is the most popular choice for game development. Java, or the Java 2 Micro Edition (J2ME) platform to be precise, is identified as the most convenient for developing mobile games. (For more specifics on J2ME, see "What is Java 2 Micro Edition?") The driving forces behind J2ME's popularity are:

  • J2ME enjoys the status of an industry standard backed by all major handset makers, with most of the present day mobile phones being Java-enabled.
  • J2ME is a free and open platform. This helps keep the development costs low and provides the necessary flexibility with ample support freely available for developers using it.
  • Its highly portable nature ("Write once run anywhere") ensures that a game application written for one brand/type of handset will work with all other brands/types of Java-enabled handsets.
  • It is especially optimized for small devices, is lightweight, and is highly secure because applications written on it cannot access or affect other applications running on the phone/device.
  • J2ME consists of the Mobile Information Device Profile (MIDP) API that is designed specifically for developing applications for mobile devices including mobile phones, keeping in mind their limitations and constraints. Furthermore, the latest MIDP version 2.0 itself dedicates a whole API to game development, making game development simpler and quicker.

Followers