Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Insdeath

  • Rank
  1. Insdeath

    3D Rotation problem

    Thanks for the response. I think I have figured out some things about the quaternion now. However, I would like to - at any given time - extract the rotation axis and angle from this quaternion. Is the following assumption correct? Rotation axis (vector) = (quaternion.x; quaternion.y; quaternion.z); Angle = quaternion.w;
  2. Very good point. Then I assume it's best to do the following: At server startup, execute any events that would have been executed during the server downtime, such as unit training, building construction, resource gathering, battles, ..., based on the start time and duration. Thank you very much for your help, I think I can manage my project on my own now. I was unsure about whether my basic design was good or not. Thing is, if my basic design is bad and I base everything off that, then at some point I may have to throw away all my current code and start all over again. I'd prefer not to have that happen
  3. Insdeath

    3D Rotation problem

    Hello everyone! I am currently working on a game which involves moving (and rotating) objects in 3D-space. I have heard (read) a great deal about using Quaternions to represent and calculate rotations in 3D-space. However, after googling for hours I still don't understand at all how they work, let alone how I could use them to represent/calculate rotations. Can anyone point me in the right direction? Maybe some (pseudo)code as to how to work with a quaternion, or a site/tutorial/example where a quaternion is used. All I have read so far are theoretical concepts which I don't understand at all. I know vectors, matrixes and complex numbers, but I still don't understand how this stuff works. Thanks! [EDIT]: I just came across this article on gamedev.net: Do we really need quaternions? In short, it says you might be better off using an axis/angle approach than by using a quaternion. However, I actually tried this, but the problem with that is that I can't manage to make proper calculations. Say I have this: - Current direction vector: (1; 1; 0) - Rotation axis: the x-axis - Rotation speed: 1 radian per second (Location is of no concern to the calculations, since that doesn't change with a rotation) Code example: rotation of the object around the x-axis: double ry = direction.y * Math.cos(rotation) - direction.z * Math.sin(rotation); double rz = direction.y * Math.sin(rotation) + direction.z * Math.cos(rotation); direction.y = ry; direction.z = rz; After one second, this would mean: direction = (1; 0,54; 0,84) So this calculation works. However, I can only calculate the direction when the object rotates around the x-, y- or z-axis. Does anyone know how I can apply this kind of calculations when trying to rotate around ANY axis in 3D-space? For example: the axis (-1; 1; 0).
  4. An example of an event is the following: A building is being constructed. I create an event for this which I place in a priorityqueue. This queue handles so-called timed events for me (events which I give a starting time and an execution time). Let's say the building starts being constructed at sept 28, 4PM GMT. The construction takes 20 minutes. So we save that information in the database. However, if the server were to crash in the middle of this event, and is only rebooted say an hour later, then how do I make sure the server doesn't suddenly think the building is already constructed at the moment it reboots? It will think the construction has been finished, based on the starting time and the time it takes to build. I probably need a special frame of reference for this. Maybe an internal clock in the server which only runs when the server runs, and everything is calibrated according to that clock? Thanks for the information about transactions, I'm looking up how exactly those work and I will make sure to integrate this into the server. [EDIT] Someone who works with me and who is responsible for all database-related issues said he knows about transactions and how they work. So we have that
  5. Thanks for your quick response. So apparently, there doesn't seem to be any specific, 'special' approach for this kind of games, just following my gut instinct then Concerning the database, what do you mean exactly by Transactions vs Events? I would present Events as following: it has a starting point (the current time in milliseconds as obtained from System.currentTimeMillis()) and the time it takes to complete/start the event (also in milliseconds). However, say the server is down for about one hour, how do I then make sure my event still works properly and isn't desynchronized with the rest of the world data? I'm not exactly sure as to what Transactions are...
  6. Hello gamedev.net forum! For some time now, I have been thinking to make a game of my own. It's nothing big or fancy, I don't have high expectations nor am I overly ambitious about this, it's mostly to see what I am capable of doing and to gain a lot of experience in game design and programming in general. I use Java as programming language, because I have a lot of experience with it. I have been maintaining a simple (java-based) MMORPG (not made by me) for about 2 years and currently have an understanding of how everything works inside. I mean to take this a step further, and actually create a game of my own from scratch. But instead of an MMORPG, I would like to make an (MM)ORTS (basically like Evony/Tribal Wars). At first, I would like to start simple by having the following: - A client - A server with a persistent world - A persistent world which consists of continents, countries and villages. Villages are part of countries, countries are part of continents. - A database to save the persistent world and player-data - Buildings which can be placed, upgraded and destroyed, producing resources or units - Some units which can walk around, fight each other and destroy buildings - A bit of basic AI I know how to make most of these things work, I know a great deal about algorithms, networking, database and real-time rendering. However, I am struggling with a very basic yet very important issue: I need to know how to save the persistent world in both the server's memory and a database (database only being used in case the server crashes to rebuild the world), in an efficient and proper fashion. (Note I am only talking about Arrays and ArrayLists below, but this datastructure can be replaced with any other datastructure which is a better choice in each situation) 1) Do I keep a static Array of my continents, each containing an Array of countries, and each country has an ArrayList of villages? Does each village contain an ArrayList of buildings and units placed within? 2) Does each building/unit have a reference to the village it is in? Does each village have a reference to the country it is in? Does every country have a reference to the continent it is in? 3) Where do I keep track of the units? Especially given they can move from one village to the other. 4) Same 3 questions, but this time in the database. How do I link everything together? I know how to link countries and continents to each other in a database, but I'm not sure how to link the villages/units/buildings together especially since they are quite dynamic. 5) Say the server crashes. After the crash, the server has to rebuild the persistent world based on the contents of my database. What is the best approach (design-wise) to prevent desynchronization of events, rollbacks or other inconsistent data? I hope the questions are quite clear, and that someone is willing to assist me with this issue. I'm not expecting a clear-cut answer, but anything to point me towards the right direction is helpful. Anyone who has some experience with (online) RTS games probably knows the answer to many of these questions, and I don't think there is a major difference between C++ and Java design-wise. Thank you!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!