Duke4.net Forums: Ported build to XNA(C# WP7 Silverlight) - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ported build to XNA(C# WP7 Silverlight)  "Needed some optimization help."

#1

Posted Image

Hey,

I ported the build engine(8bit renderer) to Verifiable Managed C#(no c++ code, or pointers) so it compiles and runs on the Windows phone. With slight modifications you can easily get it to run on the PC or the 360(just replace WriteableBitmap with Texture2D, and modify a couple things in the sound code and filesystem code). Originally I was testing the code on the 360 and the windows phone but on the phone a silverlight project is the only way to take advantage of networking with XNA, so I just moved everything over to silverlight.

My problem is to get everything to run on the phone without using interop/com hacks, aside from code changes and casting issues I had to completely remove all the pointers, and re-write some of the functions to pull from arrays and store pointer positions as variables. This didn't seem like a problem but when I ran a profiler on the project(before i ported it to silverlight), it seems a lot of the slow down is because of the managed arrays. This doesn't really make sense to me, and I know for a fact the code isn't "bug free" yet(there are a couple glitches with walls bleeding into adjacent sectors, floor sprites are disabled, and voxels are also disabled), but at least on my phone it runs at maybe 5-6fps on 320x200(on the 360 I got 15-25, and perfect fps on my pc) so I was hoping some one could take a look at the code and see if anything stands out.

I knew when I started porting it there would be some overhead(specifically with bound checking all over the place) but this seems excessive. Before I fall asleep:

SVN: http://xna-shadow-wa....com/svn/trunk/

COMPILE INSTRUCTIONS:
I'm using the shadow warrior demo to test out my code since performance wise it really pushed the build engine(but I've also loaded up duke3d maps/kenbuild maps and blood maps). The soundmanager does load VOC files(loads Duke3D voc files perfectly, I had to manually set the pitch for SW sounds ), the music on the other hand since I couldn't find a way to play midi files in XNA without a lot of nasty hacking I just downloaded the music files from the 3DR ftp so you will have to do the same and put the MP3's in the music folder or just completely comment out the music code.

I also use the AssemblyInfo task to handle the apps build tag(auto updates the build number, date and revision) if you don't have that installed you can either download it or remove the build tag. As I said before if you want to try it on the 360 just replace WriteableBitmap in Vga.cs with Texture2D and a few other small things(like the input code :dukegoof:) and it will work.

Does Ken still come around here? I would have posted this on the JonoF forum but his forums is obviously down :/.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options