Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411281 Posts in 69324 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 10:55:09 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Porting from XNA?
Pages: [1]
Print
Author Topic: Porting from XNA?  (Read 4976 times)
CitadelBrian
Level 0
**



View Profile WWW
« on: May 13, 2008, 12:17:56 AM »

Hey all.

So far, we've been making all of our games with XNA in C#. Personally, I love the framework and I love the language. It makes coding a lot of fun because visual results come very quickly.

The problem is, XNA has a lot of dependencies. .NET 2.0 SP1, XNA Redist, DX 9.0c (even if you already have it, there are various bits and pieces scattered throughout updates it seems). It's kind of a foggy topic.

Despite these end-user requirements, Audiosurf has had remarkable success. I can't find any reports of large download/install times either (needs to download/install the packs req'd). I'd like to see how Fez deals with this problem as well, considering all the positive feedback it's gotten so far.

So my question is this: Are there any XNA developers out there who are dealing with this problem with success? And should I go ahead and port our current project (getting big at this point) to SDL.NET + FMOD? Or is there a better alternative?
Logged

Lead Programmer, Citadel Studios - ProgBlog
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #1 on: May 13, 2008, 01:56:47 AM »

I took a month or two out and ported my stuff to SDL.NET and Tao.OpenGL.

Now I can distribute my games with all the runtime DLLs included and the only thing the end user has to install is .NET 2.0.

I recommend not using SDL.NET as a foundation for your game - go with Tao for most of your stuff and maybe use SDL.NET for input. The reason for this is that the SdlDotNet library is still fairly badly supported, contains a few bugs, and relies on things like its own Vector class which lacks features. Our framework has been infected by System.Drawing.Color (ugh) and SdlDotNet.Core.Vector, which is a bad thing. Try to avoid this - write your own ColorF struct and use that to pass into Tao.OpenGL. I also wrote quad and tri batcher classes that stash drawing data and pass it to OpenGL in vertex arrays. If you want to see the code it's open-source and available at http://catrpg.svn.sourceforge.net/viewvc/catrpg/Wuwei/.

Tao also has OpenAL bindings so that should be used in favour of SdlDotNet.Audio, which is severely lacking in features. I have no idea about fmod, so use that if that's your poison.

Another benefit of porting to Tao/SdlDotNet is of course the potential for cross-platform development to Mac and Linux.
Logged

Sar
Level 3
***


Likes Violins


View Profile WWW
« Reply #2 on: May 13, 2008, 05:02:30 AM »

Audiosurf ... Fez

Wait - Audiosurf and Fez are XNA-based? I totally missed that.

I took a month or two out and ported my stuff to SDL.NET and Tao.OpenGL.

Now I can distribute my games with all the runtime DLLs included and the only thing the end user has to install is .NET 2.0.

I wrote my last project in .NET2 and SDL.NET, and I still hear more complaints about having to install .NET2 than anything else.

Which makes me sad, because I really like C#.

I get the impression that a lot of people have .NET1.1 installed, but not so many have .NET2 for some reason. Does Windows Update push 1.1 but not 2?

I recommend not using SDL.NET as a foundation for your game - go with Tao for most of your stuff and maybe use SDL.NET for input.

I'd kind of agree with this, though. I think I ended up using SDL.NET for input and audio only, in the end. But then it helped that I mostly understood how to use OpenGL before starting and hadn't seen the SDL.NET library before. ;-)

