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.


Messages - KittenKoder

Pages: 1 2 [3] 4 5
31
Support / Re: Not jPCT Related
« on: November 21, 2012, 08:06:09 pm »
Actually, this should work better even. I am responding to myself, but someone let me know if you see a problem with this working for all cases. I need to figure out how to include jar file loading as well, without implementing too much junk.

Code: [Select]
    static public URL loadFile(String filename) {
        URL returl = null;
        try {
            if(KittIO.baseurl != null)
                returl = new URL(KittIO.baseurl + filename);
            else
                returl = new URL(filename);
        } catch(Exception e) {
            try {
                File file = new File(filename);
                if(file.isFile())
                    returl = file.toURI().toURL();
            } catch(Exception ex) {
                ex.printStackTrace();
                returl = null;
            }
        }
        return returl;
    }

32
Support / Re: Not jPCT Related
« on: November 21, 2012, 07:26:57 pm »
This is based on what I can remember, but it just doesn't look right to me. I could swear I saw a simpler way.

Code: [Select]
    static public URL loadFile(String filename) {
        System.out.println(KittIO.baseurl + filename);
        URL returl;
        try {
            if(KittIO.baseurl != null)
                returl = ClassLoader.getSystemClassLoader().getResource(KittIO.baseurl + filename);
            else
                returl = ClassLoader.getSystemClassLoader().getResource(filename);
            if(returl == null) {
                File file = new File(filename);
                if(file.isFile())
                    returl = file.toURI().toURL();
            }
        } catch(Exception e) {
            returl = null;
        }
        return returl;
    }


33
Support / Not jPCT Related
« on: November 21, 2012, 06:52:25 pm »
But, I'm hoping someone here knows it. I completely forgot as I have not used the technique in a long time, but there's a specific trick to loading a file that could be from either an applet or application and within a jar or not, in other words, loading the file with just the base dir/url and the loader not caring which it is.

I use to have this documented but since I haven't used it in a long time I lost it.  If I remember correctly using new File(filename) doesn't work in all situations.

34
Projects / Re: New Library And Game
« on: November 20, 2012, 03:41:11 pm »
I like it already :D It reminds me my first project for Android: Trace_On

Cool. I have finally gotten the animation system refined, and the HUD style GUI can be interacted with the mouse and game controller, so the player can choose which they prefer. I just want to finish an animation system for the Canvas GUI before I release an official version of the library. The labels for the elements are actually a dynamic texture class I wrote, combining the TextureEffect interface and BufferedImage to create a "zone" label. That way a single texture can contain one label on top of multiple backgrounds, which can be switched out easily in the HUD elements without having to make too many calls to the hardware. The HUD elements are relatively simple, they're all buttons or dummies, using a parent system you can effect entire groups just by manipulating the parent. So both groups are actually parented to one element, to hide the entire group just hide the parent.

One thing I can't screenshot, the library even has a audio system as well, though it's dependent on Tritonus plugins because I'm too lazy to write my own.

For the actual game demo I will be making better models for the map, though Shiva was just a test model avatar, I'm going to keep it in the demo and likely the finished game because of how well it turned out. If I could save the animated version you'd see why I'm happy with the model.

35
Projects / Re: New Library And Game
« on: November 18, 2012, 01:18:08 am »
Looks very...tronish. I like it.

Thank you, that's what I was hoping for. Going to put up the first official version of the library soon, just need to do a tax test on it to see where I need to tweak some things. It's actually turning out better than I had expected, but the game and the library. Thanks to your input, I think I have something that other people may just find useful.

36
Projects / Re: New Library And Game
« on: November 17, 2012, 11:27:52 pm »
Quick update, the code for the above test app is now:

Code: [Select]
package app;

import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics2D;
import java.awt.HeadlessException;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;

