• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
rukiruki

Direct3D Not working outside project?

13 posts in this topic

Hi. Using DirectX9.... We have a 2D game called 9th Dawn which used DirectxSprite for rendering. We recently switched it to Direct3D rendering using D3DPT_TRIANGLELIST. This works fine when running directly from Visual Studio~ however when I take the generated .exe and try running it, I get triangle artifacts instead of textures. I have tried the .exe in an isolated folder with the exact same .dlls and data (includes textures) as the visual studio build, and also tried running the .exe in the exact same folder as Visual Studio project so it uses the same data.

 

Title screen comparrison:

https://dl.dropbox.com/u/15579799/dxscreens/title1.png

https://dl.dropbox.com/u/15579799/dxscreens/title2.png

 

In game comparrison:

https://dl.dropbox.com/u/15579799/dxscreens/game1.png

https://dl.dropbox.com/u/15579799/dxscreens/game2.png

 

I have no idea what's going on. I tried the release build on another computer and I got the triangle artifacts. I sent it to a friend in USA and he actually saw the correct textures.

It looks like the textures are definitely getting loaded because their colours seem correctish, it just seems to be only using the first pixel in the texture. I load textures from a DAT file buffer using D3DXCreateTextureFromFileInMemoryEx(...). I have a radeon 7950 graphics card

 

Could it be I need to set a render state?

Edited by rukiruki
0

Share this post


Link to post
Share on other sites

This could happen for a lot of reasons. Are you able to see it work in release when deployed from VS?

0

Share this post


Link to post
Share on other sites

This could happen for a lot of reasons. Are you able to see it work in release when deployed from VS?

Hi Seabolt thanks for your reply. I'm only building in Release mode, which works fine if ran from VS, but the .exe it generates to the Release folder has the problem. Is that what you meant?

0

Share this post


Link to post
Share on other sites

Ah alright. Have you tried running the exe generated in the Release folder of your solution? Does that work? Also are you error checking your asset loads?

0

Share this post


Link to post
Share on other sites

Hi Seabolt, yes I have tried running the .exe in the Release folder (no assets get loaded, no fonts or textures). I have tried running it in an isolated folder with identical assets, and the main project folder which uses the exact same assets as the VS-ran build. I get the same behaviour all the time, the .exe never renders textures properly.

 

I do error check my texture loads, they are being found in the DAT buffer and loaded fine. I don't understand how it can be any different than running it in VS :/

0

Share this post


Link to post
Share on other sites

Are you using absolute paths to your assets? Try taking the exe and moving it into various folders and seeing if it will work at all.

0

Share this post


Link to post
Share on other sites

I'm using relative paths to the DAT folder, ie. "data\\datfile", the .exe does find it and load from that file correctly (along with sound effects which work). I've tried it in all possible folders

 

thanks

0

Share this post


Link to post
Share on other sites

Have you tried using PIX to check what is going on in your scene rendering?  It would seem that the textures aren't properly loaded for some reason - what are you using to load the textures?  Are you sure that all of the runtime dependencies are installed on the machine that you are testing on?

 

When you take a frame grab in PIX, examine the textures that are being bound and make sure they are loaded properly - I would bet that this is the source of the issue.

1

Share this post


Link to post
Share on other sites

Hi Jason, thanks for you reply. I'm loading textures from a DAT file, using my own error checking I can see that the DAT file IS found and textures are loaded from it. This is the function:
https://dl.dropbox.com/u/15579799/dxscreens/loadtext.JPG

 

I have new information on this issue. I loaded up my newest engine which has some simple d3d render calls, again in 2D. It works from the IDE in debug mode, but NOT in release mode. The generated .exe from the debug mode WORKS, but the generated .exe from the release mode doesn't work. After some googling I found out it was the /MDd to /MD flag in Project Properties->c++->code generation, as outlined in this post:

http://stackoverflow.com/questions/10526566/directx-release-build-works-through-vs2010-but-not-exe

 

On further reading it may be due to some directx things not being initialised in Release mode, where they are automatically initialised in debug mode, but I have no idea what that could be, even after cross referencing with a few directx tutorials~ I can't see anything I may have missed.


Here are some pics of the current issue regarding debug and release mode:
https://dl.dropbox.com/u/15579799/dxscreens/c1.jpg
https://dl.dropbox.com/u/15579799/dxscreens/c2.jpg

 

