• 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
FelixK15

XNA - Texture2D won't get rendered after ~10 frames.

12 posts in this topic

Hi guys,

 

I'm facing a very strange error with an XNA project of mine.

 

I rewrote some things during the weekend on my laptop (I was on vacation).

After I checked that everything went smoothly, I pushed it to my git repository.

 

When I cam home yesterday I pulled everything from the repository to my pc at home.

 

I just wanted to continue to work on the project when I realized that - on my pc - all

Texture2D (e.g. all my sprites) are getting rendered for ~10 frames. After that the sprites

just disappear and I'm left with a violet screen.

 

However, when I start the project on my laptop everything works fine.

 

My suggestion was that I dispose something where I shouldn't, so I commented every Dispose() that was called out.

Sadly, that didn't change anything.

 

Do any of you guys have any suggestion what I can do, to corner that issue?

0

Share this post


Link to post
Share on other sites

IS the violet screen your background color? so what you set with GraphicsDevice.Clear(): ?

 

- Is the draw call defiantly still being called?

- Do the images have any transparency maps? E.g. Magenta gets cancelled

 

- Check where you are loading the Texture, I recall having a problem on a project a long time ago where I loaded a Sprite each time the user hit the Space bar, and that changed the Original Image (it was a randomly colored shape) (try making sure each sprite Loads in a new Instance of the texture)

 

- Are you using RenderTargets? If so, are you defiantly doing GraphicsDevice.SetRenderTarget(null); After?

When you draw, are you defiantly Drawing with Sprite batch.Draw(Texture, Position ..., Color.WHITE); <-- and not like a null colour, or Color.Transparent.

 

- Are you using REACH on your laptop, and Hi-def on your PC? or (V sa V).

 

These are the only things that come to mind atm.

0

Share this post


Link to post
Share on other sites

I noticed you mentioned you removed some Dispose() calls. I can't think of any regular situation where you'd need to call Dispose on a Texture in XNA, so this rings alarms bells for me.

 

Could you post up some code or link to your repository? It might offer some clues to what's going on.

1

Share this post


Link to post
Share on other sites

@Andy474

I checked everything you said, but it seemed ok.

What do you mean with 

Are you using REACH on your laptop, and Hi-def on your PC? or (V sa V).

 

@adt7

I read once that you should Dispose() all XNA resources that have not being loaded by the ContentManager.

 

The code would be too long to post it here, so here's the link to my repository:

https://FelixK15@bitbucket.org/FelixK15/rpg-xna-project.git

 

Thanks for looking through my code. I hardly suspect the GameWorldLoader class to be the source of the problem.

If anything is unclear or you got questions, either send me a PM or

add me on Skype (you can find my username in my profile)

 

---

 

I also recorded the behavior because it is pretty complicated to describe it.

http://www.youtube.com/watch?v=72cpRbrfv7U

(The video is a bit messed up at the beginning, but it gets better after a few seconds)

 

During recording I also realized that some of the tiles are not getting rendered (the violet squares),

however after I restart the program during the stream some of the previously not rendered tiles are

getting rendered and others are not. You can see the behavior in the video as I restarted the program 3 times in the video.

0

Share this post


Link to post
Share on other sites

It seems to be a problem with the driver from my ATI graphicscard. A friend of mine has the same card, but had old drivers. The game worked fine on his machine using the old drivers. However, as soon as he updated his driver so that our driver versions match, he had the exact same error as I.

0

Share this post


Link to post
Share on other sites
$git clone https://FelixK15@bitbucket.org/FelixK15/rpg-xna-project.git 
 

 

works perfectly for me

0

Share this post


Link to post
Share on other sites
Got it, thanks. It's pretty easy to repro, just minimize your game window and then restore it. This causes the graphics device to be lost.

(For some reason your graphics drivers are causing it to be lost more frequently or something. At any rate, this is something you need to handle).

When the device is reset, the contents of any RenderTarget2D will be lost (also true for DynamicVertexBuffer). You'll need to regenerate the data in response to the RenderTArget2D.ContentLost event.
0

Share this post


Link to post
Share on other sites

Actually that is not *quite* the same problem as I'm having.

 

If I minimize the game I can still see my player sprite and some of the other dynamic objects.

However my problem is that nothing gets drawn after a specific amount of frames (like in the video I posted).

 

The RenderTarget2D.ContentLost is also not getting called when my sprites stop getting drawn, however if I minimize/restore the window AFTER

the sprites disappear the sprites of the player and dynamic objects are getting drawn again.

0

Share this post


Link to post
Share on other sites
Hmm, you may be right, it might be something different.

I actually had it do some weird stuff while I was switching windows on the desktop (I know some stuff turned purple), and then I tried running it again and testing for the device lost which I described above. So it's possible that it did repro on my machine once, but I can't seem to repro it again. I can only get things to disappear if I force a device reset.

So I'm not sure what else to suggest at this point.

I looked at your code a bit. You're creating 496 render targets at startup. I know you Dispose them right away, but maybe it's somehow messing with your graphics card. I'm pretty sure there has to be an alternative way to do what you're doing.
Does it repro if you remove that code?
0

Share this post


Link to post
Share on other sites

Thanks for your hint!

 

The problem are in fact the RenderTargets.

 

I removed all RenderTargets from the GameWorldLoader and voila...it works.

 

Now I gotta find a workaround for that...gheez

Edited by FelixK15
0

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