TalonSnow

Members
  • Content count

    126
  • Joined

  • Last visited

Community Reputation

128 Neutral

About TalonSnow

  • Rank
    Member
  1. Ah ok, that helps then. I can just set the shaders during the render then instead of having to worry about them when creating and filling the vbo and vao. Though I still wonder if the best way would be creating a list of a struct type for each sector containing the cubes and attached shaders and textures. I would assume this would allow for a lot of customization as I would be able to switch shaders per cube, instead of a batch. Just not sure if this is the common approach, or if it will degrade my performance as opposed to a more optimized method.   Interesting on the VAO's, I will check up on that, though even if I do go with a different approach I would probably get this working first to at least have a base design structure in place.
  2. Hello and thank you for reading and potentially helping with my problem.   I have been a hobbyist programmer for a long time, with spurts of activity. I have started up again recently and decided to get back to my main driving interest, which was game engine design. I am wanting to make a extremely small(just a 100x100 block) cave with a voxel engine, that will be used for a tower defense game vs simple AI.   Have spent last 2 weeks rereading about voxels and peoples implementations and experiences. Now that I have decided on how I want to approach it I have hit a snag, This is more with the engine design than anything else, and how rusty I have gotten with my programming.   I'm embarrassingly stuck on how, and where, to create the vertex buffer object. I was going with the approach in including it with the sector class(chunks) so that each sector had it's own vbo and vao. Yet the vao would require the shaders when setting it, so would each sector have an array of the shaders that it could use?   I am also unsure where to implement the textures for the blocks. I obviously am representing the texture for each block as a byte with an enum for the type. Yet, should I have the sector(chunk) class have its own render function so each sector can render itself when called or do all the rendering from the main program and just retrieving the vbo and vao from the sector class?   In relation to this, how and where do I set the texture when rendering? Would you create a LIST containing each block in the Sector that holds its texture, shaders, vbo and vao when the sector is loaded?   Again thanks for any help in this regards. 
  3. I am creating a browser based game in php and using mysql, and have some questions on database design. I really have not done too much with databases, and know the golden rules in making them. However, I am wondering just how far would you go for a game, that would be prioritized in everything for expandability, in creating separate tables for every little difference in data relations with each other. Anyone got any good links for database design for games?
  4. loading GIF's

    I am using c++ and DirectX8 As of now the only graphics file i am loading in is bitmaps using the Windows API LoadImage function. However, I want to add animation to my game by including animated GIF's. I have searched on here and on google, yet cant come up with a solution yet for my case. Anyone know of some code, examples, or a link to help me out? Or is my best bet just to load in all the images in a bitmap format, then create the animation sequence in the code itself?
  5. Unreliable UDP packets

    thank you all for your help, indeed reducing my traffic and rewritting much of my code that sent data, where i took out 99% of it, as it wasnt needed to be sent every frame, has a super fast response time now, with no visible lag whatsoever. Thanks! Michael Hughes
  6. Unreliable UDP packets

    200 instances of a structure. this held unsigned short health; unsigned short team; PlayerID playerid char name[20]; I am making a linked list to hold the data, and records taken away or addedd for each sector when it needs to. Then as i suggested and you confirmed, i will just loop through the list and send everyone once to the 1 person who needs it all, and to the rest just the new or leaving player.
  7. Unreliable UDP packets

    ok it seems much better now to my testers, though the one in UK and the farthest hasnt been on yet to test. The update code doesnt send the info at all now. It just sends the current time of the server, as well as a list of players in the players sector. I eleminated the rest by thinking during the game the player only needs to be updated on a few things so far, and put individual sends in the functions where these values accually change then update the client. Now one of my questions is on the player list that shows all the players sharing the same sector as the player. Right now i have it set to 200 instances. I am not using vectors, is there any way to send only the players that share it, besides sending an individual send on each player, without allocating a max value? As is my understanding even if there is only 1 player sharing the same space, they server will still send a packet the size of all 200 right since thats what the variable is able to hold? And if there isn't a practicle way to send only the ones i want in one send, is it bad to send one send per player? Note this will only take place in movement, where it will update all players on an additional player, or a player moving out. Anothe rapproach i can think of would be to only send the player who is moving in or out to all the other players reducing much of the material sending, however, the player itself would still need to get a full updated list. So any suggestions or tips? :)
  8. Unreliable UDP packets

    ok thanks for the information, im still slow on data types and sizes. I will work on slimming it down alot and see how it goes.
  9. Unreliable UDP packets

    ok it is alot better now, but still not very applicable. What i did. Taking it off my Hub and plugging the ethernet into the computer directly helped alot. Then messing with the sleep timer. It seems if the timer isnt set to a certain point my FPS slowely starts dropping over time. Which would give the overflowing of the buffer idea prob. a good basis. also I am using unreliable_sequenced. As i dont care if they all arrive, but just that a slow packet wont be slipped in. setMTU size is what determines the size of which the buffer can hold. This i changed already from the default of around 580 to 1400. This helped some for certain but still having the problems described. So here is the structure I am sending across so much. struct playerType { char* name; char* password; int health; int moves; int rank; int score; int sector; int attack; int defense; int stealth; int endurance; int pistol; int rifle; int heavyWep; int explosives; int sabotage; int medic; int engineer; int drive; int fly; int navigation; int team; structInventory weapon; structInventory armor; structInventory inventory[20]; }; struct structAmmo //this is just to descibe the loaded ammo inside an object { int type; //what type of ammo is it loaded in the object? int amount; //amount of ammo left int damage; //damage modification (note this can also be negative) float armorPenetration; //modifyier on armor penetration on other objects float chanceToUse; //chances of using this object on another object (i.e. to hit with a weapon) int misc; //placeholder for anything extra unique in this object }; struct structInventory { int type; //what is it? structAmmo ammo; //used to store inside another object (i.e. loaded in a gun) int damage; //dmaage modification (note this can also be negative) float weight; //weight of object, for use with inventory and total weight able to be carried float armorPenetration; //modifyier on armor penetration on other objects float armorRating; //rating of armor this object has float armorStatus; //amount of armor that is left int movesToUse; //amount of moves it takes to use this object int ammoToUse; //ammount of ammo it takes to use this object float chanceToUse; //chances of using this object on another object (i.e. to hit with a weapon) int misc; //placeholder for anything extra unique in this object float minAccuracy; //beginning accuracy float maxAccuracy; //highest accuracy can get with this object float accuracyOffset; //time accuracy increases with time float baseTime; //how much time for this object to be used again int timeSec; int timeMin; int timeHour; }; Now it is working fine on my computer (not sure if it is really ok, or just because its local) Yet, on a testers who lives in the UK the updates are not being received unless reliable. And even then slow. Would using a stream produce better results on updating then always sending packets? I am trying to figure out why it is so slow, to others. I know internet lag can ccount for some of this. Yet, realistically shouldnt they be receiving without a problem as i woudl assume most games send alot more info accross then I am? Please correct me if im wrong :) (*and i know I can clean up the code being sent as its not ALL necessary for the client, as in the client wont need to know damage, though it will need to know accuracy, and soem things can be taken out. But, even jsut for testing im not sending too much am i? *) [Edited by - TalonSnow on June 21, 2005 9:03:18 PM]
  10. Unreliable UDP packets

    im using Raknet. The default MTu size i have set to 1400 so that shouldnt be a problem. One thing i have noticed when testing around with diff things, is if i disconnect from my hub and plus the internet from the router straight into my computer i get alot more packets received.
  11. O.K. im confused. I am having no luck in using unreliable packets. I have a player update code that sends out a packet every frame. With a Sleep(0); in it it is sending out a an enormous amount in a second, yet i receive on epacket on the client (which is on the same machine) in about 15-40 seconds. If i use reliable it works fine, and updates right on schedual. yet when more and more users join, if I always use reliable for my player updates it will obviously lag very fast. Can anyone think of anything that would prevent that many unreliable packets sent to not arrive? Heres is the facts from the logfiles Server sent 1,092 unreliable update packets within a period of 40 seconds Client received 5 out of them. :(
  12. thanks ignima that was certainly the problem!
  13. Ok so i went to load in a bigger map to test out my movement code and map loader. However it has one problem, and thats allocating enough memory to read it the data. It was dynamically allocating what it needed once it found out how many objects were going to be stored. Once I made this into a number quite larger it worked fine. originally it would pull in a size of 20 (which logfile shows the results of) when i set it to 40 as shown in code also if pull sit all in fine. What am i missing here that is reducing the size of what i need? //globals struct mapHexTravel { int destHexX; int destHexY; int movePoints; }; struct mapHex { int hexX; int hexY; int terrainType; struct mapHexTravel hexTravel[20]; }; // regular globals int mapWidth; // used to store the width of the loaded map // here is the function that loads it void map::loadMap(char* mapname) { int numberPaths; int mapHeight; int mapSize; int hexTerrainType; int hexX; int hexY; ifstream inFile(mapname); if (inFile.fail()) { WriteError("Failed to open file to load in map data"); } inFile >> mapHeight >> mapWidth >> ws; mapSize = mapHeight * mapWidth; writeError(mapHeight); writeError(mapWidth); WriteError(mapSize); //mapHex* tempMapHex; //tempMapHex = new mapHex[mapSize]; mapHex tempMapHex[40]; for(int x=0;x<mapSize;x++) { inFile >> hexX >> hexY >> hexTerrainType; inFile >> numberPaths; writeError(hexX); writeError(hexY); writeError(hexTerrainType); writeError(numberPaths); if(numberPaths == 0) inFile >> ws; else { for(int m=0;m<numberPaths;m++) { inFile >> tempMapHex[( hexY * mapWidth ) + x].hexTravel[m].destHexX >> tempMapHex[( hexY * mapWidth ) + x].hexTravel[m].destHexY >> tempMapHex[( hexY * mapWidth ) + x].hexTravel[m].movePoints; writeError(tempMapHex[( hexY * mapWidth ) + x].hexTravel[m].destHexX); writeError(tempMapHex[( hexY * mapWidth ) + x].hexTravel[m].destHexY); writeError(tempMapHex[( hexY * mapWidth ) + x].hexTravel[m].movePoints); } inFile >> ws; WriteError(" "); } tempMapHex[( hexY * mapWidth ) + x].hexX = hexX; tempMapHex[( hexY * mapWidth ) + x].hexY = hexY; tempMapHex[( hexY * mapWidth ) + x].terrainType = hexTerrainType; } inFile.close(); mapArray = tempMapHex; } map mainMap; here it the file reading in 5 4 0 0 1 2 1 0 4 0 1 4 1 0 1 4 0 0 4 2 0 4 0 1 4 1 1 4 2 0 2 4 1 0 4 3 0 4 1 1 4 2 1 4 3 0 1 3 2 0 4 2 1 4 3 1 4 0 1 1 5 0 0 4 1 0 4 1 1 4 0 2 4 1 2 4 1 1 1 6 1 0 4 2 0 4 0 1 4 2 1 4 1 2 4 2 2 4 2 1 2 6 2 0 4 3 0 4 1 1 4 2 2 4 3 2 4 3 1 4 3 1 1 3 3 0 4 2 1 4 3 2 4 0 2 1 3 0 1 4 1 2 4 0 3 4 1 2 1 6 0 1 4 1 1 4 2 2 4 1 3 4 0 3 4 0 2 4 2 2 2 6 1 1 4 2 1 4 3 2 4 2 3 4 1 3 4 1 2 4 3 2 1 5 2 1 4 3 1 4 3 3 4 2 3 4 2 2 4 0 3 1 5 0 2 4 1 2 4 1 3 4 1 4 4 0 4 4 1 3 1 6 1 2 4 2 2 4 2 3 4 2 4 4 1 4 4 0 3 4 2 3 2 6 2 2 4 3 2 4 3 3 4 3 4 4 2 4 4 1 3 4 3 3 1 3 3 2 4 3 4 4 2 3 4 0 4 1 2 0 3 4 1 4 4 1 4 1 4 0 4 4 0 3 4 1 3 4 2 4 4 2 4 2 4 1 4 4 1 3 4 2 3 4 3 4 4 3 4 1 3 2 4 4 2 3 4 3 3 4 and here is the logfile when i leave it to determine the size and sets it at 20 5 4 20 0 0 1 2 1 0 4 0 1 4 1 0 1 4 0 0 4 2 0 4 0 1 4 1 1 4 2 0 2 4 1 0 4 3 0 4 1 1 4 2 1 4 3 0 1 3 2 0 4 2 1 4 3 1 4 0 1 1 5 0 0 4 1 0 4 1 1 4 0 2 4 1 2 4 1 1 1 6 1 0 4 2 0 4 0 1 4 2 1 4 1 2 4 2 2 4 2 1 2 6 2 0 4 3 0 4 1 1 4 2 2 4 3 2 4 3 1 4 3 1 1 3 3 0 4 2 1 4 3 2 4 0 2 1 3 0 1 4 1 2 4 0 3 4 1 2 1 6 0 1 4 1 1 4 2 2 4 1 3 4 0 3 4 0 2 4 2 2 2 6 1 1 4 2 1 4 3 2 4 2 3 4 1 3 4 1 2 4 3 2 1 5 2 1 4 3 1 4 3 3 4 2 3 4 2 2 4 0 3 1 5 [Edited by - TalonSnow on June 16, 2005 8:48:45 AM]
  14. Help on a hexagon map[SOLVED]

    just in case someone looks this up in the future, I am correcting a part of the code that was not correct. *also just to note, the pathing system is in place and characters are now walking around perfectly ;) Thanks for everyone who helped! for(int m=0;m<numberPaths;m++) { inFile >> tempMapHex[( hexY * mapWidth ) + hexX].hexTravel[m].destHexX >> tempMapHex[( hexY * mapWidth ) + hexX].hexTravel[m].destHexY >> tempMapHex[( hexY * mapWidth ) + hexX].hexTravel[m].movePoints; } inFile >> ws; Before i wasn't properly inserting the values where they should be, this is now corrected [Edited by - TalonSnow on June 16, 2005 8:53:29 AM]
  15. Help on a hexagon map[SOLVED]

    ok i got the path(ing) to work. Bascially I just added a set array of path structs(for now) with the main map hex stuct. Then when I read in each hex from the file, it now pulls in how many paths that hex has, then records each one. I havent been able to physically try it out yet, but I do know all data has been retrieved from the file including the paths for each hex. Now that I have it, i guess the last thing to do is see if i can get the player moving around :) heres the code so far: //globals struct mapHexTravel { int destHexX; int destHexY; int movePoints; }; struct mapHex { int hexX; int hexY; int terrainType; mapHexTravel hexTravel[20]; }; //class in engine for loading map data class map { private: mapHex* mapArray; public: void loadMap(char* mapname); }; void map::loadMap(char* mapname) { int numberPaths; int mapHeight; int mapWidth; int mapSize; int hexTerrainType; int hexX; int hexY; char* lineContentP; ifstream inFile(mapname); if (inFile.fail()) { WriteError("Failed to open file to load in map data"); } inFile >> mapHeight >> mapWidth >> ws; mapSize = mapHeight * mapWidth; mapHex* tempMapHex; tempMapHex = new mapHex[mapSize]; for(int x=0;x<mapSize;x++) { inFile >> hexX >> hexY >> hexTerrainType; inFile >> numberPaths; if(numberPaths == 0) inFile >> ws; else { for(int m=0;m<numberPaths;m++) { inFile >> tempMapHex[m].hexTravel->destHexX >> tempMapHex[m].hexTravel->destHexY >> tempMapHex[m].hexTravel->movePoints; } inFile >> ws; } tempMapHex[( hexY * mapWidth ) + x].hexX = hexX; tempMapHex[( hexY * mapWidth ) + x].hexY = hexY; tempMapHex[( hexY * mapWidth ) + x].terrainType = hexTerrainType; } inFile.close(); mapArray = tempMapHex; } map mainMap; // sample contents of a mapfile (this only has 4 hex's from left to right 1 4 0 0 1 1 1 0 4 1 0 1 2 0 0 4 2 0 4 2 0 2 2 1 0 4 3 0 4 3 0 1 1 2 0 5