import kitt.com.jpct.GameControls;
import kitt.com.jpct.XMLLoader;
import kitt.com.jpct.anim.Animator;
import kitt.com.jpct.anim.AnimatorCallback;
import kitt.com.jpct.event.CanvasEventHandler;
import kitt.com.jpct.event.Controller2ButtonBinding;
import kitt.com.jpct.event.ControllerAxisBinding;
import kitt.com.jpct.event.ControllerBinding;
import kitt.com.jpct.event.ControllerButtonBinding;
import kitt.com.jpct.event.EventHandler;
import kitt.com.jpct.event.KeyBinding;
import kitt.com.jpct.event.bind.CanvasBinding;
import kitt.com.jpct.event.bind.EventBinding;
import kitt.com.jpct.event.bind.EventBindingCallback;
import kitt.com.jpct.ext.GameWorld;
import kitt.com.jpct.ext.Object3DEx;
import kitt.com.jpct.ext.RadialCamera;
import kitt.com.jpct.game.ControllerData;
import kitt.com.jpct.game.GamePads;
import kitt.com.jpct.hud.HUDCellElement;
import kitt.com.jpct.hud.HUDElement;
import kitt.com.jpct.hud.HUDManager;
import kitt.com.jpct.hud.HUDTextLayer;
import kitt.com.jpct.hud.HUDTextureElement;
import kitt.com.jpct.hud.anim.HUDAnimator;
import kitt.com.jpct.hud.kits.HUDSelectorKit;
import kitt.com.jpct.scene.Scene;
import kitt.com.jpct.swing.GLPanel;
import kitt.com.jpct.swing.RenderCallback;
import kitt.com.jpct.tex.TextureEx;
import kitt.com.jpct.tex.TextureLabel;
import kitt.com.jpct.tex.TextureSequence;
import kitt.com.jpct.tex.TextureStored;
import kitt.com.jpct.tex.TextureSystem;
import kitt.com.math.Coordinate;
import kitt.com.math.Dimension;
import kitt.com.swing.Util;
import kitt.com.swing.canvas.CanvasButton;
import kitt.com.swing.canvas.CanvasGUI;
import kitt.com.swing.canvas.CanvasLabel;
import kitt.com.swing.canvas.CanvasPointer;
import kitt.com.swing.canvas.data.CanvasImageFont;
import kitt.com.swing.canvas.kits.MenuKit;
import kitt.com.swing.canvas.kits.ToggleMenuKit;
import kitt.com.swing.canvas.kits.WidgetKits;

import com.threed.jpct.Config;
import com.threed.jpct.Object3D;
import com.threed.jpct.Texture;

