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 - EgonOlsen

Pages: 1 ... 778 779 [780] 781 782 ... 822
11686
Projects / Raven's projects
« on: November 17, 2005, 09:06:02 pm »
Quote from: "raft"

instead of controling animations and other things (movements etc) from a central location i've also defined a FrameListener interface which lots of my 3d objects implement. so they can 'take care of themselves'
Yep, i'm doing it in a similar way. It's just that i have no common listener interface for that but "managers" on top of each entity-class that hold the references to all entities of a type and forces them to update/move/hide...whatever is needed. My timing works different. I'm measuring the time that has passed since the last frame in "ticks". A "tick" in Paradroidz is a 200th of a second IIRC. All my methods take these ticks as a parameter and act accordingly. For example: If i move an entity x units forward for one tick, i move it 8*x units forward if 8 ticks has passed since the last call. This has two drawbacks you have to be aware of:

1. all your algorithms have to be "tick"-able, which causes some extra work from time to time.

2. time taken in collision detection correlates with the length of the translation vector. This can cause the following: Game needs 2 ticks to update all entities, collision detection is called with 2 ticks, needs 1 tick itself due to that. So, you have 3 ticks for the next frame, call collision detection with 3 ticks, which now needs 2 ticks to complete and so on...that will result in a seconds per frame display over time. To avoid that, i'm limiting ticks to a max amount. If it superceeds this value, the game will simply slow down (i theory...it never happened for Paradroidz because collision detection is too fast)

11687
Projects / Raven's projects
« on: November 17, 2005, 08:17:35 pm »
Quote from: "Raven"

For example, should I be looking into threading each type of manager so it runs independantly?
I'm quite busy ATM, so the short answer to this is: NOOOOO!  :wink:
Don't let another thread than your main thread manipulate your game entities (at least not as long as it affects jPCT related stuff). It may happen at any time, even when jPCT is rendering them and that will cause all kinds of wierdness which are a pain to debug. Trust me...been there, done that...
Don't manipulate the Camera, the World, an Object3D etc. from inside another thread. Don't do it. Never! jPCT has a kind of locking implemented (has to be enable explicitly) to make it pseudo-threadsave, but that dates back to the times where i thought that i might be a good idea. It isn't...

Edit: Here's a short code snippet from Paradroidz' main loop. Looks similar to your approach. That doesn't mean that it's the only way to go, but it works for me.

Code: [Select]
 
              if (!gameState.showsSomeOverlay()) {

                  if (data.isAlive()) {
                     player.checkInvincible(storeTicks);
                     player.reEnergize(level, storeTicks);
                  }

                  level.updateShadowVolume();

                  eManager.enterCollisionMode();
                  player.enterCollisionMode();

                  level.processDoors(storeTicks);
                  level.processEnergyPads(storeTicks);
                  level.processDisruptors(storeTicks);

                  SimpleVector playerPos=player.getTranslation();
                  player.processProjectiles(storeTicks);
                  map.disableCollisionListeners();
                  if (data.isAlive() && !gameState.hasState(GameState.FINISHED)) {
                     move(storeTicks);
                  }

                  eManager.setPlayerPosition(playerPos);
                  eManager.calculateVisiblity(storeTicks);
                  eManager.moveEnemies(storeTicks);
                  map.enableCollisionListeners();

                  if (data.isAlive() && !gameState.hasState(GameState.FINISHED)) {
                     eManager.fireAtWill(storeTicks);
                     fire(storeTicks);
                     transfer();
                     level.setArrow(eManager.getClosestEnemyPosition(playerPos, false), storeTicks);
                  } else {
                     eManager.moveBulletsOnly(storeTicks);
                  }

                  eManager.leaveCollisionMode();
                  player.leaveCollisionMode();

                  player.processClouds(storeTicks);
                  player.synchronize();
                  level.processExplosions(storeTicks);
                  level.processBlastRings(storeTicks);
                  level.processParticles(storeTicks);

                  processCamera(storeTicks);
             }

11688
Projects / tokima
« on: November 14, 2005, 10:26:15 pm »
The best thing is: The birds continue singing after quiting the browser window with the applet... :lol:

11689
Projects / Raven's projects
« on: November 14, 2005, 10:14:11 pm »
Quote from: "Raven"
Thanks. I'm going to read up on how I could implement a GameEventListener, not quite sure how that'd work yet.
Somehow like this:

GameEvent:
Code: [Select]
package framework;

public class GameEvent {
 
  public final static GameEvent BUTTON_PRESSED=new GameEvent(0);
  public final static GameEvent BUTTON_RELEASED=new GameEvent(1);
  public final static GameEvent ANOTHER_EVENT=new GameEvent(3);
  public final static GameEvent WHATEVER=new GameEvent(4);
 
  private int i=0;
 
  private GameEvent(int i) {
    this.i=i;
  }
 
  public int getID() {
    return i;
  }
}


GameEventListener:
Code: [Select]
package framework;

public interface GameEventListener {
  void eventFired(GameEvent ge);
}


Your door object:
Code: [Select]
package framework;

