Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Apr 2012
Offline Last Active Feb 14 2014 06:49 PM

Posts I've Made

In Topic: Slow loading xml/xnb as data type on PS Vita

02 November 2013 - 07:08 PM

Thanks. I'll let you know how it goes.

In Topic: Slow loading xml/xnb as data type on PS Vita

01 November 2013 - 04:15 PM

XNB is just an encoding format. You still need to deserialize everything.
Going over your data it is quite likely you are running 4200 allocations, calling roughly 4200 constructors, and otherwise doing a lot of work.  Even if you aren't doing all those allocations you still must deserialize each one of the 4200 items one at a time, sequentially, reading in that the element is a single item, storing the value (almost always the value -1), then advancing to the next item.
Look for ways to not do that.  See if you can do ONE allocation, then push all that data into that one big allocation.
Even if you broke that down into just the 8 map layers listed in your xml, that is 8 allocations, reading 8 small blocks of 53x20=1060 integers rather than reading in the same data with 1060 entries that must be parsed individually.
Do everything you can to get your serialized data into the most usable format.  Instead of 1060 blocks of data, make one big block of data that can be read without parsing.

Thank you for the insight. I have one idea I was considering so maybe you can give me your opinion on whether you think it will help the situation.

I'm wondering if instead of using these enormous xml/xnb files I could instead represent the same data in a much smaller text file like this http://pastebin.com/raw.php?i=czJk6pbv

In that example of a 6x4 map, the tiles are delimited by commas, the rows of tiles are delimited by line breaks, and the map layers are delimited by double line breaks.

It's the same amount of data, but it's represented in far fewer characters. So the questions is, do you think this would load any faster if I did it this way?

In Topic: Slow loading xml/xnb as data type on PS Vita

01 November 2013 - 03:42 PM

Working with XML by itself can be slow. The format is verbose. The format is inefficient. The format requires parsing.
While XML is wonderful for passing data between tools, when you build your compiled game it is often best to parse it and dump it to data structure that can just be loaded into memory and used directly.


If I understand you correctly, I may already be doing this. If my MapData is a data structure. When the game is run, this data (in XNB) format is loaded into MapData.

That in mind, there are many high performance XML libraries out there. They do smart things like reading the entire file into memory and process branches in parallel. These libraries also use smarter memory allocation rather than using one globally-new'd object per node, which is extremely slow and wasteful. There are hundreds of them, and I won't recommend one over the others because each has their own benefits and drawbacks that may be important in your project.

Thanks, I will look into this. Although, I'm not sure if it applies since I'm loading XNBs. I don't fully understand how it all works but you've given me something to go on.

In Topic: How could I possibly get a user’s save file to transfer to a sequel game?

01 February 2013 - 05:44 PM

Thanks for your help. But Microsoft does not give XNA devs the same access to player data that other games like Mass Effect does.  It is not within the XNA framework.  I've asked on other forums and it seems the only option is possibly a password system.


As for PC, it may be possible it I could simply specify the directory where the save file is stored.  But I'm having trouble finding the correct syntax for that.  I can save in IsolatedStorage or in SavedGames but I cannot find a way to specify the sub directory.

In Topic: Need help transforming a 2D image

18 July 2012 - 09:17 PM

12 hours later and no luck. I tried everything with "quads" but couldn't get the effect working. I would try GodofOdd's final solution in this thread http://forums.create.msdn.com/forums/t/37143.aspx but I can't make heads or tails of his code.