public class HUDTest extends JFrame implements EventBindingCallback, RenderCallback, AnimatorCallback {
private static final long serialVersionUID = 1L;

private static final String modelsdir = "res/models/";
private static final String texdir = "res/tex/";
    private static final String xmldir = "res/xml/";

private GLPanel mainpanel = null;
private HUDManager hud = null;
private TextureStored guitexture = null;
private TextureStored barstexture = null;
private RadialCamera camera = null;
private ControllerData controller = null;
private GameWorld gameworld = null;
// private File ping = null;

private Object3DEx box = null;
private CanvasEventHandler canvashandler = null;
private HUDTextLayer textlayer = null;
private CanvasImageFont font = null;

private CanvasGUI basecanvas = null;

private GameControls gamecontroller = null;

public HUDTest() throws HeadlessException {
this.setup();
}

private void setup() {
this.setTitle("HUD Test");
this.setBounds(0, 0, 256, 256);
this.setLocationRelativeTo(null);

this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
this.setResizable(false);
Container cpane = this.getContentPane();
cpane.setLayout(null);

this.setVisible(true);
Dimension dim = Util.getRealSize(this, 1024, 768);
Coordinate loc = Util.centerScreen(dim.width, dim.height);
this.setBounds(loc.x, loc.y, dim.width, dim.height);

// Config.isIndoor = true;
Config.tuneForOutdoor();
Config.doSorting = false;
Config.glFullscreen = false;
Config.glAvoidTextureCopies = true;
Config.glColorDepth = 24;
// Config.maxAnimationSubSequences = 10;
Config.farPlane = 100;
Config.glShadowZBias = 0.5f;
Config.saveMemory=true;
Config.maxTextureLayers = 2;
Config.maxPolysVisible = 20000;
Config.collideOffset = 1;
Config.glUseIgnorantBlits = true;
Config.autoBuild = true;
Config.lightMul = 5;
// Config.glTrilinear = true;

this.mainpanel = new GLPanel(1024, 768);
this.mainpanel.setRenderGL(false);
this.gameworld = this.mainpanel.getWorld();

// AudioManager.playLoop("res/audio/music/danosongs.com-bitbybits.ogg", -5.0f);
// this.ping = new File("res/audio/effects/ping.wav");

this.basecanvas = new CanvasGUI();
this.mainpanel.setBaseCanvas(this.basecanvas);
this.basecanvas.setBackground(new Color(0,128,128,128));
this.basecanvas.setForeground(new Color(64,255,255));
this.basecanvas.setName("Main Menu");
this.basecanvas.setFont(CanvasGUI.FONTLARGE);
this.basecanvas.setTextColor(Color.WHITE);

CanvasGUI.DEFAULT_DISABLED = new Color(255,0,0,128);
CanvasGUI.DEFAULT_HOVER = new Color(0,255,0,128);
CanvasGUI.DEFAULT_PRESSED = new Color(0,0,255,128);
CanvasGUI.DEFAULT_FOREGROUND = new Color(0,255,0);
CanvasGUI.DEFAULT_BACKGROUND = CanvasGUI.HALFBLACK;;

this.canvashandler = new CanvasEventHandler(this.basecanvas);
this.canvashandler.addTo(this.basecanvas);
this.mainpanel.setCurrentEventHandler(this.canvashandler);

this.basecanvas.setFlags(CanvasGUI.ROUNDED | CanvasGUI.BORDER);

this.guitexture = TextureSystem.loadStoredImage("res/tex/gui/base.png", "gui");
this.guitexture.makeTexture();
this.guitexture.addTexture();
this.barstexture = TextureSystem.loadStoredImage("res/tex/gui/bars-ver.png", "bars");
this.barstexture.makeTexture();
this.barstexture.addTexture();
TextureStored image = TextureSystem.loadStoredImage("res/tex/font-base.png", "font");
CanvasGUI.IMAGEFONT = new CanvasImageFont(image.getImage(), 32, 32);
CanvasGUI.IMAGEFONT.setBaseline(8);
CanvasGUI.IMAGEFONT.setAsciiOffset(32);
CanvasGUI.IMAGEFONT.setScale(0.5f);
TextureStored[] icons = XMLLoader.loadStoredPackFromXML("res/xml/texpack-icons.xml", HUDTest.texdir, null);
XMLLoader.loadStoredPackFromXML("res/xml/texpack-basic.xml", HUDTest.texdir, null);

image = TextureSystem.loadStoredImage("res/tex/icons/icon-logo-full.png", "icon-logo");
CanvasLabel label = new CanvasLabel(null, "Hacker's\nHaven", 100, 50, 100, 100);
label.setFlags(CanvasGUI.ROUNDED | CanvasGUI.BORDER | CanvasGUI.SHOWTEXT |
CanvasGUI.TEXT_LEFT | CanvasGUI.TEXT_TOP | CanvasGUI.IMAGE_STRETCH);
label.setImage(image.getImage());
this.basecanvas.addWidget(label);

CanvasButton button = new CanvasButton(null, "Pause", 0, 0, 100, 100);
button.setID("Pause");
this.basecanvas.addWidget(button);

String[][] options = {
{"GameStart", "Start"},
{"GameLoad", "Load"},
{"GameConfigure", "Settings"},
{"GameDelete", "Delete"},
{"GameExit", "Exit"}
};
MenuKit menu = WidgetKits.makeMenu(this.basecanvas, "Main Menu",
null, 150, 40,
options, 3, -1);
menu.parent.setLocation(200, 250);
menu.parent.setEnabled(false);

CanvasGUI.DEFAULT_FOREGROUND = new Color(0,255,255);

String[][] toptions = {
{"GameFun", "Fun"},
{"GameWicked", "Wicked"},
{"GameCool", "Cool"},
{"GameRun", "Run"}
};
ToggleMenuKit togglemenu = WidgetKits.makeToggleMenu(this.basecanvas, "Sub Menu",
null, 150, 40,
toptions, 2, CanvasGUI.HEXAGONAL | CanvasGUI.BORDER | CanvasGUI.SHOWTEXT |
CanvasGUI.TEXT_RIGHT | CanvasGUI.TEXT_BOTTOM | CanvasGUI.FILL  | CanvasGUI.IMAGE_STRETCH);
togglemenu.parent.setLocation(400, 50);
togglemenu.parent.setSingleToggle(true);
for (int i = 0; i < togglemenu.options.length; i++) {
togglemenu.options[i].setImage(icons[i].getImage());
}

CanvasPointer pointer = new CanvasPointer(this.guitexture.getImage());
pointer.setImageOffset(new Coordinate(0, 200));
pointer.setImagePart(new Dimension(64,64));
pointer.setSize(64, 64);
pointer.setLocation(-8, -20);
this.basecanvas.setPointer(pointer);

this.basecanvas.setBackImage(new BufferedImage(this.mainpanel.getWidth(), this.mainpanel.getHeight(),
BufferedImage.TYPE_INT_RGB));

this.guitexture.makeTexture();
this.barstexture.makeTexture();

this.mainpanel.setLocation(0, 0);
cpane.add(this.mainpanel);
this.mainpanel.alignBaseCanvas();

this.gamecontroller = new GameControls(this.gameworld, this.mainpanel.getBuffer());
this.hud = this.gamecontroller.getHUD();
// EventHandler.installFixer();

this.mainpanel.addEventHandler(this.gamecontroller.getHandler());
this.mainpanel.setCurrentEventHandlerGL(this.gamecontroller.getHandler());
this.mainpanel.setHUD(this.hud);

this.controller = GamePads.getController(0);
if (this.controller != null) {
this.controller.setEnabled(true);
System.out.println("Controller Enabled");
this.gamecontroller.setControllerDevice(this.controller);
this.canvashandler.addController(this.controller);
}

this.camera = new RadialCamera();
this.gameworld.setCameraTo(this.camera);
this.camera.setDistance(0.05f);

HUDTextureElement element = new HUDTextureElement(null, "text", 0, 512, 1024, 256);
element.setTexture(this.guitexture.getTexture(), 0, 0, 1024, 200);
element.setZOrder(0);
this.hud.add(element);

this.font = new CanvasImageFont(CanvasGUI.IMAGEFONT, 0.8f);

this.textlayer = new HUDTextLayer(element, "text-layer", 0, 0, 1024, 256);
this.textlayer.setZOrder(1);
this.textlayer.setFont(font);
this.textlayer.setBorder(32);
this.textlayer.setZOrder(1);
this.hud.add(this.textlayer);

TextureStored tex = TextureSystem.findStoredImage(null, "hud-panel-option");
if(tex != null) tex.addTexture();

HUDSelectorKit selectorkit = HUDSelectorKit.makeMenuSelector(
HUDSelectorKit.CELLELEMENTS, "Menu", null, "Panel",
-200.0f, 50.0f, 256.0f, 32.0f, 10, this.hud, null, tex, 0, 0, 512, 64);
if(selectorkit != null) {
        HUDAnimator animator = new HUDAnimator();
        animator.setTranslation(200.0f, -8.0f);
        animator.setSpeed(0.025f);
        animator.setScale(1.0f, 1.5f);
       
            HUDAnimator select = new HUDAnimator();
            select.setSpeed(0.1f);
            select.setTranslation(0.0f, 10.0f);
            select.setBounce(true);

    this.gamecontroller.setHUDList(selectorkit.elements, animator, select);
   
for(HUDElement elem : selectorkit.elements) {
    TextureLabel ntex = new TextureLabel(tex, elem.getName());
    ntex.initializeCenters(2);
    ntex.getCenters()[0] = new Coordinate(256, 32);
                ntex.getCenters()[1] = new Coordinate(768, 32);
                ntex.setFont(this.font);
                ntex.setText(elem.getName());
                ntex.updateText();
                ntex.makeTexture();
                ntex.addTexture();
                TextureSystem.addStoredImage(ntex);
                ((HUDTextureElement)elem).setTexture(ntex.getTexture());
}
}

tex = TextureSystem.findStoredImage(null, "hud-icon-hex");
if(tex != null) tex.addTexture();
selectorkit = HUDSelectorKit.makeSelector(HUDSelectorKit.EVENODD | HUDSelectorKit.HEXAGONAL |
HUDSelectorKit.HORIZONTAL | HUDSelectorKit.OFFSETUP | HUDSelectorKit.CELLELEMENTS,
"Menu", null, "Hex",
800.0f, 50.0f, 80.0f, 80.0f, 3, 3, this.hud, null, tex, 0, 0, 128, 128);
if(selectorkit != null) {
String[] iconnames = {
"icon-buffer",
"icon-clone",
"icon-crash-bomb",
"icon-decode",
"icon-deflector",
"icon-firewall",
"icon-mask",
"icon-slicer",
"icon-spy-bot",
"icon-torrent"
};
for(int i = 0; i < iconnames.length; i++) {
TextureStored icontex = TextureSystem.findStoredImage(null, iconnames[i]);
if(icontex != null && tex != null) {
BufferedImage img = Util.cloneImage(tex.getImage());
Graphics2D g = (Graphics2D)img.getGraphics();
Util.quickPaint(g, icontex.getImage(), 0, 0, false, false);
Util.quickPaint(g, icontex.getImage(), 128, 0, false, false);
g.dispose();
TextureEx eltex = new TextureEx(null, "hex-" + iconnames[i], new Texture(img, true));
TextureSystem.addTexture(eltex);
eltex.addTexture();
System.out.println(eltex.getName());
((HUDCellElement)selectorkit.elements[i]).setTexture(eltex.getTexture());
if(i == (i/3)*3)
((HUDCellElement)selectorkit.elements[i]).setCell(1);
}
}
}

this.hud.zSort();

// TextureSequence tseq = XMLLoader.loadSequenceFromXML("res/xml/texseq-dissolve.xml", HUDTest.texdir, null);
// tseq.addTextures();
// tseq = XMLLoader.loadSequenceFromXML("res/xml/texseq-appear.xml", HUDTest.texdir, null);
// tseq.addTextures();
TextureSequence tanim = XMLLoader.loadSequenceFromXML("res/xml/texseq-barslide.xml", HUDTest.texdir, null);
tanim.addTextures();
// tseq = XMLLoader.loadSequenceFromXML("res/xml/texseq-grid-shine.xml", HUDTest.texdir, null);
// tseq.makeTexture();

// if(tseq != null) {
// AnimatedBackground background = new AnimatedBackground("background", this.mainpanel.getCanvas());
// background.setTexture(tseq);
// background.setFullImage();
// this.mainpanel.setBackgroundElement(background);
// }

Scene scene = XMLLoader.loadSceneFromXML("res/xml/scene-internet.xml", HUDTest.xmldir, HUDTest.modelsdir, HUDTest.texdir);
scene.setWorld(this.gameworld);
scene.setScene();

this.box = XMLLoader.loadObjectXML("res/xml/avat-shiva.xml", HUDTest.modelsdir, HUDTest.texdir);
this.box.averageCollisionXZ();
this.box.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
this.box.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
        this.box.translate(scene.getSpawn("Logon"));
this.gameworld.addObjectEx(this.box);
this.gamecontroller.setPlayerObject(this.box);
        this.gamecontroller.getPlayerAnimator().setCurrentMeshAnimation("stand", false);

element = new HUDTextureElement(null, "Pointer", 0, 0, 32, 32);
element.setTexture(this.guitexture.getTexture(), 64, 200, 64, 64);
element.setVisible(true);
this.hud.add(element);
this.gamecontroller.setPointer(element);

EventBinding gevent = new EventBinding("Pause");
gevent.setController(this.controller);
gevent.setControllerEvent(new ControllerButtonBinding(false, 9));
gevent.setKeyEvent(new KeyBinding(KeyEvent.VK_P, 0, EventBinding.KEY_PRESSED));
gevent.setCallback(this);
this.gamecontroller.getHandler().addEvent(gevent);
this.canvashandler.addEvent(gevent);

gevent = new EventBinding("Canvas");
gevent.setController(this.controller);
gevent.setControllerEvent(new ControllerButtonBinding(false, 3));
gevent.setKeyEvent(new KeyBinding(KeyEvent.VK_ESCAPE, 0,
EventBinding.KEY_PRESSED));
gevent.setCallback(this);
this.gamecontroller.getHandler().addEvent(gevent);

CanvasBinding canevent = new CanvasBinding(null, this.basecanvas);
canevent.setController(this.controller);
canevent.setControllerEvent(new ControllerAxisBinding(false, ControllerBinding.DIRECTIONAL, ControllerBinding.BOTH));
canevent.setEffectPointer(true);
this.canvashandler.addEvent(canevent);

canevent = new CanvasBinding(null, this.basecanvas);
canevent.setController(this.controller);
canevent.setControllerEvent(new Controller2ButtonBinding(false, 4, 5));
canevent.setNavigateWidgets(true);
this.canvashandler.addEvent(canevent);

canevent = new CanvasBinding(null, this.basecanvas);
canevent.setController(this.controller);
canevent.setControllerEvent(new ControllerButtonBinding(false, 1));
canevent.setSimulateClick(true);
this.canvashandler.addEvent(canevent);

this.gamecontroller.enableControls();
}

public static void main(String[] args) {
HUDTest app = new HUDTest();
try {
app.loop();
} catch (Exception e) {
e.printStackTrace();
}
}

private void loop() throws Exception {
System.out.println("Looping");
if(!GamePads.isInitialized()) GamePads.initialize();
this.mainpanel.setRenderGL(true);
this.textlayer.addLine("Environment simulation loaded.");
this.textlayer.addLine("Avatar Shiva loaded.");
this.textlayer.addLine("Interface initiated.");
this.textlayer.addLine("Login in progress ...");
this.mainpanel.clearTimer();

while (this.isShowing()) {
while(this.gamecontroller.getHandler().hasCommands() || this.canvashandler.hasCommands()) {
String tcomm = "";
if(this.gamecontroller.getHandler().hasCommands()) tcomm = this.gamecontroller.getHandler().popCommand();
else if(this.canvashandler.hasCommands()) tcomm = this.canvashandler.popCommand();
System.out.println(tcomm);
this.textlayer.addLine(tcomm);

if(tcomm.compareTo("Panel-2") == 0) {
this.gamecontroller.getPlayerAnimator().setCurrentMeshAnimation("access", true);
}
if(tcomm.compareTo("Panel-3") == 0) {
this.gamecontroller.getPlayerAnimator().setCurrentMeshAnimation("delete", true);
// AudioManager.pauseLoop(true);
}
if(tcomm.compareTo("Panel-4") == 0) {
// AudioManager.pauseLoop(false);
}
if(tcomm.compareTo("Panel-5") == 0) {
this.gamecontroller.getPlayerAnimator().setCurrentMeshAnimation("appear", true);
// AudioManager.playEffect(this.ping);
}
if(tcomm.compareTo("Panel-6") == 0) {
this.gamecontroller.getPlayerAnimator().setCurrentMeshAnimation("failb", true);
}
if(tcomm.compareTo("Pause") == 0) {
if(this.mainpanel.isRenderGL()) {
this.mainpanel.setPaused(!this.mainpanel.isPaused());
this.gamecontroller.setPause(this.mainpanel.isPaused());
} else {
this.mainpanel.setRenderGL(true);
}
}
if(tcomm.compareTo("Canvas") == 0) {
if(this.mainpanel.isRenderGL()) {
this.mainpanel.snapshot(this.basecanvas.getBackImage());
                        this.mainpanel.setPaused(true);
                        this.gamecontroller.setPause(true);
this.mainpanel.setRenderGL(false);
}
}
}
this.mainpanel.renderScene();
Thread.sleep(30);
}

System.out.println("Exiting!");
this.mainpanel.dispose();
EventHandler.removeFixer();
System.exit(0);
}

@Override
public boolean eventCall(int event, EventBinding binding) {
System.out.println("Callback!");
return true;
}

@Override
public void animateCallback(Animator animator, int event) {
// if(animator == this.mainanimator) {
// if(event == AnimatorCallback.TEXTURE_DONE) {
// this.mainanimator.setAnimateMesh(true);
// }
// if(event == AnimatorCallback.MESH_DONE) {
//
// }
// }
}

@Override
public void renderCallback() {
// Called after each render.
}

}

