ChristerSwahn
Member
Content count
22 
Joined

Last visited
Community Reputation
198 NeutralAbout ChristerSwahn

Rank
Member

common client/server IO volume & rates
ChristerSwahn replied to ChristerSwahn's topic in Networking and Multiplayer
Yes right. Perhaps I should have been more detailed in my question! ;) I'm interested in tradeoffs between package frequency and size being made nowadays in production grade realtime multiplayer games, and what bandwidth and latency game developers assume/require the players to have. In the MMO I'm working on I'm currently sending world state updates in the range of 15 kb, 510 times per second. It's a strategy MMO and as such doesn't quite have the precision requirements of an FPS. But I have yet to write a more advanced package splitting and data compressing logic. I don't know if that is likely to be necessary so I'm curious at what others are doing regarding network IO performance. 
I'm curious as to what are "usual" client/server data volume, throughput rates and tick/update frequencies nowadays. (In realtime multiplayer games.) It would be interesting to hear reasons for or against higher number of smaller updates per second versus lower number with greater size. Would anybody like to share their experience on this?

Optimal representation of direction in 3D?
ChristerSwahn replied to ChristerSwahn's topic in Math and Physics
Hodgman  all fair points, if you're looking for an optimal representation [i]for a given specific kind of computation[/i]. 
Optimal representation of direction in 3D?
ChristerSwahn replied to ChristerSwahn's topic in Math and Physics
[quote name='Hodgman' timestamp='1341308175' post='4955212'] From your first post, it sounds like your task is to compress them into the most efficient storage format? If so, you could just run your regular normalized XYZ vectors though ZLIB [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img] ([i]p.s. sorry for the tongueincheek post[/i]) [/quote] No it's rather about optimal value representation. (An analogous discussion would be: Are floats an optimal or closetooptimal representation of Real values given an N bit word to store it in?) But computability would be nice, which the approach I found in the last post appears [i]not[/i] to be. The best approach that's still practical still seems to be the [color=#282828][font=helvetica, arial, verdana, tahoma, sansserif][size=3][left][background=rgb(250, 251, 252)]Equidistant Azumuthal Projection.[/background][/left][/size][/font][/color] 
Optimal representation of direction in 3D?
ChristerSwahn replied to ChristerSwahn's topic in Math and Physics
Nice that I'm not the only one that finds such problems exciting! ;) It was the Equidistant Azumuthal Projection I was considering (your second link). After some more thought on it, yes you're perfectly right! While it is possible to construct the projection so that there are no redundancies except at two poles, swapping one projection for the other will probably only move the dense and sparse precision areas around. Orthogonal coordinate systems will probably always produce varying angular precision over a curved surface. I started thinking about it another way. Since we're looking for a [i]discrete [/i]geometric representation of points on a unit sphere surface, preferably with uniform distribution, why not state the problem as a discrete maths problem: for a given number N of representation bits, find an enumeration of 2^N points on the unit sphere surface that are as equidistant as possible, and for which the translation to and from the the bit representation can be done algorithmically (worst case) or algebraically (best case). This problem seems to be a special case of Spherical Code: [url="http://en.wikipedia.org/wiki/Spherical_code"]http://en.wikipedia.org/wiki/Spherical_code[/url] Such as Spherical Covering: [url="http://neilsloane.com/coverings/index.html"]http://neilsloane.com/coverings/index.html[/url] Another approach could be the Circle Packing problem: [url="http://mathworld.wolfram.com/CirclePacking.html"]http://mathworld.wolfram.com/CirclePacking.html[/url] It still seems there is no algebraic (i.e. noniterative) solution however. :/ (3D applications' renditions of spheres could also be interesting to look into  how do they map spheres to polygons?) 
Optimal representation of direction in 3D?
ChristerSwahn replied to ChristerSwahn's topic in Math and Physics
My idea in the first post was essentially spherical coordinates, which as a pure value space can be thought of as twodimensional vector (rectangle from [PI,PI/2] to [PI,PI/2]). A better solution but not perfect one seems to be to use the azimuthal projection variation I described. In this (academic) exercise what I was striving for was essentially a bit representation of a 3Ddirection with no redundancies, no invalid nor unnormalized values and if possible uniform precision. 
Optimal representation of direction in 3D?
ChristerSwahn replied to ChristerSwahn's topic in Math and Physics
Yes but in contrast to cartography this problem is about a discrete geometric representation, and luckily the metric/fidelity and aesthetic requirements of cartographic projections can be ignored. Reading up on them my proposal seems to be a variation of azimuthal projection. (Anyhow, by now I'm satisfied that achieving uniform precision seems to be impossible algebraically. ;) ) 
Optimal representation of direction in 3D?
ChristerSwahn replied to ChristerSwahn's topic in Math and Physics
It's not that I'm worrying, as I wrote I find it an intriguing problem. Call it academic interest! ;) Thanks for the input clb. But after some more thought it turns out that the redundancy and inconsistent angular precision of spherical coordinates is analogous to the problem of projecting a spherical surface on a plane (e.g. the world map). Spherical coordinates essentially project the sphere surface onto a rectangle (from [PI,PI/2] to [PI,PI/2]). The closer to the poles of the sphere the more compact/redundant the values get. However if we project the sphere surface onto a circle this problem is avoided. And this can be represented using regular 2D polar coordinates. (To explain: Picture a circular world map (or elliptic, doesn't matter). Instead of longitude and latitude coordinates to represent a position (which is what 'spherical coordinates' do), use polar coordinates around the map center.) It is still not perfect in that the angular precision is not uniform (its highest near the origin, lowest at the circle edge) but apart from that it appears optimal to me. Except for the duplicate values at the circle edge (half the circle edge represents the same directions as the other half), there are no redundant values and we have a 1:1 bijection between the representation value space and 3D direction space. And if using signed integers as in the original post there are no invalid values. As you say this would not be practical to use in calculations but I think it might be useful as a stable way to represent directions in persistent storage or IO. 
In my 3D logic I'm somewhat annoyed by the inefficiency and (mostly theoretical) risk of inconsistent values in representing 3D directions with 3valued vectors as I am doing. (I write theoretical since the code is stable, but still.) I'm probably not going to rewrite it but I'm intrigued by the problem, what is the optimal way to represent a direction in 3D, i.e. with as little space, redundancy and invalid value cases as possible, and if possible no normalization checks and renormalization operations needed? (With direction I mean just the direction, i.e. not including position in space nor any roll (rotation around the direction vector itself). For instance a line (ray) can be represented by a point and a direction.) An idea is to use a rotation in the xyplane (represented by a signed int A that is the nominator in the fraction A/PI, giving the interval [+ PI]), plus a halfcircle rotation in zspace (represented by a signed int B in B/(PI/2), giving the interval [+ PI/2]). There are no invalid nor unnormalized values so that's good. But it's not fully optimal in terms of bit representation:  the zspacerotation has twice the angular precision of the xyrotation which is a little irregular,  even more irregular is that the closer the direction gets to the Z axis the greater the angular precision,  at the directions +Z and Z, A has no meaning (all values of A are equally valid). And using this representation in actual 3D code seems less than efficient. Every time it's used two divisions and floating point conversions seem to be required. And how would you efficiently apply an arbitrary rotation to it? Your thoughts?

Java Graphics.drawImage seems to leak memory..?
ChristerSwahn replied to Rich76's topic in General and Gameplay Programming
Java2D Graphics does some caching of the transformed and rendered images, e.g. if you transform/scale them, to increase the UI update speed. Perhaps it is this caching that you notice. Is the increased memory a problem for you? If you only want a "raw" rendering of an image, pixelforpixel, perhaps you should not use Java 2D (Graphics2, and JComponent decendents such as JPanel), and instead use e.g. Canvas ("heavyweight" UI component in the java.awt package). 
Structure of classes in good Game Engine?
ChristerSwahn replied to iLoveGameProgramming's topic in General and Gameplay Programming
Interesting discussion to follow as a Java developer. Are the logging conventions in C++ really that diverse? For Java there is almost a defacto standard for logging, and in all the cases I've seen it used it's simply through a static member in each class, e.g.: [CODE] public class StdPlayerCreator implements PlayerCreator { public static final Logger LOG = Logger.getLogger(StdPlayerCreator.class); ... LOG.error("Internal error, failed to find a settlement"); [/CODE] The parameter to getLogger() is effectively just a hierarchical label. It allows you to configure the logging output threshold on a class or package hierarchy. (This configuration is in a separate XML.) Yes the above would break if multiple "runs" which should have distinct logs are run in the same JVM (java process). However that is rare and the logger can be instantiated differently for such use cases. (Sorry for the tangential comment... ;) ) 
Algorithm for an object that follows another object, with acceleration.
ChristerSwahn replied to Fluxing's topic in Math and Physics
To make this smooth and realistic in terms of acceleration, it's not sufficient to calculate a trajectory only on the distance between the objects, the trick is to arrive / get close to the target object while simultaneously achieving the same velocity as the target. I wrote here earlier about a solution for this in 3D. (The principle is the same in 2D.) The solution uses the chasing vessel's/object's acceleration capability and doesn't require any 'damping' or similar to achieve a realistic effect. It might be overkill for your requirements but it gives an optimal and smooth trajectory. The code should be straightforward to adapt to 2D. If you're interested you can find the solution here: [url="http://mmoarch.blogspot.se/2012/05/computingspacetravelimplementation.html"]http://mmoarch.blogspot.se/2012/05/computingspacetravelimplementation.html[/url] 
I must be doing something wrong (slow development)
ChristerSwahn replied to Nairou's topic in General and Gameplay Programming
I read a study somewhere that at a large software company, the most productive programmer was more than 60 times as efficient than the least productive professional programmer. I find this very plausible. 
UML IT infrastructure
ChristerSwahn replied to Signature's topic in General and Gameplay Programming
[quote name='Signature' timestamp='1338546064' post='4945258'] It would be fully scalabe ... every person and enterprise could decide how to use it  in other words we could actually decide to go for a humble approach. There days we need to employ specialists and come up with a model that has been defined millions of times already by other groups and individuals ... I don't see what's humble about that. [/quote] I've got to ask, have you actually developed software AND the related processes for a big organization, and seen it through to production/rollout? Many similar subprocesses have been defined formally or informally by many organizations yes. But the devil is in the details, and process details depend on their context. Working with processes you have to make sure they integrate at all levels of abstraction which means you can't design/define them in isolation. Even a single human intelligence isn't enough. For instance I've seen banks overhauling processes and they have large teams devoted to the "paper designs" for years, and they're in constant debate with the rest of the organization how everybody and every system are to work together. [quote] Through devide and conquer things would be simpler not more complex or complicated. [/quote] Which means: Don't try to design a single system/process/framework to solve everything! ;) 
Need help regarding how to draw smoothly in Java.
ChristerSwahn replied to lthannyl's topic in General and Gameplay Programming
Java2D (& Swing) can definitely handle simple animations smoothly, you need to work with it the right way though. To begin with, all java graphics are normally rendered on its own AWT thread and you shouldn't do any painting on any other thread. (You can update game state etc on other threads but the data updates needs to be synchronized with the AWT thread.) The painting is done by the paint() method of java.awt.Component and its subclasses/submethods. Usually you can simply create a subclass to JPanel, override the paintComponent() method and put your rendering in there (JPanel is doublebuffered by default). I'd recommend reading up on Swing a bit: [url="http://docs.oracle.com/javase/tutorial/uiswing/index.html"]http://docs.oracle.com/javase/tutorial/uiswing/index.html[/url]