(As it goes, though - I've been loitering on the SDL.NET forum for a little while, and the developer/s seem to be fairly responsive when it comes to bugs.)



(And yeah, I got it working on Linux and OSX in the end, which was a bonus. Particularly since one of the guys collaborating on the project didn't have a Windows machine... ;-)
Be aware, though, that if you do want to make a game available for Mono then you really do have to test it under Mono; as much as it's an impressive level of support for .NET programs it isn't perfect, and it does do somethings notably differently. The two that stick in my mind are that the Mono garbage collector seems to think that three days is a reasonable amount of time to wait before freeing up unused memory, and the List<> class defaults to sticking new items at some random point in the list, unlike Windows .NET where it defaults to sticking them at the end.)
Logged

Currently working on: Chronicle of Mars
Previous Projects: [Käfer|Tristan and Iseult(TIGS)]
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #3 on: May 13, 2008, 05:23:39 AM »

Shit, that's bad about the List<>s.

BTW, it's pretty easy to make an installer that is scripted to download the .NET 2 runtime if it's not present. I can post the InnoSetup code if you like.
Logged

CitadelBrian
Level 0
**



View Profile WWW
« Reply #4 on: May 13, 2008, 06:13:20 AM »

Shit, that's bad about the List<>s.
Yikes, I know less about Mono than I thought. I don't think it would mess anything up in the game (yet), but I suppose using LinkedList<> would be one way around that problem...

I can post the InnoSetup code if you like.
I believe that we might have the same code already. Tongue One of our coders here grabbed it from the XNA forums, although I'd prefer not to use it. It looks to download the .NET 2.0 Framework without SP1, and I don't know ObjectPascal. Also, I'm lazy (and have more actual game coding to do). I was making an installer using NSIS before we found the Inno versions anyway, might as well finish that up.

I get the impression that a lot of people have .NET1.1 installed, but not so many have .NET2 for some reason. Does Windows Update push 1.1 but not 2?
Windows XP comes with 1.1. 2.0 is going to be included in Windows XP SP3; it's included with Vista. I believe Vista SP1 installs v3.5 as well.

I took a month or two out and ported my stuff to SDL.NET and Tao.OpenGL.
...
Tao also has OpenAL bindings so that should be used in favour of SdlDotNet.Audio, which is severely lacking in features. I have no idea about fmod, so use that if that's your poison.

Another benefit of porting to Tao/SdlDotNet is of course the potential for cross-platform development to Mac and Linux.
Maybe it's just me, but using OpenGL after getting used to XNA seems like a large step backwards. The rest of the team just got caught up to me in getting used to it, and I don't want to impose learning another framework right now. SDL.NET seems at least close to XNA, which is what I want.

To be fair, though, all the drawing stuff is abstracted away by my own code, so I don't know if they'd really have to know it.

Hmm.
Logged

Lead Programmer, Citadel Studios - ProgBlog
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #5 on: May 13, 2008, 06:21:03 AM »

The problem with raw SDL is that it doesn't support scaling and rotation on the fly. You will NEED some OpenGL to be able to scale and rotate bitmaps. SDL.NET comes with a GlSprite that does some of this stuff, but I quickly found myself having to extend it. And then I quickly found myself having to write a batch class to match XNA's SpriteBatch, as OpenGL immediate mode isn't good for anything but prototypes and debug lines.

It depends what you're doing really.
Logged

CitadelBrian
Level 0
**



View Profile WWW
« Reply #6 on: May 13, 2008, 06:48:12 AM »

The problem with raw SDL is that it doesn't support scaling and rotation on the fly. You will NEED some OpenGL to be able to scale and rotate bitmaps. SDL.NET comes with a GlSprite that does some of this stuff, but I quickly found myself having to extend it. And then I quickly found myself having to write a batch class to match XNA's SpriteBatch, as OpenGL immediate mode isn't good for anything but prototypes and debug lines.

It depends what you're doing really.

I have some interactive control classes (text box, button, etc) that stretch a 1x1 white Texture2D to draw itself (borders, backgrounds, etc). You mean to say that I can't stretch this texture without restarting the game using just SDL?
Logged

Lead Programmer, Citadel Studios - ProgBlog
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #7 on: May 13, 2008, 06:59:59 AM »

Well... I'm not completely certain about the performance and memory requirements of what I'm about to say. But an SDL surface is pretty much bitmap data. You can draw one surface onto another ("blitting"). You can create rotated and scaled copies of any Surface, and this will give you back a new Surface with the data you requested on it. This might not be a great thing to be doing for loads of things every frame. Flipping is a similar problem, but at least with that you can create one flipped version of a sprite sheet on the heap and then use that if you want the flipped sprite. It's not called "Simple" Directmedia Layer for nothing Smiley But the main thing that bothered me about SDL.NET (and possibly SDL itself, I don't know) is that there doesn't seem to be a way to blit rotated and scaled versions of surfaces onto other surfaces without first making a rotated or scaled copy of that surface.