37
Projects / Re: New Library And Game
« on: November 17, 2012, 01:48:05 am »
Alright, I got the Blender to Kitt jPCT engine scripts done, here's a scene exported from Blender to the engine.





The beams and the green ground have animated textures, the ground shimmers, the small beams look like blips flying through, and the big one looks freaking cool animated. lol

38
Support / Re: jPCT presetting
« on: November 15, 2012, 04:16:14 am »
I'm working on a game library that has jPCT at the core, if you are interested I have a thread here about it. It includes a 3D and 2D GUI as well as an optional Canvas GUI system that's simpler than Swing, since most games don't need the whole Swingset.

39
Support / Re: About animating textures.
« on: November 15, 2012, 04:12:21 am »
I know the PC jPCT has not native method, not sure about AE though.

I created a texture sequence class, which holds a list of texture names and textures as well as other information about the animation, then the animation system for the object just "flips" to the next texture after some time has passed based on the sequence settings. Sort of like a movie.

40
Support / Re: Need Advice
« on: November 15, 2012, 04:10:09 am »
My opinion that your ps's configuration is acceptable, most of first mid have till 1Ghz and 512Mb of RAM.

That's what I am hoping. I actually purposefully bought an old computer for development testing and this is the lowest machine I could find in the shop. Games that I play are all console games, I actually prefer those and there is a huge lack of such styles for the PC.