The problems ONLY occur with textured triangle lists. The NULL textured triangle lists (such as the white rectangle in the background) are fine. In this engine, fonts are rendered using textured triangle lists.

Thanks for suggesting PIX, I never used it before but it provided some cool information, but nothing that I could work out why the error was happening. If we isolate to the first rendered triangle list, the left 'panel' graphic, pix shows this as the current rendered image:
https://dl.dropbox.com/u/15579799/dxscreens/pix1.jpg

It shows the following location and UV coorindates, which I have checked match up with the screen dimensions and texture:
https://dl.dropbox.com/u/15579799/dxscreens/pix2.jpg

And this is the texture it is setting, showing correctly in PIX, which I assume means it loaded correctly:
https://dl.dropbox.com/u/15579799/dxscreens/pix3.jpg

So, I've learned a lot, but still no idea how on earth to fix this, I must be missing something...
I can confirm that the release build in IDE DOES WORK if I set /MDd flag, and the generated .exe also WORKS with that flag set. When changed to /MD neither work.

 

Any tips? Have I missed a step in the frame calls?
 

0

Share this post


Link to post
Share on other sites

Can you show a screen shot of the PIX mesh window for 'Pre-' and 'Post-' vertex shader?  It looks like one of the two triangles is being culled, and it would be helpful to see what w-values those triangles have before heading into the rasterizer (the xyz would be interesting too).

 

One other thing to try is to use the reference device and generate a PIX frame grab from that with a debug build and a release build to see if anything is different between the two, as well as to find out if it properly renders the scene.  If you aren't getting any errors, and you get totally different results between debug and release builds, then it could potentially be something with your driver (have you updated recently?).

2

Share this post


Link to post
Share on other sites

Can you show a screen shot of the PIX mesh window for 'Pre-' and 'Post-' vertex shader?  It looks like one of the two triangles is being culled, and it would be helpful to see what w-values those triangles have before heading into the rasterizer (the xyz would be interesting too).

 

One other thing to try is to use the reference device and generate a PIX frame grab from that with a debug build and a release build to see if anything is different between the two, as well as to find out if it properly renders the scene.  If you aren't getting any errors, and you get totally different results between debug and release builds, then it could potentially be something with your driver (have you updated recently?).


Jason, do you mean this?
https://dl.dropbox.com/u/15579799/dxscreens/pix2.jpg

It says post vertex shading disabled. I'm going to try a working version in PIX now

0

Share this post


Link to post
Share on other sites

I ran the working build in PIX and grabbed two screenshots.

https://dl.dropbox.com/u/15579799/dxscreens/working_pix1.jpg

https://dl.dropbox.com/u/15579799/dxscreens/working_pix2.jpg

 

I'm not familiar with PIX but I can't really spot any differences between the builds. *edit* err, actually- on the working build, what on earth is that 4th position value (-4310602xxxx)? I grabbed my graphics card's latest drivers yesterday. it didn't work on my friends PC (ATI gfx card) but the error does not occur on my other friend's PC (nvidia).

There is a possibility that im rendering the triangle list in the wrong order. I render a rectangle in this order:

// 0 - bottom left
// 1 - top left
// 2 - top right

 

// 3 - bottom left
// 4 - top right
// 5 - bottom right

I did have backface culling disabled
// Disable backfaces
d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);

I switched to
// Disable backfaces
    d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

But noticed no difference. Thanks Jason for your help

Edited by rukiruki
0

Share this post


Link to post
Share on other sites

OH WOW. It was the rhw value. It's never set for any vertices. I set every vertex rhw value to 1.0 and now it's working in every build.

Thank you so much Jason, if you didn't suggest PIX and comparing the two I never would have spotted this. I'm not sure how the reputation thing works but I tried to add some rep for you. Thanks again, I think it's fully solved now

1

Share this post


Link to post
Share on other sites

Great - I'm glad that its all cleared up now.  I have seen it a few times before where if the w value isn't correct then you can get flaky partially culled geometry, so it is a good place to start looking when you see those symptoms.  I still think it is strange that there was a difference between debug and release, but if its fixed, then its fixed!  Thanks for the reputation bump too :)

2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0