public class MyDoor implements GameEventListener {
 
  public void eventFired(GameEvent ge) {
    if (ge==GameEvent.BUTTON_PRESSED) {
      System.out.println("Wooosssshhh!");
    }
    if (ge==GameEvent.BUTTON_RELEASED) {
      System.out.println("SSSSHHHTTTT");
    }
  }
}


Your button:
Code: [Select]
package framework;

import java.util.*;

public class MyButton {
 
  private Set listeners=new HashSet();
 
  public void addGameEventListener(GameEventListener ge) {
    listeners.add(ge);
  }
 
  public void removeGameEventListener(GameEventListener ge) {
    listeners.remove(ge);
  }

  public void press() {
    fireEvent(GameEvent.BUTTON_PRESSED);
  }
 
  public void release() {
    fireEvent(GameEvent.BUTTON_RELEASED);
  }
 
  private void fireEvent(GameEvent ge) {
    for (Iterator itty=listeners.iterator(); itty.hasNext();) {
      ((GameEventListener) itty.next()).eventFired(ge);
    }
  }
}


How to use it:
Code: [Select]
package framework;

public class Test {
  public static void main(String[] args) {
    MyDoor door=new MyDoor();
    MyButton button=new MyButton();
   
    button.addGameEventListener(door);
    button.press();
    button.release();
  }
}


But that's just an idea. You don't have to do it that way. In fact, i'm not doing that myself in Paradroidz but using a tighter coupling. Depends on your needs...

11690
Projects / Raven's projects
« on: November 14, 2005, 06:44:54 pm »
Or write yourself a GameEvent and a GameEventListener. Make the door a GameEventListener, register it on each button in question and let the button fire a GameEvent(<pressed>) to all its listeners when pressed.

11691
Projects / Technopolies
« on: November 13, 2005, 12:51:59 pm »
I tried with 1.5 again. Works fine now. I also had a strange problem (seems to be a bug in String) with the tokima applets and 1.6b60. What a pity...b60 gave me a 20% performance increase with the client VM. However, if nothing works anymore, it's not worth it... :wink:

11692
Projects / Technopolies
« on: November 13, 2005, 01:17:31 am »
I couldn't even download it with Java1.6 b60. Got an exception that makes no sense to me....

Code: [Select]
java.net.UnknownHostException: javagamesfactory.org
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload.getUpdatedLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.downloadJNLPFile(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


 :?:
Maybe an issue with the beta version...

11693
Projects / Technopolies
« on: November 12, 2005, 07:48:48 pm »
It should help most to move the near clipping plane farer away. Try 10 for example (instead of 1) and see if that helps. Can be done via Config.nearPlane.

11694
Projects / Technopolies
« on: November 12, 2005, 07:34:38 pm »
Quote from: "rolz"

i have applied some optimizations like calculating coordinate every N msec, not every frame but it is still the most "heavy" spot in the game (15% & 25% accordingly).
 Could you please give your recommendations on improving performance for these 2 methods ?
Both may benefit from a call to enableLazyTransformations() on the ground object (if possible, i.e. if you are not applying any transformations to the ground after it's in place)). calcMinDistance() should benefit from an OcTree (with setCollisionUse(true)) too.  I understand that calcMinDistance() takes some time, but i'm wondering what should be so expensive in reproject2D3D()...i'll look into that method when i find the time to see if there's some room for improvement left in it.

11695
Projects / Technopolies
« on: November 12, 2005, 07:26:51 pm »
Quote from: "rolz"
Helge,

I've noticed an artifact - "sawed" contours in place when one object intersects with another (tent and tent's shadow on the picture).
I've noticed that it depends on the viewing angle and distance from camera to intersecting objects. Do you have any clues on how it could be handled ?
It's a depth buffer accuracy problem of the graphics card. You may try to adjust the far and/or near clipping plane (if possible of course) to get rid of it. What graphics adapter is that?

11696
Projects / Technopolies
« on: November 12, 2005, 07:17:37 pm »
I love the fact that you are adding a lot of game play related things to Technopolies right now.

Have you already put the new multi texturing stuff to any good use?

11697
Projects / Re: 0.95 is scheduled for Monday
« on: November 12, 2005, 06:17:36 pm »
Quote from: "rolz"

finally, long-awaited webstart support.
Cool. The folks at Javagaming will appreciate it... :wink:

11698
Support / error loading in Linux
« on: November 11, 2005, 08:46:19 am »
When does this happen? Only when using the AWTGL-stuff or with a native OpenGL window too?

11699
News / New logo!
« on: November 08, 2005, 05:14:56 pm »
Raven did a great jPCT logo, which i'm now using on the website and the forum. You may have to reload the page or clear the cache to make your browser show the new one.

11700
News / Database seems to have some problems today!
« on: November 08, 2005, 12:25:41 am »
Don't know the reason, but it refuses connection sometimes today. I hope that my provider can fix this problem fast... :(

Update: Haven't had a problem with that today. So i hope, that it has been fixed...

Pages: 1 ... 778 779 [780] 781 782 ... 822