• Content count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About canned

  • Rank
  1. What about using a temporary ID on the client? So, the client creates a fireball and sets its temp ID equal to TempClientID. It then increments TempClientID for the next fireball. The client sends the fireball information to the server (including the temp ID). In the server's response, it includes the real (server generated) ID to use (the response also includes the client's temp ID so you can tell which fireball the server is referencing) and the client then uses this new ID for the remainder of the fireball's lifespan.
  2. Yeah, I would definitely reccommend setting up a source control server. SVN is probably the way to go. Just open up your router and get registered at or some similar site - then your code is available no matter where you go, portable harddrive or not... Plus you reap the benifits of source control...
  3. Client / Server Languages

    I definitely didn't want this to turn into a war of the languages, though I should have seen it coming as anytime the two languages are mentioned in even the same city, sides are instantly formed and words are thrown like weapons. So maybe a better way to approach this is in the form of a poll. Instead of asking what people think is best, how about, what have people done and to what success? So the new question: In building a client / server game (MMO prefered, but any other form of client / server system works as well), if your client was written in C++, was your server also written in C++ or Java instead? Thanks for the input!
  4. I'm curios as to what languages people are using for their client / server systems. I assume most clients (game-wise anyway) are written in C++. But with that in mind, do most people program a server for a C++ client in C++? Or is Java at all popular? Obviously sticking with C++ for both the client and the server provides the benefit of code reuse. But is it easier to get a distributed server built out of Java? Or are there other benefits to Java? Or do people just stick with C++? Thanks for the input!
  5. I got it working. Turns out it was the Vertex buffer that I didn't quite understand! I had forgetten about the whole FVF idea. So I was treating the vertex buffer as if it were full of D3DXVERTEX3's when in fact, each vertex had much more data. Are there any helper funtions to extract different portions of FVF data from a vertex buffer? As it stands, I'm extracting the vertices with: memcpy(&vertices[0], &((BYTE*)pVertices)[faces[0] * bytesPerVert], sizeof(D3DXVECTOR3)); That seems a little messy, though it works. So if there's a cleaner way, I'd love to know about it. Thanks!
  6. The plane is a trapezoid that extends from the user. It has a shorter edge at the user and a longer edge in the distance.
  7. I've been browsing around the older posts on this forum about this very topic, but I am yet to find a solution to my problem. I'm drawing a plane that represents the range of the user for his melee weapon. When the user right clicks in this plane, I want a projectile to be fired at the point where he clicked. I'm using a mesh to draw the plane and the D3DXIntersect function to determine if and where the user clicked in the plane. I am currently able to successfully tell if the user is clicking in the plane, but the "where" part does not seem to be working correctly. It seems to me as if my plane is divided diagonally in half - when I click on one half, the projectile goes to roughly the correct location. When I click on the other half, the projectile launches as if I clicked on the opposite corner (if I click in the lower left, the projectile fires to the upper right and vice versa, yet if I click in the lower right, it goes to the lower right, same for the upper left). I'm calculating the "where" using the barycentric coordinates returned by the D3DXIntersect call. Once I convert these to cartesian coordinates, I translate them using the world matrix for the object. My code follows: D3DXIntersect(pLocalMesh,&vNear,&vDir,&bHit,&dwIndex,&u,&v,&dist,NULL,NULL); //Convert the barycentric coordinates to world coordinates BYTE* pVertices = NULL; BYTE* pIndicies = NULL; HRESULT hr=pLocalMesh->LockVertexBuffer(D3DLOCK_READONLY, (LPVOID*)&pVertices); if (!FAILED(hr)) { HRESULT hrIndex = pLocalMesh->LockIndexBuffer(D3DLOCK_READONLY, (LPVOID*)&pIndicies); if(!FAILED(hrIndex)) { D3DXVECTOR3 vertices[3]; short faces[3]; faces[0] = ((short*)pIndicies)[(dwIndex * 3) + 0]; faces[1] = ((short*)pIndicies)[(dwIndex * 3) + 1]; faces[2] = ((short*)pIndicies)[(dwIndex * 3) + 2]; vertices[0] = D3DXVECTOR3(((D3DXVECTOR3*)pVertices)[faces[0]]); vertices[1] = D3DXVECTOR3(((D3DXVECTOR3*)pVertices)[faces[1]]); vertices[2] = D3DXVECTOR3(((D3DXVECTOR3*)pVertices)[faces[2]]); //V1 + U(V2 - V1) + V(V3 - V1). D3DXVECTOR3 temp = vertices[0] + u * (vertices[1] - vertices[0]) + v * (vertices[2] - vertices[0]); D3DXVec3TransformCoord(&temp,&temp,&m_MatWorld); pvPosition->x = temp.x; pvPosition->y = temp.y; pvPosition->z = temp.z; pLocalMesh->UnlockIndexBuffer(); } pLocalMesh->UnlockVertexBuffer(); } If anyone has any ideas why this might not be working, please let me know. I was initially unclear how the index buffer worked, and it's possible that I still am. But outside of that, I can't seem to figure out where my error might lie. Thanks!
  8. Inheritance Question

    Quote: please tell me if you get what i mean. i think you simply missing some fundamental c++ and the general OOP concept of polymorphism etc. I get what you mean. I understand exactly why it is happening and it makes perfect senese to me. I was just curios if there was a quick way to get around this. As it seems like there isn't, I've just created a NetworkCommandFactory object that, when taking in the raw data, calculates the type and builds the right type of command for the job. Thanks for the replies.
  9. I'm building a network protocol and I am using objects to contain the data that I'm sending and receiving over the socket. I have one parent type object, NetworkCommand, and several other objects that implement NetworkCommand, for example NetworkChatCommand. So, for the above two, NetworkChatCommand extends NetworkCommand, adding a string for the chat message. Furthermore, NetworkChatCommand overrides a virtual function from NetworkCommand, parseData(). This function is used to break up the raw data (when the client receives data, it places it in a NetworkCommand and then parseData is called to break it up into length, command type, and the other data). My Problem: When I receive data from the socket, I create a NetworkCommand and pass the data into it. I then can check the byte of the data which tells me what command type it is. Say the message is a Chat message. I want to type cast the NetworkCommand into a NetworkChatCommand and call the parseData function to break it up and extract the chat data. However, since I create the object as a type NetworkCommand, whenever I call the parseData() (even after type casting it), it is calling the function of NetworkCommand and not NetworkChatCommand. Is it possible to make something like this work? I could also have the parseData function in NetworkCommand figure out which command type it is and call the appropriate class's parseData function, but because they are child classes, I cannot call the functions. Also, I assume type casting the (this) pointer would have the same result as above (still calling the parseData function of NetworkCommand instead of the type-casted class). Any ideas on how to get around this? Or perhaps of a better approach in general? Thanks!
  10. Works For Me Too AMD64 3200+, Nvidia Geforce 4 4200
  11. MMORPG and the ol' UDP vs TCP

    Oops! Forgot to log in for the last post... So just FYI, the last post from Anonymous was from me (the original author of the question).
  12. I'm working on an MMORPG style game for a school project. It is a client-server model with a database as a backend. I'm wondering what protocols should be used for what. I know the UDP vs TCP argument is a common question and is discussed in the FAQ. I need to take it a little further than what is covered there. The game is ship based and will involve combat between ships. So, for ship movement and cannon ball movement, ie the twitch gaming portions of the game, I'm thinking UDP is the best way to go (as seems to be the common approach). So I'll use UDP and interpolation to handle that. As for the other elements of the game, I'm wondering if TCP is the best way to go, thus using both protocols. First of all, is it common that games will use both protocols, or do they often times pick one and settle on it. Is there a performance motivation to settling on one packet or using both. The other elements of the game: Users will dock at ports. The user then requests the port information from the server and displays it when its received. Port information is sent only on a request-basis and thus, a lost packet cannot merely be ignored in favor or a later update. Users will fire cannon balls in combat and will need to tell the server that such an event has occurred. Once cannon balls are fired, the cannons must be reloaded. Thus, if the user fired the cannons and the packet declaring this never made it to the server, the user's cannons would be unloaded and they would have to wait for them to reload again without ever reaping the benefits of the lost shot. There will be other similar events in the game. Is using both TCP and UDP for this game a good model to follow? Or would people suggest one over the other. Next, I have a few questions that are specific to the MMORPG genre. I'm not sure how to handle things like user inventory and statistics. Do you maintain a copy of the users inventory on the client side, only updating the server when the inventory changes? Or do you store the inventory on the server and fetch it any time the user requests to see their inventory? The quick answer that comes to mind for me is that it would be best to manage it on the user side and just update the server as necessary. This seems to achieve the least amount of server interaction and ensures that things happen in a timely manner on the client side. However, it seems more prone to hacking (Like the Diablo complex)... So how do games handle issues like that? I know validating any information that is given to the server is important, but are there any other tricks?
  13. Picking Question

    Thanks! Got it working.
  14. I am tryign to implement a picking method similar to the one detailed at He uses the ScreenToClient(...) function from the MFC libraries. This requries reference to your current window. Is there a way to get a reference to this on the fly? Say from a Direct3D device or otherwise? I tried calling GetCapture() as he does and I'm finding that it never returns anything, that is: if(GetCapture()) evaluates to false...
  15. DirectSound Question

    What I described above could still work for you, assuming that your using dirext sound. It's not restricted to a game space. I haven't worked in depth with the Direct Sound API so I couldn't tell you how to do it exactly, but if you look at some of the tutorials on 3d sound, I'm sure you could figure out how to place the sounds correctly. Then just follow the model I suggested. And in fact, this should work with any sound API that supports 3d sound. So as long as you are using a sound card that has front and rear channels, you should be fine.