jPCT - a 3d engine for Java => Projects => Topic started by: Crowley on June 29, 2004, 06:55:02 pm

Title: Project AuNG/zG
Post by: Crowley on June 29, 2004, 06:55:02 pm
AuNG/zG is a codename for a project that has been brewing in my mind for about seven years and now jpct has given me the opportunity to move ahead with it. I've spent the last four days working on creating the basic graphical framework so that I have something to show others, and here it is now, at http://www.zaren.net/the_project

The screeshots don't really show much, but it will show you the direction where I am headed with this game. Any feedback would, of course, be welcome :)
Title: Project AuNG/zG
Post by: Anonymous on July 01, 2004, 12:01:40 am
Reminds me of "Into the eagle's nest" on the CBM64. It looks much better than that of course.:wink:  It's just that it reminds me of it. Is the headless player a 3d model or a sprite?
Title: Project AuNG/zG
Post by: Anonymous on July 01, 2004, 12:04:28 am
Here's a pic of "Into the eagle's nest":
Title: Project AuNG/zG
Post by: Crowley on July 01, 2004, 04:59:57 pm
A sprite. Actually, the characters will be made of three sprites - the legs, the torso and the head. This will allow you to aim to one direction and move in another as all the parts can rotate independently. I'm still trying to figure out a way to make the torso turn towards the mouse cursor so that you could use the mouse to aim. (I know, trigonometry is propably the way to go, but I haven't quite figured it out)  :oops:

Basically I am going for the feel of the first two GTA games but with a couple of improvements, such as the aiming. Those who have played the first GTA will remember that aiming was really not that easy at times.

Btw, I'm not able to view the pic at this time as my net connection is acting weird. I can access some servers and some I cant. I'll have to check "Into the eagle's nest" out later.  :)
Title: Project AuNG/zG
Post by: EgonOlsen on July 01, 2004, 10:06:45 pm
Assuming that you are looking at your sprite from above (i.e. down the y-axis), this code may serve as a starting point (you just have to draw yourself an arrow-texture with the arrow pointing up to test it):

One last thing: Please use this code with the updated jPCT 1.02 from today. The version from yesterday had a bug in it that this code will suffer from).

Code: [Select]
import java.io.*;

import java.awt.*;
import java.awt.event.*;
import com.threed.jpct.*;
import com.threed.jpct.util.*;

class TargetDemo {
   private FrameBuffer buffer=null;
   private World theWorld=null;
   private TextureManager texMan=null;

   private int width=640;
   private int height=480;

   private Frame frame=null;
   private Graphics gFrame=null;
   private int titleBarHeight=0;
   private int leftBorderWidth=0;

   private boolean exit=false;
   private KeyMapper keyMapper=null;
   private int mouseX;
   private int mouseY;
   private Object3D arrow=null;

   public static void main(String[] args) {
      new TargetDemo();

   private TargetDemo() {

      theWorld=new World();

      theWorld.setAmbientLight(255, 255, 255);

      texMan.addTexture("arrow", new Texture("textures"+File.separatorChar+"arrow.jpg"));

      arrow.rotateX((float) (Math.PI/2d));
      arrow.setRotationMatrix(new Matrix());
      theWorld.getCamera().rotateCameraX((float) (Math.PI/2d));


   private void initializeFrame() {
      frame=new Frame();
      frame.setTitle("jPCT "+Config.getVersion());
      Insets insets=frame.getInsets();
      frame.setSize(width+leftBorderWidth+insets.right, height+titleBarHeight+insets.bottom);
      keyMapper=new KeyMapper(frame);
      frame.addMouseMotionListener(new MouseMotionAdapter(){
         public void mouseMoved(MouseEvent e) {

   private void display() {
      buffer.display(gFrame, leftBorderWidth, titleBarHeight);

   private void gameLoop() {


      buffer=new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);

      while (!exit) {


            // Rotation stuff
           SimpleVector arrowCenter=Interact2D.projectCenter3D2D(buffer, arrow);
           if (arrowCenter!=null) {
              SimpleVector delta=arrowCenter.calcSub(new SimpleVector(mouseX, mouseY, 0));
              Matrix rotMat=delta.getRotationMatrix();
              if (delta.length()>5) {
                 // Move the arrow slowly...
                 SimpleVector t=arrow.getZAxis();


   private void poll() {
      KeyState state=null;
      do {
         if (state!=KeyState.NONE) {
      } while (state!=KeyState.NONE);

   private void keyAffected(KeyState state) {
      int code=state.getKeyCode();
      boolean event=state.getState();

      switch (code) {
         case (KeyEvent.VK_ESCAPE): {
Title: Project AuNG/zG
Post by: EgonOlsen on July 01, 2004, 10:07:33 pm
And by the way: Nice project... :D
Title: Thanks
Post by: Crowley on July 11, 2004, 05:19:26 pm
Thanks, Egon :) I haven't really attempted to implement the rotation just yet as I've spent the last ten days creating other, non-graphical parts of the game, but I'll look into the rotation when I start working on the graphical engine again. As you can see, I did finally decide to register in the forums here.

As far as the engine is concerned, we aren't actually looking down from above, but from the side, along the Z-axis. I went this way for a couple of reasons: first, I was too lazy to move the camera and second, I've programmed 2d tile base games in the past so I wanted to keep the X and Y where they have been before :)
Title: Re: Thanks
Post by: EgonOlsen on July 11, 2004, 05:40:35 pm
Quote from: "Crowley"
As far as the engine is concerned, we aren't actually looking down from above, but from the side, along the Z-axis.
Shouldn't matter that much. The code may still work with some additional rotation magic applied to it. In fact, i wrote a little demo application for myself, where a MD2-model was moving towards the mouse. The camera was looking from somewhere between z and y axis down to the origin and it worked fine.