Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: C# and SFML for OS X (and iPhone)  (Read 6871 times)

0 Members and 1 Guest are viewing this topic.

Andrej Vojtas

  • Newbie
  • *
  • Posts: 4
    • View Profile
C# and SFML for OS X (and iPhone)
« on: January 19, 2009, 03:46:32 pm »
Hi,

I'm a game designer and artist, not much of a programmer so please bear with me.
Maybe one day you will have a great game to play for helping this confused guy out :)

I'm solving the common indie question: how to cover the most interesting platforms for small creative games.
For my project its OS X, PC, XBox Community Games, iPhone

PC/XBCG: I would like to use XNA = write my game logic code in C# (lots of RPG AI) to create my game for PC and XBox Community Games.
Just basic 2D static graphics + particles.

OS X: Is it possible to use the game logic code in C# and use SFML for the graphics and audio to make an OSX version? How difficult would it be?
iPhone: I read in the feature that SFML plans to support more platforms in the future.
Is it probable that iPhone will be supported in summer 2010? Could a similar port be made: game logic in C# + SFML?

I appreciate your answers and welcome any new insights and solutions I'm not aware of.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
C# and SFML for OS X (and iPhone)
« Reply #1 on: January 19, 2009, 04:12:31 pm »
Hi and welcome to the forums.

Regarding to your question: generally yes. It's a thing called abstraction. That means you completely separate any graphics and sound functionality in separate modules, thus allowing you to replace them easily. You just have to define an interface which applies to all of these modules.

An example of that is the MVC pattern (try it on Google, should give you some pointers).

Generally it's always possible to use SFML for rendering and playing sounds/music, as long as SFML is compatible with the proper platform. These are currently Windows, Linux and OSX.

Andrej Vojtas

  • Newbie
  • *
  • Posts: 4
    • View Profile
C# and SFML for OS X (and iPhone)
« Reply #2 on: January 19, 2009, 10:41:06 pm »
Thank you.

That what what I had in mind.

Can someone comment on the plans for more supported platforms?

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
C# and SFML for OS X (and iPhone)
« Reply #3 on: January 20, 2009, 12:55:13 am »
I'm not familiar with the iPhone, but doesn't it heavily use Java?

seoushi

  • Newbie
  • *
  • Posts: 15
    • View Profile
C# and SFML for OS X (and iPhone)
« Reply #4 on: January 20, 2009, 01:28:41 am »
I was just going to ask about the iPhone myself. Has anyone started a port for it?

Here what I've done myself:

-I successfully compiled the SFML-System lib without any modifications.
-I got SFML-Audio working by removing references to libsnd (LGPL means no static linking and you can't dynamically link custom libs in iPhone Apps) so only ogg works which is perfectly fine for me.
-I'm hoping to port over SFML-Window soon, it uses UIKit instead of Cocoa but both are similar.
-SFML-Network should port over without any changes but I haven't tried it yet.
-SFML-Graphics might take a bit to port over depending on what the mac version used (I haven't looked yet).


The biggest issue is riding of all LGPL/GPL code (and other restrictive licenses) for the iPhone since you can not switch out libs in iPhone applications or dynamically link.

If/when I port over SFML-Window I'll release the changes and xCode project.

Also to set the record straight the iPhone uses C/Obj-C and C++, it can not do Java.

Andrej Vojtas

  • Newbie
  • *
  • Posts: 4
    • View Profile
C# and SFML for OS X (and iPhone)
« Reply #5 on: January 20, 2009, 10:28:11 am »
@seoushi

That's good news indeed! Thank you for letting us know and for the clarification.

Hopefully you want run into some serious trouble.

Sorry for asking again: will an abstracted layer of game logic written in C#, calling the SFML graphics/audio/input functions work with the iPhone SFML port?

SamuraiCrow

  • Newbie
  • *
  • Posts: 40
    • Yahoo Instant Messenger - samuraileumas
    • View Profile
C# and SFML for OS X (and iPhone)
« Reply #6 on: January 20, 2009, 08:29:24 pm »
Does C# even run on the iPhone?  I didn't think the iPhone ran .NET at all.  I'm sure there isn't a micro edition of Mono capable of running on handhelds.

In short, I think it's safe to say that the iPhone doesn't run C#.

seoushi

  • Newbie
  • *
  • Posts: 15
    • View Profile
C# and SFML for OS X (and iPhone)
« Reply #7 on: January 20, 2009, 08:48:45 pm »
C# doesn't run in the normal sense on the iPhone but it does work. Since you can't have a vm on the iPhone it won't pass for submission but it will work technically. If you use ahead of time compiling you can create binaries for the iPhone that will pass apple submission however AOT isn't quite up to par with the normal release (no generics among other things).

I know unity 3d uses mono with AOT for mixing C# and native code on the iPhone however I'm not sure of the difficulty of this process.

Andrej Vojtas

  • Newbie
  • *
  • Posts: 4
    • View Profile
C# and SFML for OS X (and iPhone)
« Reply #8 on: January 20, 2009, 11:09:45 pm »
Thank you for more details. I think I know enough to make the decision I wanted.