No, the real way to do scaling and rotation is to use hardware accelerated rendering, and in XNA this is of course done with DirectX; in SDL you can use OpenGL to do this stuff for you. SDL.NET lets you create a window in OpenGL, at which point you're free to use Tao.OpenGL (in fact all of the SdlDotNet stuff uses Tao - it's just nice wrappers for Tao.Sdl, Tao.OpenGl etc) to build up your graphics in immediate mode, using vertex arrays, vertex buffers, shaders, etc etc.
Logged

PaulMorel
Level 1
*



View Profile WWW
« Reply #8 on: May 13, 2008, 07:01:07 AM »

.Net2.0 is being released with SP3, yes.

Unfortunately, .Net 3.5 and VS2008 came out about a month ago.  Lips Sealed

I'm not a graphics programmer, so I can only make recommendations based on general language attributes ...

Still, if I were you, I would consider Java.  It is the closest thing to .Net that isn't .Net (I say this having deployed business apps in both, but games in neither).

I have no idea whether the libraries that other people mentioned are java compatible.
Logged

my computer music blog: http://www.thisisnotalabel.com
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #9 on: May 13, 2008, 07:03:46 AM »

If you're into Java and are happy with OpenGL, try princec's (et al) Lightweight Java Game Library.
Logged

CitadelBrian
Level 0
**



View Profile WWW
« Reply #10 on: May 13, 2008, 07:49:12 AM »

Java makes me want to strangle the nearest person.  =|

Maybe I'll port everything to Tao + SDL.NET. It's better to do it now before our engine gets any larger. Maybe I'll shoot off an email to the Audiosurf or Fez developers, see how they're getting around dependencies before I port a a couple thousand lines of code.
Logged

Lead Programmer, Citadel Studios - ProgBlog
Zaknafein
Level 4
****



View Profile WWW
« Reply #11 on: May 13, 2008, 08:45:10 AM »

O hai, I make Fez.

I too used Inno Setup in the first builds that we distributed, and took/played with probably the same script from the XNA forums. I haven't had much distribution problems other than people not having SM2.0 video card, which XNA requires to run anything.

My version of the script for XNA 2.0 : http://www.theinstructionlimit.com/?p=32

But now that 3.0 is in Community Technical Preview and is built upon .NET 3.5, I guess a lot of the checks that are made in my script will disappear and I'll just bundle and execute the .NET 3.5 web installer.

I don't plan getting away from XNA since I love the framework and I love C#, moreover now that I can use delicious C#3 features...
Logged

PaulMorel
Level 1
*



View Profile WWW
« Reply #12 on: May 13, 2008, 09:02:31 AM »

I don't want to hijack this thread, but OMG I am so happy to see that first new feature in C#.  That will save me so much time.  I can't even count all the times I have wished for a shorthand notation for generic get/set methods...
Logged

my computer music blog: http://www.thisisnotalabel.com
Sar
Level 3
***


Likes Violins


View Profile WWW
« Reply #13 on: May 13, 2008, 09:24:26 AM »

Shit, that's bad about the List<>s.

To be fair to the Mono guys, the MSDN docs do state that a List<> isn't guaranteed to have an order or to keep its order after operations are performed. It's just nice that the MS.NET version of the class conveniently stacks everything up at the end of the list.

The one place it broke our project I'd been assuming the List<> would keep its order, so it was my fault; I replaced it with a SortedList<> and it all worked fine in Mono. But there are places I didn't bother 'cause it wasn't necessary, so - for example - the dialogue choices show up in a different order on the Mono runtime to the MS.NET runtime. ;-)

BTW, it's pretty easy to make an installer that is scripted to download the .NET 2 runtime if it's not present. I can post the InnoSetup code if you like.

