Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

192 Neutral

About LonelyStar

  • Rank
  1. Hi, To use Vector graphics (such as SVG files) in games, I am looking for a way to load and display them in OpenGL. This: seems to be pretty cool, a OpenGL accelerated OpenVG implementation. But to use it, I must load the SVG (or some other format) first and somehow process it with openVG commands. Has anyone experience with this or suggestions what to look into? Thanks! Nathan
  2. Quote:Original post by alvaro The idea is relatively simple: Encode your message as a single number between 0 and 1 and write it down in binary. For instance, if you want to send 3 numbers (a, b, c) from 0 to 21, your real number is x = a/22 + b/22^2 + c/22^3 So to send (5,21,2) you'll send x = 5/22 + 21/22^2 + 2/22^3 = .270848985725018782870022539444027047332832456799398948159... In binary that's .0100010101010110010110111110111111010111111... You only need to send enough bits to be able to distinguish between multiples of 1/22^3. In this case I believe that's 14 bits ( ceil(3*log(22)/log(2)) = 14 ). Decoding goes like this: .01000101010101(b) = .27081298828125 .27081298828125*22 = 5.95788574218750 .95788574218750*22 = 21.07348632812500 .07348632812500*22 = 1.61669921875000 (which rounds to 2) I would have to think carefully about the details of the rounding or truncating. Hey, OK, that I understand. But now I have a LOT of numbers to put into a stream. How can I know what to write out and when? I mean, the precision of the double is exhausted at some point. Regards, Nathan Edited for clarity.
  3. Hi, I want to ebulliently (as in size efficient) pack a series of numbers into a stream. The numbers all have a range they can be in (i.E. 23-45) which is known to the packer and to the unpacker. But the ranges are not power of 2 aligned. For example a number may have the range 23-45, which is 22 possibilities. I could pack this number into 4 bits, wasting a little bit of space. I want to pack more efficiently. I remember reading about this, having to do with arithmetic encoding. But reading the wikipedia article about arithmetic encoding, I can not figure out how. Thanks! nathan
  4. Quote:Original post by Hodgman I don't know if send the difference in position like that, however, the client does know which state the server is relating the difference to -- that's the key to the whole Q3 algorithm. Is that really the case? I thought the client uncompresses against the last state it received from the server, which does not necessarily have to be the same as the last state, the server knows the client has received.
  5. Quote:Original post by KulSeran Your position will have a huge range on a regular map, but it will change by comparatively little each frame. Same for velocity, etc. It takes less bits to represent a small number compared to a large number. Are you suggesting that the difference to the last game state is send, as in: newPos = oldPos + sendDifference ? I do not think that is done in Q3, because for that the client would need to know which state the server is relating the difference to.
  6. Hi, this article: says, in Q3, game states are delta compressed before being send over the network. Why does that make sense? What information is sent? For every player: - position - velocity - looking direction - "shooting state" All of this variable (maybe not "shooting state", but the rest) change constantly in a FPS. So what is gained by delta compression? Thanks! nathan
  7. Hey, I could not find an implementation that handles moving objects to my liking. That's why I want to reinvent the wheel :).
  8. Sorry for the unclear formulation, lot's of movable objects!
  9. Hey, I am thinking about writing a general purpose (loose) quadtree, if possible as a templated container. The basic Idea is no problem, all that is required is a posX and posY member for the inserted type. But now, objects should be able to move! And now it gets difficult. After moving an object, it has to be "reinserted" into the quadtree. I can not think of another way to do this (efficiently) but: - Store a pointer (or similar) to the current node in every object - Have the object inform its node about the move whenever it happens. So objects in a quadtree must be derived from class QuadtreeObject { public: Node* cuNode; void onMove(); double posX; double posY; }; What bother me the most, is that the user has to call onMove everytime the position changes. So I am wondering: what are your thoughts? Ideas how to simplify this? Thanks!
  10. Hi, I want to add a quadtree to my 2D game engine. And I am trying to make it a typesafe container. I would make the container templated, but given the type of objects to insert as a template parameter. Now imagine this: In the game, there are: Obstacles, Players and enemies. So the object type the quadtree would have to handle is a base class of those three, lets call it Entity. Now, when an enemy is updated, it wants to query all players close to it (for the sake of the argument imagine there are a lot of players in the game) to shoot at the closest player. To make it possible, to iterate over just one type of objects (just over players), I could define "groups" in the quadtree. It would do something like: #define OBSTACLE_GROUP 0 #define ENEMEY_GROUP 1 #define PLAYER_GROUP 2 ... Quadtree::RectIterator iter(pos.x-10,pos.y-10,pos.x+10,pos.y+10, quadtree, PLAYER_GROUP); for (; iter!=quadtree.end(); ++iter) { Player *p = (Player*)iter->getPointer(); // A this point I have to upcast if(dist(p)<10) { shootAt(p); } } As you can see, I have to upcast the player pointer. That makes the whole process typeunsafe ... Anyone an Idea how else to to it? In a typesafe way? Thanks! Nathan
  11. Hey, Thanks for the replies. After trying around it turns out I am not happy :(. I want the user to be able to write: #include <myLib/Window.h> using namespace myLib; ... Window win; ... But Window.h includes X.h, which defines its own namespace. Is there a solution that allows this? Thanks!
  12. Hi, While writing a library, I put everything in my own namespace. i.E. I have a class called Window. Now I also want to use Xlib to open an X11 window. So I have this situation: #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/extensions/xf86vmode.h> namespace myLib{ class Window { ... Window X11Window; ... }; }; And I off course get the error: error: reference to ‘Window’ is ambiguous /usr/include/X11/X.h:96: error: candidates are: typedef XID Window Can I somehow avoid this name conflict without renaming my class? Thanks!
  13. LonelyStar

    How do you pass around game objects

    Quote:Original post by tm1rbrt Quote:parts.push_back(somePart); // All pointers to previous objects might get invalid This is wrong. Your not pointing to a position in a vector, your pointing to a game object. Yes, but the position in memory where the game objects are located might change at this point.
  14. Hey, Lets say I have a base class for things that can be drawn: class Sprite {}; Now these objects can be inserted in some sort of space partitioning container, passed to a renderer e.t.c. My question: How do you pass them around? One could just pass around pointers: SceneGraph::insertObject(Sprite* o); Rendere::drawObject(Sprite* o); But that has the disadvantage, if I somewhere has an object with a set of sprite in an vector, pointer can get invalid: class ManyPartsGameObject { std::vector<Sprite> parts; ... parts.push_back(somePart); // All pointers to previous objects might get invalid One solution of this would be, to never have Sprites directly, but only references to them (pointer, boost::shared_ptr e.t.c.) and create them with "new". So I am curious? How would you recommend doing this? Thanks!
  15. To overload the placement new and new[] to use my own memory manager: inline void* operator new(size_t nbytes, ogl2d::MemoryManagerImpl& mm) { return mm.allocate(nbytes); } inline void* operator new[](size_t nbytes, ogl2d::MemoryManagerImpl& mm) { return mm.allocate(nbytes); } I am puzzled, should they behave different in some way? Thanks!
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!