• Content count

  • Joined

  • Last visited

Community Reputation

115 Neutral

About turbello

  • Rank
  1. Ok thanks, I can move on with my game.
  2. thanks! This helped me a lot. With all these information I was thinking the next: I make a queue m_MessageQueue; where I push_back all text I need to. I'll push_back only units that have been moved, upgraded, etc. Then after a whole gamecycle I check that variable. If I got something like this: [code]m_MessageQueue[0] = "0 10 50"; m_MessageQueue[1] = "5 30 150"; m_MessageQueue[....] = ".. .. .."; m_MessageQueue[30] = "4 20 300";[/code] All these really small texts I can put into 1 long string and send it all together. I'm not sending the size of the string before I send the string. I'm making a buffer of TCHAR's ( for unicode ) that will hold the whole text. Hm but wait, if I got 5 new orcs that I sended at the start to the client, and I move 1. How can I tell the client that [u]THAT orc [/u]has been moved? I think I need an alias yes? So I send 4 numbers to the client for each unit, 'type alias xpos ypos". ( example: "0 19 163 140" ). Am I thinking right for creating a network? B. Jonathan
  3. Thanks for the quick reply. I don't know how "fast" the transfer speed of a network is.. I just don't want any lag that's all. I'm using TCP because I need a safe connection. My data need to be received in a strict order. And because I don't want any lag at all I started with multithreading. I'm using the main thread for the whole game, 1 thread for just the network and 1 thread to do all the pathfinding. About the code, I don't really know how I should 'hold' all information. Should I hold all informations in a list, vector, deque, map, etc? And how should I send it, should I send all information in 1 long string? I want to play in a revealed map. So I need to see everything on the field including the enemy, where his buildings are, where his units are, etc. But if he got 100+ units and every unit has 3 variables ( type, Xpos, Ypos).. Should I send this all in 1 string? [code]string sendString = "orc1 10 50 orc2 170 40 mage1 340 30 academy1 120 50 etc etc etc";[/code] Should I write it like that? I never worked with a network before so I don't know if this is the way of doing.. B. Jonathan
  4. [quote]I would like to use XML to set the general informations( armour, defence, ... ) of all units and buildings. So suppose both players got that same XML file. [/quote] I meant that both players already will have the XML file before the game starts. I'm writing my game and XML on my laptop and when I want to test it I send all stuff to a friend of my ( that will play as client ). Suppose I got this kind of information of every unit: ( this is pseudo code ) [code]< unit; type = orc; damage = 17; armour = 50; health = 150; width = 40; height = 50; etc.. > // width and height is the size of that unit in the spritesheet.[/code] So if I send the position & type of my orc to the client he knows where my orc is on the field + he can look into the XML file to know what the size is of that unit ( for collision detection ). But is this a normal way of doing? I'm not worried about cheating because I'm not using this commercial. My friend knows what to do ( he only needs to open the .exe file and test it ) So I'm not sending any XML files.. I just send the position + type of my units. But I don't know how I can send and receive a lot of information on a fast way... Can I have some pseudo code of how I should write everything so let it work smoothly? I need so send a lot of information ( example= 30units and 5buildings ) Then I need to receive a lot of information too ( example = 20units and 6 buildings ) How can I do this? And how should I hold all information? (vector, list, etc)?
  5. Hi there, I've added networking to my game engine and I can make a host & client between 2 laptops via hamachi ( school told me to use a vpn because of the school servers that blocks almost everything ). So I can send data of both 'enemies' to each player ( x-position, y-position, width, height ) and then I can check for collision. But this is only for 1 little cube. What should I do if I need to send 20 different objects with their own information ( armour, defence, attack, width, height, position, etc ) to both players? I'm using winsock for my connection by the way. I would like to use XML to set the general informations( armour, defence, ... ) of all units and buildings. So suppose both players got that same XML file. Then I should just send the type ( which unit/building it is ) and the position right? Because I can receive all general information of that XML file. Is this a good/usual way to do this? In big games they work with databases but I haven't practiced with that yet. The disadvantage of using 2 XML files for host & client is that both players can change some values and 'cheat'. But this is only for school so I don't really care about making it totally safe for 'not cheating'. So the main questions are: How should I send all data? Should I use XML or not? Is there any disadvantage of using XML ( except it's not cheat safe )? Is there a better way ( except databases, I'm don't have a lot of experience with this ) B. Jonathan
  6. Bubblegum Engine error

    I can see you are deleting the object in the destructor of the MainEngine. And thereafter you delete the same object again at the end of the WinMain..
  7. Bubblegum Engine error

    If you use try - catch and exit when it fails, you don't need to return anything. You don't need to check if the initialization was succeeded because if it wasn't you would already have exited the application. If you want to keep that try - catch, don't return anything because the return is useless. If you want to use the HRESULT, here is an example of using it: [code]HRESULT hr; hr = RegisterClass( &wndClass ); // this should work return hr;[/code] The value that will be put into hr depends: [url="http://msdn.microsoft.com/en-us/library/cc704587%28v=prot.10%29.aspx"]HRESULT values[/url]
  8. Bubblegum Engine error

    Something is not going to work. Your Initialize() method is returning an integer. 'SUCCEEDED' don't check that. You can do this: [code]if( engine.Initialize() ) // this automatically gives a 0 == true { engine.ProgramLoop(); }[/code] Or you can do this: [code]HRESULT Initialize() { HRESULT hr; // Initialize the engine return hr; } [/code]
  9. Writing a game engine

    sendString is a: stringstream sendstring; And I fill it with this: "open \"Video1.avi\" type avivideo alias video1 parent (int)hWnd style 0x40000000" So I give the type,alias,parent and style of the video when I open the video. - Each times I do 'new Video(..) I increase a static number. My alias of the video I'm allocating at that moment is the path + that static number. So each time I create a new video I'll have as alias: video1, video2, video3, etc. - My type depends on the extension. If it's .avi = avivideo, if it's .mpeg = mpegvideo, etc - Wen I tried without that style "0x40000000" I always got a new window for the video, what I don't want. And my teacher said I could use that code so there won't be made a new window. With our without it, it don't solve that strange alias problem. I can't write it in 1 line. Video is a class and I need to be able to allocate a few videos. [code]Video* m_pVideo1; Video* m_pVideo2; m_pVideo1 = new Video( "path1.avi" ); m_pVideo2 = new Video( "path2.mpeg" );[/code] So I need to open, play, stop, repeat some videos that has a different path, alias. But it's very strange that my .avi don't want to accept a .avivideo type. I'll try to use as type: .avi, .mpeg without that 'video' at the end. B. Jonathan
  10. Writing a game engine

    I already told that I can do more then the provided engine we got from school. You are taking the words 'game engine' to big. The provided engine can not go fullscreen, can't mirror/scale images, can't play videos, don't have any math, don't have any multi-threading. I got all the things that engine got + fullscreen + scaling/mirroring + multi-threading. I'm now trying to implement videos in it. My Game Engine is very very basic. But it is more then the provided one which was even more basic. So it would be nice to help me with my previous question instead of telling me what I already heard many times in the past 2 weeks. Edit: don't worry about that level editor. If I do that I know i'll fail for my game. About that code for the video. [code] // Open the video if (end == _T(".avi")) { sendString << tstring(_T("open \"")) + path + "\" type avivideo alias " + m_Alias + _T(" parent "); sendString << (int)m_hWnd; // This won't add a new window sendString << _T(" style "); sendString << 0x40000000; } // Set the time format sendString.str(_T("")); sendString << tstring("set ") + m_Alias + " time format ms"; mciSendString(sendString.str().c_str(), 0, 0, 0); // Receive duration of video sendString.str(_T("")); sendString << tstring("status ") + m_Alias + " length"; mciSendString(sendString.str().c_str(), buffer, 100, 0); sendString.str(_T("")); sendString << buffer; sendString >> m_iDuration; // hold the duration // Showing the video tstringstream buf; buf << _T("put ") + m_Alias + _T(" window at "); buf << m_PosX; buf << _T(" "); buf << m_PosY; buf << _T(" "); buf << m_iWidth; // I didn't calculated the width because I don't know how, so Just entered a number .. Someone know how to get the width of the video? buf << _T(" "); buf << m_iHeight; // The same like the width m_CommandQueue.push( buf.str() ); // Play method void Video::Play() { if( m_bPlaying == false ) { m_bPlaying = true; m_bPaused = false; tstringstream buf; buf << _T("play ") + m_Alias + _T(" from "); buf << 0; buf << _T(" notify"); m_CommandQueue.push( buf.str() ); } else if( m_bPaused ) { m_bPaused = false; m_CommandQueue.push( _T("resume ") + m_Alias ); } } // Tick method void Video::Tick() { if( !m_CommandQueue.empty() ) { mciSendString( m_CommandQueue.front().c_str() , 0, 0, 0 ); m_CommandQueue.pop(); } if( m_bPaused == false && m_bPlaying == true ) { ++m_iCounter; if( m_iCounter*10 >= m_iDuration ) // When the video is done, replay? { m_bPlaying = false; if( m_bRepeat == true ) Play(); m_iCounter = 0; } } } [/code] EDIT:: Well this is odd. The extension of the video is (.avi) which I want to give an 'avivideo alias'. This is not working. BUT If I give to that same .avi video an mpegvideo alias it works !!! This is strange, really strange B Jonathan
  11. Writing a game engine

    Well I think I want to implement videos. I'll add math when my game is finished. Warcraft 2 don't need physics so I don't need math now. And so I've been trying to add videos to my engine but I miss something. I wrote all the code, I can load a video ( I only can't receive the resolution of the video, I don't know how to do that ), And when I try to play the video I can hear the sounds but no video.. The position of the video is x=0 y=0. This is the message I get: [img]http://i40.tinypic.com/25yvl3s.jpg[/img] When look how big the resolution was and changed those variables manual. Maybe that's the problem? How can I receive the width and the height of a video. Using mciSendString(...); I'm controlling my sounds and videos with mciSendString so I'm not using external library's. B. Jonathan
  12. Writing a game engine

    Well my engine can do a bit more now then the given engine. ( I'm not trying to show off now ) Except the given engine got buttons & textboxes but I don't want to have them. ( They are ugly ) I'm using images for 'Buttons'. If the image looks like a button and you can press it: it is a button. And I'm using threads for my networking to receive information of the 2 players without any lag. I did some changes to my Image class so I can copy the image. This will save me a lot of time. ( an other possibility is making a static Image ) My engine is almost finished for the stuff I want to do. A student said to me to implement xinput, xml, databases, matrices, videos, Direct2D, joystick, lvl editor, etc. I'm not going to do any of these because this would take a lot of time to implement all of this. But I might want to implement the possibility to play videos. Always nice to show the intro movie. Kyall, I'll put all code I don't need out the engine when I'm writing the game then. It's saves a lot of time when debugging yes.
  13. Writing a game engine

    I never heard of 'fair use' before. So as I can read of your posts I can 'lend/use' all sprites I can find on the internet for personal use but [u]not [/u]for commercial use. That seems fair for me. But that's only for games that don't have trademarks. When a game got trademarks you are not allowed to use it for commercial nor personal use. They can sue you if they know you are doing this. But yes.. there is a little chance they will do that for their reputation. I rewrote my whole engine by the way. I'm not using inheritance anymore. I know it's better to avoid many objects. But when I was writing my GameRender class that must draw everything that came up in my mind there were to many methods I could handle with only 1 object in the whole application. I got 4 classes that will help my GameEngine. ( GameWindow, GameLoader, GameInput, GameRender ). Then I got 3 more classes for the objects ( Images, Audio, CollisionMeshes ). [url="http://www.gamedev.net/blog/1360/entry-2253645-writing-a-game-engine-in-c/"]My Entry[/url] I think this is more looking like an engine. I got many inputs. And I got many rendering code. I just need a copy-constructor for my Images/Collisionmeshes. And thereafter I'm going to learn Pathfinding.
  14. Writing a game engine

    So strange our teacher lies to us on such an important thing Why would he say we can just pick some spritesheets of other games and use them Maybe they won't prosecute us but suppose they would. Then it's all the fault of our teacher that is lying to us. ( I always think the teacher spoke the truth but apparently not. Thank you both for telling me this )
  15. Writing a game engine

    You are right.. I should better listen to experienced people like you and accept the advice. And yes being stubborn is a bad attitude because I'm arguing with experienced people and thinking I'm right when I'm not.. I should better team up with other students so we can compare our code and learn from each other. You're right about everything, except that I'm doing this just to show off. It was not my intention to show off with the sentence "I worked 'that many' hours for that game'. I was trying to tell that I'm not a stupid programmer that can't even program. Maybe it doesn't sound much that I haven't done AI, pathfinding yet but 'm not trying to do everything at once. I send a mail last year to the person who made the game Kitten Cannon, no response. I send 3 mails already to blizzard if I can use their sprites, no response. There is a difference between copyright and trademarks. Kitten cannon don't have any trademarks but Blizzard definitely will have trademarks. That's why I need their permission that I can use those sprites. I read the article a couple of days ago and I understand writing my engine is useless. I might never use this engine again after this project. But, strange to say, I still want to write it. It would be cool to expand my engine as a hobby after this project. Last year I was programming 2 weeks in OpenGL and so I was using all those methods. And each time I wrote a method of that library I wondered how the code behind that would look like. And that's the little reason I want to write the Win32 code. The OpenGL library is better and more efficient with their code because those people already have years of experience. But I, a simple game programming, want to know how to write that code. Just because.. No idea.. I just want to do it. Have you ever had the feeling you needed to do something but you don't know why? Well that is the feeling I got now.