Sign in to follow this  

C#: XNA and Xamarin

This topic is 1114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How does using XNA differ from using Xamarin if you are programming in C# in both?

 

Is it the syntax of command lines that is different? i.e. order of writing commands

 

Is it possible to get a rough idea of this without knowing any programming, 

 

I ask this because I have a Mac and most tutorials for beginners are in XNA, would it be possible to follow XNA tutorials and write in Xamarin ?

Share this post


Link to post
Share on other sites

Whats MonoGames relation to Xna ? 

 

More specifically I'd like to buy this book:

http://www.barnesandnoble.com/w/beginning-c-programming-with-xna-game-studio-at-chamillard/1108649142?ean=2940014046589

Which is Xna based

 

and use my Xamarin to program the same application tutorial in the book. 

 

Does this make sense?

Where does MonoGame come into this?

Share this post


Link to post
Share on other sites

MonoGame is an open source drop-in replacement for Xna with cross platform support. It seems Microsoft is now recommending it for new projects.

 

I have no idea about the book. The code should be 90-100% identical. There will most likely be some discrepancies between the development tools however, such as hotkeys and menu items having different names and/or residing under different menus or whatever. Whether or not that is a problem is up to you.

Share this post


Link to post
Share on other sites

Xna is two things. (this is not entirely accurate, but the general idea should apply)

 

1. A library/framework for .NET with functionality usable from your own code. Graphics, input, sound, network etc.

2. A plugin to Visual Studio which makes it easier to work with said library/framework. Includes project templates among other things.

 

MonoGame is primarily a replacement for #1. It implements just about all of said functionality with the same interface. MonoGame also offers partial replacement for #2, but that part may not be as complete as for #1.

 

You should be able to use MonoGame to create games on a mac, that can be played on Windows, OSX, IOS, Android, Linux and more.

Edited by DvDmanDT

Share this post


Link to post
Share on other sites

Thanks DvDmanDT,

 

I understand what a library of code is, but what does a ''framework'' for .NET mean?

 

What is .NET, (the wikipedia page is a little unclear for me)

Share this post


Link to post
Share on other sites

How does using XNA differ from using Xamarin if you are programming in C# in both?

 

Is it the syntax of command lines that is different? i.e. order of writing commands

 

Is it possible to get a rough idea of this without knowing any programming, 

 

I ask this because I have a Mac and most tutorials for beginners are in XNA, would it be possible to follow XNA tutorials and write in Xamarin ?

Monogame is advantageuous because you can easily port to most platforms.

Share this post


Link to post
Share on other sites

.Net is a runtime environment, it defines a sort of "virtual" computer platform that runs on top of a host operating system. The .Net framework refers to this runtime, plus the standard .Net core libraries. This is why the same .Net application can run run on Windows, Linux, and Mac -- just as long as the developer has chosen libraries that are available on all of those platforms. In Java, the Java Virtual Machine is equivilent to the .Net runtime, and there is a standard set of Java libraries as well. This description simplifies things a bit, but its sufficient for this discussion.

 

Mono is an open-source implementation of the .Net runtime and .Net framework which runs on Windows, Linux, Mac, etc. MonoGame is an open-source implementation of the XNA framework that also runs on Windows, Linux, and Mac. Thus, if you program for Mono and MonoGame, your apps will run on Windows, Linux, Mac, etc, with the same code -- in some cases you might have to, or want to, write a little platform-specific code to work around issues or to take advantage of platform-specific features, but otherwise your code should just work on any of the platforms that mono and monogame support.

 

Mono differs slightly from the .net runtime/framework in that it lags a bit behind Microsoft's official .Net runtime; However, they've just open-sourced a ton of .net, including the runtime. I expect that within the next year, Mono will either switch over to that core as is, or start pulling the newest parts they're still missing (C# 6.0 just hit preview, along with a version-bump of the runtime). A year from now, Mono and Microsoft's runtime should have feature parity.

 

Now, monogame itself might be targetting an older version of the framework (XNA would have), but I don't use it so I'm not sure. If so, you might not see any new-fangled goodness, but the existing support today should have already caught up to where XNA was. In theory, you should be able to take a monogame project, copy it over into XNA studio (which I think Microsoft still offers and you can still publish to Xbox 360?), and publish to Xbox 360 with little code changes (maybe none?). That's the power of the .net runtime and framework in a nutshell -- you can take an application (as a binary in some cases, or source code in others) and run it on a completely different hardware architecture, on a completely different OS, and a completely different .net runtime/framework implementation and it should "just work" for the most part.

Share this post


Link to post
Share on other sites

so is .Net like a language translator that takes a program in one language and translates the entire program into a new language making the program ready to be published instantly?

 

To get MonoGame on my mac laptop what do I need to do?

there are two options on the site:

 

MonoGame for VisualStudio

MonoGame on GitHub

 

What do these mean?

Share this post


Link to post
Share on other sites

Well.. Yes and no. .NET is also an umbrella for several things.

 

A compiler translates code from one "language" to another. A C# compiler will typically translate C# code into CIL (sometimes called MSIL). This is something like abstracted machine code. Microsoft has one (csc.exe) and Mono has one (mcs). Their outputs are 100% compatible. This step is performed by the programmer before release.

 

CIL can then be compiled into real machine code. You typically use .NET for this on Windows and Mono on everything else. This compilation step is typically performed when you start the application through a process called Just In Time compilation or JIT for short.

 

Then there's libraries. Some libraries can be shared across operating systems and hardware platforms, others need specialized implementations for their respective OS/hardware. Mono provides the specialized ones for non-windows platforms and .NET provides them for Windows.

 

A Framework is usually a collection of libraries, tools and/or some form of methodology and/or structure. A framework is usually something you "build upon" where a library is usually something you "include".

 

About the MonoGame links, it seems the current release does not come prepackaged for anything but Windows (they are reworking their packaging). You can probably get by using the development build of MonoGame for MonoDevelop Mac.

Share this post


Link to post
Share on other sites


so is .Net like a language translator that takes a program in one language and translates the entire program into a new language making the program ready to be published instantly?

 

Its a translator of sorts, yes -- but don't think of it as "I speak C#, and .net translates to some other programming language" -- at a very detailed level that's true, but its more helpful to you to think of it as "I speak .Net -> Mono understands .Net -> Mono speaks Windows, Mac, Linux, etc." Also, I speak MonoGame -> MonoGame exists on Windows, it speaks DirectX, etc; MonoGame exists on Linux, it speaks OpenGL, etc; MonoGame exists on Mac, it speaks OpenGL, etc. The libraries have to exist on each platform, because they have to tie to the platform itself to do the right thing, but as long as you speak the MonoGame library through .Net/Mono, it'll all work out on each of those platforms.

 

Anyways, at your level you don't need to worry too much about how it works, you just need to know that it does work, so long as you choose to use libraries that are available on all the platforms you want to support (like MonoGame, or any of the core framework libraries).

Share this post


Link to post
Share on other sites

This topic is 1114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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