Technopolies

Started by rolz, October 21, 2004, 04:03:43 PM

Previous topic - Next topic

rolz

nope, all manipulations are done in in a single thread. I have noticed "blinking trees" myself and tried to check where it happens but with no luck.
Regards,
Andrei

EgonOlsen

But at least some translations on transparent objects (i don't know exactly how to detect a tree, so i limited it to transparent objects) are happening from inside a netty-evt-thread:

com.threed.jpct.Object3D@b51c29Thread[main,5,main]/(228.44463,627.73645,148.74597)---
com.threed.jpct.Object3D@4bf53eThread[netty-evt-0,5,main]/(383.0,667.0,162.75)---
com.threed.jpct.Object3D@d1e7c2Thread[netty-evt-0,5,main]/(252.60387,475.0233,118.229996)---
com.threed.jpct.Object3D@c68a98Thread[main,5,main]/(237.27441,624.1358,150.66376)---
com.threed.jpct.Object3D@b51404Thread[netty-evt-0,5,main]/(393.0,508.5864,160.44)---
com.threed.jpct.Object3D@354749Thread[netty-evt-0,5,main]/(327.56393,472.576,170.94)---
com.threed.jpct.Object3D@1db484dThread[main,5,main]/(246.53288,620.346,144.48578)---
com.threed.jpct.Object3D@bf1d3bThread[netty-evt-0,5,main]/(406.24905,725.4451,121.59)---
com.threed.jpct.Object3D@cc0e01Thread[netty-evt-0,5,main]/(289.96194,466.99997,161.49)---
com.threed.jpct.Object3D@ab7165Thread[main,5,main]/(256.31824,616.3402,138.6347)---
com.threed.jpct.Object3D@19a37aThread[netty-evt-0,5,main]/(410.00003,613.0,150.78)---
com.threed.jpct.Object3D@13bdd36Thread[main,5,main]/(265.8971,612.4185,136.0576)---
com.threed.jpct.Object3D@1381960Thread[main,5,main]/(275.305,608.56665,135.85318)---
com.threed.jpct.Object3D@9fa8fThread[netty-evt-0,5,main]/(432.49133,679.6593,150.15001)---


Or maybe it's a problem with the quadtree somehow? I also managed to get a "blinking house" once or twice.

EgonOlsen

I tried to reproduce it in a modified CarTest-example, i.e. changed it to use the AWTGLRenderer, loaded your trees instead of my plants and placed 2K of them on the map. Had fog enabled and the car was emitting light...just like in Technopolies, but it worked just fine. No blinking at all. If this is a jPCT problem, it must be a very strange one.... :?:

rolz

Damn, I should've drunk too much beer just right before my previous post ;*).  

Yes, it looks like network event processing threads are modifying the world (add/remove/translate objects) It won't take much to fix, i will let you know if  it worked.
Regards,
Andrei

rolz

It worked, try new client
http://home.ripway.com/2005-7/356549/techno_2005-07-21.zip

btw, one thing that remained - trees consist of several planes and sometimes (depends on camera placement) they way one plane overlaps another is inconsistent: on one frame first plane overlaps second and on the other frame second frame overlaps first, causing "blinking"
Regards,
Andrei

rolz

- chat
- some feedback from bots on your actions ;)

Regards,
Andrei

EgonOlsen

It works fine now. Even if it wasn't a problem in jPCT, it made me rework some parts of the AWTGLRenderer and discover some bugs. Speaking of bugs: On my machine, the blitted text is gone (happens on some machines  and/or in some resolutions due to some weird zbuffer/clipping plane stuff). Set Config.glFixedBlitting=true and it will appear again. I'll enable this by default in the next release anyway.
About the blinking: There's not much you can do about that, i'm afraid. Sorting is always an issue with transparency. The polygons are sorted by the painter algorithm using their z-midpoint (roughly) but this won't give you correct sorting in all cases. And a zbuffer is pointless for transparent polygons (i had this enabled once and it looked even worse)...so you have to live with that. It's not that bad anyway, IMHO.

Edit: I like the talking bots...add some "personality" to them.

rolz

Is available (6.5mb)
All-in-one (no java required)

http://195.91.144.195/techno.exe
- camera controls (cursor keys)
- minimap
- minor graphics & animation improvements



Regards,
Andrei

EgonOlsen

I got this one from time to time...:

Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at aD.a(Unknown Source)
at aD.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at y.paint(Unknown Source)
at y.update(Unknown Source)
at sun.awt.RepaintArea.updateComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


It's a show stopper, because it bails out of the AWT event dispatch thread which causes some problems in the AWTGLRenderer.

manumoi

Hello, I got the same exception with my NIO client/server... I thought it was a question of synchronizing some of my collections... But it may not be this. I now think that maybe I receive too much updates for a time slot(in fact i send and receive an updatePosition method at each loop of the game loop of each of my clients)... If you have any ideas about this bug, I will be interested to see it...

rolz

nope, this looks like a synchronization bug to me.
just make sure to add synchronized(XXX) block to you code wherever you iterate/modify collections from different threads

btw, regarding too much updates - you can split events into "started" and "finished" instead of sending updates each turn.

For instance, a movement can be interpreted as
1. movement started (where to, speed)
2. arrived (where)
Regards,
Andrei

manumoi

I did this stuff about synchronising my collections access... But the problem with this bug is that it doesn't appear so much... So it  s hard to point where it comes from...
Concerning your start/end strategy, i thought about that before but my concern was that, for two clients with different hardware speeds (and faster game loops) movements may differ,  I mean if you are 10 units far from your objective, the avatar that is representing you may arrive earlier on it on your computer than on another one.... That would give problems of consistency to my world. That s why i prefer to send positions of all my moving objects at each game loops... since my server receives updated positions of each objects when they are moving.
Maybe the best solution would be to use your technic and find a technique for controlling frame rate and game speed of each client but I don t know such trick.
Anyway I will check for the exception tomorrow (4 am here) and come back if i found something.
bye bye

rolz

dont you have a dedicated system where game logic is processed ?
i mean server which processes commands from players and send back events.

The simple example of a command-event cycle is something like

1. player1 sends move command
2. server starts processing command (rotates player and checks for collision)
3. server sends start movement event to players on map
...
4. server moves player some more forward and checks for collisions
...
5. server sends arrived event to players on map


btw, do you use any middleware tier on top of NIO like netty or mina ?
Regards,
Andrei

Uija

You are doing every single step the player is moving on your server?
I haven't got your client running yet, so I don't know exactly the game mechanics, but it sounds alot dependend on a good connection and no lag.
I am playing mmorpgs for some years now, and have the opinion, that the client is sending a movement command (a vektor or something) and the server checks it. until the server is not sending a failure, the client is moving.
Perhaps there are some sync processes running, but moving a Char in those Games I played way to much (ao, eq 1+2, wow, AC1/2) was not affected by lag. in wow you can run around for some time after the server is gone, until the timeout is running out.
perhaps I understood you wrong, tho ;)

rolz

Yes, the idea is that client only sends commands. server does calculations and sends processed events back to players.

as to lags/connection - it depends on how much data you are going to send and how often. Technopolies generates <0.3 kb/sec of data on a 100 players map , i dont think it is too much even for a modem connection.

The situation with lags is the same - lags exist anyway, it is up to client application to smooth these lags and respond immediatelly after player started doing something. I.E. if i start movement, the client will start moving character outright without waiting for server's confirmation.
Regards,
Andrei