(As it goes, I'd be quite interested in seeing this, or a link to this. I've had "make an installer" on my to-do list since the end of March, now... ;-)

there doesn't seem to be a way to blit rotated and scaled versions of surfaces onto other surfaces without first making a rotated or scaled copy of that surface.

This is basically the reason that I never really investigated moving all my OpenGL code to use SDL classes; rotation was described as "terribly slow". :/

Java makes me want to strangle the nearest person.  =|

I have the same problem.

Or to be fair, I had the same problem the last time I used Java, but that was the last time I was forced to use Java, which was 2002. It seemed to me at the time that Java's APIs were often missing all the nice convenient overloads and obvious-use-case utility methods with sensible defaults, while .NET was stacked with that kind of thing.

Also that whole thing about having to declare all the exceptions you're going to maybe possibly throw annoyed me a bit, but I can at least see the reasoning there.

To be fair to Java, though, for all I know it's improved a lot in the last six years. And I'd still prefer coding in Java to coding in C++. ;-)
Logged

Currently working on: Chronicle of Mars
Previous Projects: [Käfer|Tristan and Iseult(TIGS)]
PaulMorel
Level 1
*



View Profile WWW
« Reply #14 on: May 13, 2008, 09:33:45 AM »

Quote
Quote
BTW, it's pretty easy to make an installer that is scripted to download the .NET 2 runtime if it's not present. I can post the InnoSetup code if you like.

(As it goes, I'd be quite interested in seeing this, or a link to this. I've had "make an installer" on my to-do list since the end of March, now... ;-)

My company uses a launch condition in our .Net deployment project.  See here:
http://msdn.microsoft.com/en-us/library/xxyh2e6a.aspx

Our launch condition has this InstallUrl: http://go.microsoft.com/fwlink/?LinkId=9832
Logged

my computer music blog: http://www.thisisnotalabel.com
CitadelBrian
Level 0
**



View Profile WWW
« Reply #15 on: May 13, 2008, 09:36:10 AM »

After a quick legal scare, we've decided to stay with XNA because it makes the most sense for our team.

Thanks for the advice guys, and thank you very much Zak for the script. We'll make be to mention you all in the credits Wink
Logged

Lead Programmer, Citadel Studios - ProgBlog
spidermonkey
Level 0
**


View Profile
« Reply #16 on: May 15, 2008, 02:32:43 AM »

Quote
Wait - Audiosurf and Fez are XNA-based? I totally missed that.

I don't think Audiosurf was made with XNA...
Logged
Zaphos
Guest
« Reply #17 on: May 15, 2008, 02:43:41 AM »

To be fair to the Mono guys, the MSDN docs do state that a List<> isn't guaranteed to have an order or to keep its order after operations are performed. It's just nice that the MS.NET version of the class conveniently stacks everything up at the end of the list.

The one place it broke our project I'd been assuming the List<> would keep its order, so it was my fault; I replaced it with a SortedList<> and it all worked fine in Mono. But there are places I didn't bother 'cause it wasn't necessary, so - for example - the dialogue choices show up in a different order on the Mono runtime to the MS.NET runtime. ;-)
What?  The docs say:
List<(Of <(T>)>)..::.Add Method
Adds an object to the end of the List<(Of <(T>)>).

'Keeping an order' is different from 'adding to the end of the list' -- a sorted list will add in the appropriate place to keep the list sorted, while the List<> will add to the end.
If the mono Add() function adds anywhere but the end of the List<>, it's broken.
Logged
Sar
Level 3
***


Likes Violins


View Profile WWW
« Reply #18 on: May 15, 2008, 03:55:21 AM »

Hmm, so it does. I was sure I'd looked up the docs after discovering the problem and decided it was my fault...

I'm still more annoyed by the garbage collector, though, to be honest. It makes the game consume twice as much memory as it needs to on Mono just 'cause it had to set up huge byte arrays of data to load textures into OpenGL... which then never seem to get freed. :/
Logged

Currently working on: Chronicle of Mars
Previous Projects: [Käfer|Tristan and Iseult(TIGS)]
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic