Dice pseudo physics simulation

Hey guys I posted something similar to this but I scraped my old plan. I want to be able to simulate a 3D dice for like dungeons and dragons dice. I am doing this with Android. Would any of you have any suggestions of where I should start?

look into java, 3d physics processing you'll find it.

1 Like

I found a 3d engine by the name of Alien 3d that I want to use. I am to learn how to use it outside Android before I put it in my Android project but I cannot find any documentation. Is there anybody on the forum that might have any experience with this api?

first of all, if its java then all you need is to run it inside a browser with java/or java itself to run it on any machine.
There's no issues running mobile opengl versions on your desktop.

I started setting it up in Android Studios. I am not sure though how to use this API and I am still kind of new to Android. I need to be able to create a ActivityRendererBasedGame object to pass to the Engine object. Here is what the ActivityRendererBasedGame class looks like.

`//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package org.igs.android.ogl.engine;

import android.app.Activity;
import android.hardware.SensorListener;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.igs.android.ogl.engine.AndromedaException;
import org.igs.android.ogl.engine.GLSurfaceView;
import org.igs.android.ogl.engine.GameRenderer;
import org.igs.android.ogl.engine.Keyboard;
import org.igs.android.ogl.engine.Renderer;
import org.igs.android.ogl.engine.event.SensorEventHandler;
import org.igs.android.ogl.engine.event.TouchEventHandler;
import org.igs.android.ogl.engine.scene.Light;
import org.igs.android.ogl.engine.scene.Scene;
import org.igs.android.ogl.engine.scene.transiction.Transiction;

public abstract class ActivityRendererBasedGame extends Activity implements SensorListener {
private GLSurfaceView mGLSurfaceView;
private Renderer currentRenderer;
private Hashtable sceneList;
private Hashtable lightList;
private List touchEventList;
private List sensorEventList;
private Scene newScene;
private Scene currentScene;
private Transiction inTransiction;
private Transiction outTransiction;

public ActivityRendererBasedGame() {
}

public abstract Scene initSceneList() throws AndromedaException;

public void onCreate(Bundle var1) {
    super.onCreate(var1);
    this.initializeGame();
}

private void initializeGame() {
    this.mGLSurfaceView = new GLSurfaceView(this);
    this.currentRenderer = new GameRenderer(this, this, this.mGLSurfaceView, false);
    this.mGLSurfaceView.enterOnRenderer(this.currentRenderer);
    this.setContentView(this.mGLSurfaceView);
}

public void changeScene() {
    this.currentScene.leave();
    this.currentScene = this.newScene;
    this.currentScene.enter();
    this.newScene = null;
}

public void enterOnScene(Scene var1, Transiction var2, Transiction var3) {
    this.setInTransiction(var2);
    this.setOutTransiction(var3);
    if(this.currentScene == null) {
        this.currentScene = var1;
        this.currentScene.enter();
    } else {
        this.newScene = var1;
    }

}

public void enterOnScene(Long var1, Transiction var2, Transiction var3) throws AndromedaException {
    this.setInTransiction(var2);
    this.setOutTransiction(var3);
    Scene var4 = this.getScene(var1);
    if(this.currentScene == null) {
        this.currentScene = var4;
        this.currentScene.enter();
    } else {
        this.newScene = var4;
    }

}

public Scene getCurrentScene() {
    return this.currentScene;
}

public Transiction getInTransiction() {
    return this.inTransiction;
}

public void setInTransiction(Transiction var1) {
    this.inTransiction = var1;
}

public Transiction getOutTransiction() {
    return this.outTransiction;
}

public void setOutTransiction(Transiction var1) {
    this.outTransiction = var1;
}

public Enumeration<Light> getLightListEnum() {
    return this.getLightList().elements();
}

private final Hashtable<Long, Light> getLightList() {
    if(this.lightList == null) {
        this.setLightList(new Hashtable(1));
    }

    return this.lightList;
}

void addLight(Long var1, Light var2) {
    this.getLightList().put(var1, var2);
}

private final void setLightList(Hashtable<Long, Light> var1) {
    this.lightList = var1;
}

final Light getLight(Long var1) throws AndromedaException {
    if(this.getLightList().containsKey(var1)) {
        return (Light)this.getLightList().get(var1);
    } else {
        throw new AndromedaException(4);
    }
}

final void removeLight(Long var1) {
    if(this.getLightList().containsKey(var1)) {
        this.getLightList().remove(var1);
    }

}

final boolean lightExists(Long var1) {
    return this.getLightList().containsKey(var1);
}

public final boolean sceneExists(Long var1) {
    return this.getSceneList().containsKey(var1);
}

public final Scene getScene(Long var1) throws AndromedaException {
    if(this.getSceneList().containsKey(var1)) {
        return (Scene)this.getSceneList().get(var1);
    } else {
        throw new AndromedaException(3);
    }
}

public final void removeScene(Long var1) {
    if(this.getSceneList().containsKey(var1)) {
        this.getSceneList().remove(var1);
    }

}

public final void removeAndDestroyScene(Long var1) {
    if(this.getSceneList().containsKey(var1)) {
        Scene var2 = (Scene)this.getSceneList().get(var1);
        this.getSceneList().remove(var1);
        var2.destroy();
    }

}

public final void addScene(Long var1, Scene var2) {
    this.getSceneList().put(var1, var2);
}

public Enumeration<Scene> getSceneListEnum() {
    return this.getSceneList().elements();
}

private final Hashtable<Long, Scene> getSceneList() {
    if(this.sceneList == null) {
        this.setSceneList(new Hashtable(2));
    }

    return this.sceneList;
}

private final void setSceneList(Hashtable<Long, Scene> var1) {
    this.sceneList = var1;
}

private final List<TouchEventHandler> getTouchEventList() {
    if(this.touchEventList == null) {
        this.setTouchEventList(new ArrayList(5));
    }

    return this.touchEventList;
}

private void setTouchEventList(ArrayList<TouchEventHandler> var1) {
    this.touchEventList = var1;
}

void addTouchEvent(TouchEventHandler var1) {
    this.getTouchEventList().add(var1);
}

void removeTouchEvent(TouchEventHandler var1) {
    if(this.getTouchEventList().contains(var1)) {
        this.getTouchEventList().remove(var1);
    }

}

private final List<SensorEventHandler> getSensorEventList() {
    if(this.sensorEventList == null) {
        this.setSensorEventList(new ArrayList(5));
    }

    return this.sensorEventList;
}

private void setSensorEventList(ArrayList<SensorEventHandler> var1) {
    this.sensorEventList = var1;
}

void addSensorEvent(SensorEventHandler var1) {
    this.getSensorEventList().add(var1);
}

void removeSensorEvent(SensorEventHandler var1) {
    if(this.getSensorEventList().contains(var1)) {
        this.getSensorEventList().remove(var1);
    }

}

protected void onResume() {
    super.onResume();
    if(this.mGLSurfaceView != null) {
        this.mGLSurfaceView.onResume();
    }

}

protected void onStop() {
    super.onStop();
}

protected void onDestroy() {
    if(this.mGLSurfaceView != null) {
        this.mGLSurfaceView.onDestroy();
    } else {
        super.onDestroy();
    }

}

protected void onPause() {
    super.onPause();
    if(this.mGLSurfaceView != null) {
        this.mGLSurfaceView.onPause();
    }

}

public Renderer getCurrentRenderer() {
    return this.currentRenderer;
}

public GLSurfaceView getSurfaceView() {
    return this.mGLSurfaceView;
}

public boolean onKeyDown(int var1, KeyEvent var2) {
    Keyboard.setKeyDown(var1);
    return super.onKeyDown(var1, var2);
}

public boolean onKeyUp(int var1, KeyEvent var2) {
    Keyboard.setKeyUp(var1);
    return super.onKeyUp(var1, var2);
}

public boolean onKeyMultiple(int var1, int var2, KeyEvent var3) {
    return super.onKeyMultiple(var1, var2, var3);
}

public boolean onTouchEvent(MotionEvent var1) {
    Iterator var2 = this.getTouchEventList().iterator();

    while(var2.hasNext()) {
        TouchEventHandler var3 = (TouchEventHandler)var2.next();
        var3.onTouchEvent(var1);
    }

    return super.onTouchEvent(var1);
}

public void onSensorChanged(int var1, float[] var2) {
    Iterator var3 = this.getSensorEventList().iterator();

    while(var3.hasNext()) {
        SensorEventHandler var4 = (SensorEventHandler)var3.next();
        var4.onSensorChanged(var1, var2);
    }

}

public void onAccuracyChanged(int var1, int var2) {
    Iterator var3 = this.getSensorEventList().iterator();

    while(var3.hasNext()) {
        SensorEventHandler var4 = (SensorEventHandler)var3.next();
        var4.onAccuracyChanged(var1, var2);
    }

}

}
`

There is no documentation so it is hard to tell how to use it.

1 Like

this is why i stopped messing wit game files even on pc. most dont comment their code...

1) get android emulator
2) look for google group or community forum of the engine, there will be your resources.