41
Projects / Re: Forgotten Elements 3D
« on: November 15, 2012, 04:07:56 am »
Very pretty. Nice details too.

42
Support / Re: Level of detail
« on: November 15, 2012, 04:07:19 am »
One thing you could do is have differing sizes of textures for the level of detail, load the ones based on the selected level of detail. That would save some resources. Best to have multiple levels of detail models instead, vertice and animation count in other words. The drawback is changing mid-game would be messy.

43
Projects / Re: New Library And Game
« on: November 13, 2012, 10:49:54 am »
Slight change in plans, though not massive. I developed a pretty decent 3D GUI system, but the drain on the CPU due to collision checks and such with the mouse have made me choose to change gears a bit. Getting rid of the "picking" with the mouse completely, for the 3D GUI, most games use hotkeys for such things anyway so I'm probably just going too big. I am also going to put more focus on the HUD system, making it into a full GUI which will respond to the mouse. As it is I have to do something that will wind up abusing memory and queuing all the events in order to prevent some serious glitches when working cross threads, Swing's event system demands such and that's sort of the purpose of this library, to merge Swing with the GL rendering.

So to recap:

1. More focus on 2D HUD elements and interactions.
2. Elimination of 3D GUI object "picking."
3. A more refined event queue system.
4. A HUD system that's comprehensive and useful, as well as more GUI capable, that means event bindings and animations for the HUD elements themselves.

