Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

330 Neutral

About greenpig83

  • Rank
  1. Hi, I have a common problem like this!   In my game each user have an avatar. It's a small image about 128x128 size.  (I use D3DSprite  to draw the avatar on screen) I have hundred of them for user to select, or they can upload their own. I think most system have this like forum... There are alot of them that load them all at start of game is not nice! So I want to load them only when that avatar appear on screen. And keep about 100 avatar at a time! When a avatar is loaded it will have a loading image instead! The avatar will be free if it is not used ...   If we use each texture for an avatar, it's simple. I'm not tested yet, but i think display many texture at a time will slow down the performance (if we in a lobby screen or ranking screen, there will be ~ 20-50 players on screen). I prefer to load all the small image into 1 big one, that will speed up a lot! Because D3DSprite draw well with less texture!   But as we know, when we change a texture, we need to lock it, and i'm not sure we can still draw it while it's locking. Furthermore, I read at   http://social.msdn.microsoft.com/Forums/en-US/07e44457-75c2-432e-9a8c-d6e550003eba/background-texture-loading?forum=gametechnologiesdirectx101   they adviced not to use thread for loading texture. So that will be problem. I dont want the game to stop just to load all the user avatar. What will you do in this situation ? THanks
  2. greenpig83

    Creating dynamic? textures.

    Using D3DPOOL_MANAGED is nice because when you reset your graphic  (fullscreen ->windows, change resolution...) you dont have to worry about the Texture. Otherwise you will have to relase and recreate all the texture you loaded!
  3. greenpig83

    How did you learn C++?

    Yeah, never learn the lang alone. But learn it to do something! But as a pro programmer. I still think that searching skill is the most necessary thing. Sometime u dont need to know the lang to do the job. Just know what you want to do, and most the time, someone on the net did it already, or some part of it. Search it, download, build it, then tweak to see what it do (Instead of read the code, understand every line, then write your own! ). Because the code already running, so change something to see how it work is very easy to understand . That's the fastest way for me. Although if you write it your own u can understand it better, unless you are a student and have a lot of time to spend!
  4. greenpig83

    How did you learn C++?

    C++ is not that hard in dos time. When I learn pascal and then move to C++, it's not that different. Because in Pascal u still can use OOP... But things get so headache when windows release! To write a hello world app (with form) , it need 100-200 code line...No internet, only thick book, that really scare me. Sometime I just type 1-> 2 page of code then run to see what it really does.    Now it's a lot more easy, we have tons of sample, tutorial on net, that no need to type anything at all, just build and see what happen ! 
  5. greenpig83

    What can you use C# for?

    I use c# for tool. Its fast for windows app like mfc and visual basic. Very easy to code! So easy that i dont need a book to learn, its too similar to vb and java.
  6. Wow, never think of that. I just think inside the box that it must be integer! I'll try and see if it's right ! Spend hours to figure a very simple thing   Yeah. that it ! Using C# it's more simple !   byte []t={0,0,32,65}; float myFloat = System.BitConverter.ToSingle(t, 0); //-> return 10   Because the game only let me input integer value, so I think that it's integer !
  7. I'm trying to read an unknown type file (a save game file, I change the value and then see the file in Hex editor) ! And i want to read the integer values. I know where it is ! but the hex value is quite strange! I use Decimal here for easy understanding!   (byte-byte -> integer )            //128,63 -> 1           128 =  10000000   63=00111111             //0, 64 -> 2(10)            00000000-0100000064=    01000000             //64-64 -> 3(11)            01000000-01000000             //128-64 -> 4(100)          10000000-01000000             //160-64 -> 5(101)      160=10100000-01000000             //192-64 -> 6(110)      192=11000000-01000000             //224-64 -> 7(111)          11100000-01000000             //0-65 -> 8 (1000)          00000000-01000001             //16-65 -> 9(1001)          00010000-01000001                //32-65 ->10(1010)          00100000-01000001             //48-65 ->11(1011)          00110000-01000001                //64-65 ->12(1100)          01000000-01000001             //80-65 ->13(1101)          01010000-01000001             //96-65 ->14(1110)          01100000-01000001                //112-65 ->15(1111)         01110000-01000001             //128-65 ->16(10000)        10000000-01000001               //136-65 ->17(10001)        10001000-01000001                //144-65 ->18(10010)        10010000-01000001             //152-65 ->19(10011)        10011000-01000001               //160-65 ->20(10100)        10100000-01000001                //168-65 ->21(10101)        10101000-01000001             //176-65 ->22(10110)        10110000-01000001               //32-66 ->40(101000)        00100000-01000010               //48,64,80               //160-66 ->80(1010000)      10100000-01000010                //162-66 ->81(1010001)      10100010-01000010             //164-66 ->82(1010010)      10100100-01000010     (bigger values, int,int,int -> byte-byte ) //80,81,82  -> 160-66,162-66,164-66             //180,181,182 -> : 52-67,53-67,54-67             //20,21,22 -> 160 ,168 , 176 -65             //30,40,50 ->  240-65,248-65, 0-66  (3 integer -> 3 (2bytes))   //128-191 -> -1             10000000-10111111             //0-192 -> -2               00000000-11000000             //64-192 -> -3              01000000-11000000   The values is like above. It use 4 byte (but only 2 byte have values) . It seems that the left-most bit of 2nd byte are for Signed! There is some rule , but i find it hard to figure out ! Thanks !  
  8. greenpig83

    2D isometric height map

    Age of empire 2 have no abrupt incline. I study them alot. Unless you use 3d terrain, u will need alot of tiles. I advice use 3d terrain with isometric view (ortho), its not hard, and simplify many things!
  9. Just did a little test with a simple solution. Not rotate the sprite, but move the pixel up! It will need a bit stretch but because the angle is small so it still look OK.  I will optimize it later. When it run in an animation, it will look better !  
  10. Of course it cant be perfect because we doing reverse here. Just as nice as possible.  Let see this image : he's runing South_East (Down-Right) ! His spear heading Down-Right. I want to rotate he heading East. It will be about 30 degree! So first we will need to rotate he up, center at his body for example, so that his spear will looking East! And it will need at least 2 rotation, and some interpolation because of hidden pixels! But as I said, the purpose is looking as good as possible not to recreate the 3d Model!   SO I dont want to spend time testing this. I hope someone did this before, so I can use his solution. 
  11. Of course I'm using mostly 5 frames and mirroring for my units. Because it saves quite alot (texture memory) and my units are quite small so it does look quite OK. I dont have the 3d mesh so I cant create the dir I want, and I cant afford real artist for my hobby project! The sprites for my project are mostly found on net, I'm not good enough to draw just 1 I found some very great sprites for my project, but it lacks East,West dir, and to see the cool units running with wrong heading like that, it make me sad   In theory, I think we can do this, because of isometric view, with some matrix for rotating ! Because the rotate angle (30-45 degree) is small and everything is fixed!
  12. Hi I'm working with an isometric project. That require me, each unit animation need 8 direction (5 for flipping : E flip to W, NE flip to WE, SE flip to SW!).  I've found many resource on net that are isometric, but not all 8 direction, some 6 direction (hexa tile game), some only 4...!  So I think that because its isometric view, we can base on 1 direction and rotate to its closest direction (about 30 degree rotate)!  Of course it will not look nice (because we reverse engine it), but better than unit move to West, but his heads and legs heading NW.    Here is an example of the dragon from MM8!  This frame it's heading SE (south-East).    And this one is what I want to achive, heading E (East)   Normally we lack the East,West direction because in isometric world! But just 1 is enough, because East can be flipped into West! North cant flipped to South... Thanks! I think I can write my own this but it will take time and need time to make it look nice, so if there are already a solution I dont want to reinvent the wheel!
  13. greenpig83

    Why C++?

    I think there arent many choice there! If we count there are only java,C++,C#,Python, Delphi... Java is only good for their embedded type, run well on many platform. But i think they are not fast as C++ and they are not very direct (in means of directX...). I worked alot with java, for server and j2me!   I'm not a master of C#, code couple of samples... They are very good for tool, windows app... that need good UI. The code is a lot easy and clear than C++ but they still work behind something (virtual machine???) like java. But I think it's very close compare to C++.   But even other lang is good for game, C++ is still superior because of the documents/samples/tutorials on the net, most of them are on C++ ! But using engines like Unity can save us a lot of time learning langs, they can export into many platforms (web,ios,pc...). Just learn the script is sometime enough (not all the time)!
  14. greenpig83

    Texture file theory question

    D3DXCreateTextureFromFile Create a new texture from a file on disk for u. And load it into your GPU! After created u can use it freely! until u release it! It seems that u want to use it for your 2d project! with d3dxSprite. It's adviced to use texture atlas, group many sprite into 1 texture for performance!
  15. For 2D game you should use  D3DXMatrixOrthoLH(&matOrtho,640, 480, -1000, 1000); You dont have to worry about camera or things... Any thing u draw will be exactly its size !   because it's more simple. 
  • 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!