• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

171 Neutral

About Knight52

  • Rank
  1. https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRMWXOg2UVZAWt2o_JkN4mCMY6j2CyszDm8Qhp1cEP4Hvue2G3n">https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRMWXOg2UVZAWt2o_JkN4mCMY6j2CyszDm8Qhp1cEP4Hvue2G3n The trail of the wisp. What is it called, and how do I implement it with DirectX 9?
  2. Right now I load all model with their hierarchies kept. But it begins to have a performance issue, and I wondering if not keeping the hierarchy will give any obvious performance boost.   also, is there any way to find out if the .X file contains animation or not, before calling D3DXLoadMeshHierarchyFromX?
  3. using a line to pick objects

    Just to be sure, is trapezoid considered a plane? And D3DXPlaneFromPoints which create plane from 3 vectors can be used to create trapezoid?
  4. I have a line on 2d screen. I want to know which 3d objects the line is on. It's a straight line. Anyone knows how to do it?   I'm trying to create a plane out of it and use it to detect the collision. I have calculated 4 points for the plane's corner, but I don't know what should I do next.
  5. [quote name='Kaptein' timestamp='1348215126' post='4982277'] check if the directx functions you are using are thread-safe without any code, it's hard to help you as you should know, in threading, all threads can access the same (shared) memory without mutex locks, you can't be certain that the same memory isnt accessed or overwritten by threads at the same time one bad example is: if you allocate memory at the same time on both threads, both pointers could end up with the same value! (memory offset) threads don't necessarily start in the order you started them in they don't execute at the same speed just google threads! theres LOTS you need to know about them before you can start using them in a game!! start using threads in a small test project and find out what you can and can't do![/quote] [quote name='rip-off' timestamp='1348215916' post='4982281'] [quote] I know how bad it is to go multi-threading, but I don't know how else I will load stuff behind the loading screen. [/quote] Have you tried non-blocking or asynchronous I/O? [/quote] I've created a mutex lock, still doesn't fix the leaks. I've tried WM_TIMER which I understand it's one of asyn io processes, doesn't fix the leak either. So I don't think it's multi-threading resource issue. Here's the some sort of algorithm. Hope this will help. [code] Retrieve info if player is initialized. { separate the player and equipments from resource pool. } Flush the resource pool. This includes Skybox primitives and texture, object's model and animation, terrain, and lights' shadow maps. Open the file if(file == null) { Messagebox ("cannot open file") exit } Load new resources by reading info from the file. if player is initialized { add the player and equipments back to resource pool } else { initialize player and add it to the resource pool } delete file. hide loading screen. release mutex close mutex [/code]
  6. I know how bad it is to go multi-threading, but I don't know how else I will load stuff behind the loading screen. No memory leaks when I do single thread, but when I create another thread to handle that same function, I got memory leaks. That function handles some Direct3D loading too. Do I have to release something before exiting the thread?
  7. [quote name='kunos' timestamp='1346333229' post='4974799'] do you also swap the depth buffer with one with the same size as the shadowmap? [/quote] so that's the problem. Should I create another texture for this swapping?
  8. I swap default render target to shadow map's surface before rendering the map, then swap back when finished, if that's what you mean. you ask why does screen have 4:3 ratio? Isn't it still standard resolution ratio nowaday? I mean I will, at least, try to make this game go public, so shouldn't it at least have 4:3 ratio?
  9. [quote name='Hodgman' timestamp='1346324343' post='4974745'] Can you expand on this - something with the effect framework generates an error? [/quote] [code] HRESULT result = effect->ValidateTechnique(ShadowTechnique); if(FAILED(result)) {// will generate error -2005530591 D3DERR_CONFLICTINGRENDERSTATE MessageBox(cq->handler(), "Failed validating Shadow Mapping technique", "ERROR", MB_OK); } [/code]
  10. say the shadow map is 1024x1024 pixel. If the display window is larger than that (1280x1024), it's fine. If it isn't (800x600), it'll fail the technique validation. Did I miss something?
  11. Is there any way better than flush the instance buffer, per-instance data, and recreate them? I haven't tried this brute force approach yet, so I don't know how much fps it'll reduce.
  12. [quote name='turch' timestamp='1344865552' post='4969059'] If you mean that you have one draw call for each quad, then you can expect a huge performance boost from switching to one or a few draw calls for the terrain. [/quote] You mean DrawIndexedPrimitive() or DrawPrimitive(), right? Is there any way I can still draw additional texture specific to each quad? If the performance boost is that good, I'll consider removing that feature anyway. [quote name='turch' timestamp='1344865552' post='4969059'] If it is in a tight loop, definitely cache it. [/quote] Can you describe what is caching you're talking about?
  13. 1. Terrain. Right now I'm using multiple quad primitives connected to each other. This way I can divide terrain into blocks and each block can have additional texture specific for that block. But I see in some tutorial that they use one indexed primitives to create terrain. How much performance boost should I expect if I choose to change from multiple quad primitives to single primitive? 2. .X model importer. I have the code from [url="http://www.toymaker.info/Games/html/load_x_hierarchy.html"]this example[/url] and modify a bit. It might not be the best, but it does the job. Recently I notice significant fps drop when many models is on the screen (I'm using View Frustum Cull) and I begin to think I need some change. Is there .X model importer I should use instead? 3. Updating the game state. If I choose to create a thread to specifically handle the "main loop update", will that increase some fps? Is there any problem I should expect? 4. Should I call sin/cos/tan/etc function once and store the result instead of calling those functions every time I need to use the result?
  14. Ah never mind. I've fixed that. It had something to do with "ItemSlot slot = *itemslot[i][j];" or passing 2 or 3 levels pointer. Sorry.
  15. This is a part of the code of character's inventory system. This part will swap two inventory slots (itemslot[i][j] and highlight). They will swap array of item pointer, number of item in that slot(stack), default slot background and current slot background. It's fine when they swap for the first time, but when trying to swap back, that error occured, right after break; command. I've googled a bit and found out this error has something to do with segment fault or memory leaks, but I have no idea which part of the code that cause this. Can anyone point out? None of these function leads to delete or delete[], btw; [CODE] for(int i = 0; i< 5; i++) for(int j = 0; j< 5; j++) { if(itemslot[i][j]->button->Intersects(base)) { ItemSlot slot = *itemslot[i][j]; itemslot[i][j]->stack = highlight->stack; itemslot[i][j]->item = highlight->item; stringstream s, s2; s << itemslot[i][j]->stack; itemslot[i][j]->button->SetText(s.str()); itemslot[i][j]->buttondefaultimage = highlight->buttondefaultimage; highlight->stack = slot.stack; highlight->item = slot.item; s2 << slot.stack; highlight->button->SetText((slot.stack > 0)? s2.str() : ""); highlight->buttondefaultimage = slot.buttondefaultimage; for(int k = 0; k< 3; k++) { Image *img = itemslot[i][j]->button->GetImage(k); itemslot[i][j]->button->SetImage(k, highlight->button->GetImage(k)); highlight->button->SetImage(k, img); } highlight = null; break; } } [/CODE]
  • Advertisement