For those interested, I managed to iron out the texture system in a way that will actually benefit even small projects. Added a new object, the Scene object, which only tracks things that are unique to that scene allowing you to remove them easier and faster when changing scenes. Considering being rid of the 3D GUI completely, as cool as it looks, I want my library to be capable of operating on lower level machines than modern top of the line, the 2D HUD system can look not only as smooth, but also more like what people are used to for widgets anyway.

If there are any suggestions of ideas, please let me know, also any specific requests. I will hold onto the 3D GUI and maybe develop it further later on, but for now I prefer the 2D one.

44
Support / Re: Need Advice
« on: November 12, 2012, 11:51:01 am »
Quote
Okay, I figured out that either jPCT or OpenGL doesn't like transparent objects. Tons of sorting errors and it eats CPU cycles, on the GL render.
Sorting is required to maintain rendering order and can't be perfect. because it's based on the painter's algorithm, which simply isn't perfect. However, it actually doesn't eat that much of the cpu unless your cpu is really really slow and old...is it? Even on Android, you can sort hundreds of objects in almost no time. Are you actually using compile() on your objects? Because if you don't, the sorting/rendering happens based on polygons and not objects, which is slower.

Quote
1. For texture animations, frame by frame update of the texture, would reassigning the texture each frame be more costly, or would using a TextureEffect and updating the texture's array each frame be more costly, when using jPCT?
Updating the array is more costly, because it requires to destroy and upload the texture on the GPU. The other approach (i.e. assign a new texture) is cheaper if the texture is already present on the GPU.

Quote
2. Would using two worlds cost a lot? I notice that using two worlds versus one then switching visibility on the objects, has almost no difference in CPU cycles eaten, and the two different methods don't seem to have much of a difference in resource consumption from what I can see.
No, it's pretty cheap and layering them is fine.

Thank you, I actually think the entire CPU drain was because of the method I had for animated textures. I'll have to figure out some method that will work well with the reassignment technique though. Without the animation on the textures it's pretty smooth. Of course my CPU is only 1Ghz, so I'll likely work on a 2D GUI using blitting for an alternative as well. Otherwise the GUI system for the library is completed.

My computer is actually pretty old, about 5 years old, and I only have 1gig RAM as well. Which is fine because the game I want to develop I am hoping to appeal to even people with old computers, so I develop for my computer with the option of "better" stuff available in the library.

45
Support / Need Advice
« on: November 12, 2012, 07:51:28 am »
Okay, I figured out that either jPCT or OpenGL doesn't like transparent objects. Tons of sorting errors and it eats CPU cycles, on the GL render. Since I'm too lazy to write my own graphics library for OpenGL I'm just going to work with it somehow. Which leads to two things I would like some recommendations on from the dev(s) of jPCT:

1. For texture animations, frame by frame update of the texture, would reassigning the texture each frame be more costly, or would using a TextureEffect and updating the texture's array each frame be more costly, when using jPCT?

2. Would using two worlds cost a lot? I notice that using two worlds versus one then switching visibility on the objects, has almost no difference in CPU cycles eaten, and the two different methods don't seem to have much of a difference in resource consumption from what I can see.

When I say cost I mean memory and CPU consumption. I don't know exactly how you coded the World class, so I'm not sure what it does exactly. Currently with the simple world, and almost no transparent objects, I can pump out 33 FPS with or without the GUI layer on top of it, using either technique. So unless there is a nuance that could kill an app I am considering going with the multiple world "layers."

Pages: 1 2 [3] 4 5