(Mac) games without Cocoa!?

Moderator
Posts: 3,579
Joined: 2003.06
Post: #16
C# works fine with Unity in a cross-platform sense, so don't worry about that. C# on its own, however, doesn't have much support on the Mac other than Mono (and Unity of course). Mono is nice, but for some reason it just isn't as popular as I would expect. Mono even works on mobile like iOS, but last I checked, it was like $1000 per developer.

Quote:C is procedural too, isn't that kind of a negative now-a-days?

C, in general, is either a terrible language or a great language, depending on how you see it. I love it for what it is, but it is old and has many short-comings. The sad reality is that we just don't have anything better than C for what C does.

Quote:How does C work? Do you need some kind of SDL-like thing to make it cross compatible?

C doesn't technically need anything to work on multiple platforms, other than a compiler. All code from all programming languages on all computers is ultimately executed by the CPU(s) as binary. One step above binary is assembly language, which is just the binary translated directly into human readable mnemonics. So in practice, all code is ultimately assembly language. To make a language become assembly language it is "compiled" by a compiler. C, C++ and Objective-C are compiled directly to assembly language and executed like that. We sometimes call that "executing on the bare metal" as opposed to running through an interpreter or virtual machine. Different processors require different assembly language instructions, so it has to be compiled for each type of platform.

C# and Java:

An alternative way of execution is through a "virtual machine" where a language is compiled to "byte code", which is like assembly language, but designed to execute in the virtual machine that the language was designed for. The virtual machine is a program, probably written in C/C++, that is compiled for each platform. It interprets the bytecode and executes it on the processor. This way, since your code is compiled to byte code, it runs on any machine that has a virtual machine that can run it, without having to compile for each platform -- hence the "compile once, run everywhere" slogan.

There are obvious advantages to this, but the main disadvantage is that there is that thin layer of virtual machine between your code and the processor, which costs in terms of performance. This isn't much of an issue nowadays with JIT technology, but it still exists.
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #17
(Jun 24, 2013 10:23 AM)AnotherJake Wrote:  *What AnotherJake said above - I cut it out for space*

Ah, thanks. I understand that.

So, you still suggest SDL and C++ I suppose, whether I learn C or C++ first, that is the goal?

Like I asked in my previous post, I assume it's just coding a game, including SDL in the download, and SDL automatically makes the game work on any computer? How would you "bundle" it for Windows?
Quote this message in a reply
Moderator
Posts: 453
Joined: 2008.04
Post: #18
If you use SDL or GLFW, you will do something like this:
Do one Mac build with your game (probably in xcode) and the precompiled Mac version of SDL (or GLFW).
Get a windows computer, build your game with visual studio and the windows version of SDL (or GLFW). Figure out how to make a windows installer, since most users really really seem to want one.

Howling Moon Software - CrayonBall for Mac and iPhone, Contract Game Dev Work
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #19
(Jun 24, 2013 10:38 AM)AndyKorth Wrote:  If you use SDL or GLFW, you will do something like this:
Do one Mac build with your game (probably in xcode) and the precompiled Mac version of SDL (or GLFW).
Get a windows computer, build your game with visual studio and the windows version of SDL (or GLFW). Figure out how to make a windows installer, since most users really really seem to want one.

Ok. So I would basically just copy the code files from my Mac to Windows IDE and build them there, just how they are?

Thanks!!

Basically, for now, since I'm not going to be making a real game for a while, learning C++ using SDL on my Mac and not worrying about Windows will not be wasted time.

Edit: How are windows created when using SDL and C++ on Mac? Annoyed
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #20
Quote:So, you still suggest SDL and C++ I suppose, whether I learn C or C++ first, that is the goal?

Yeah, basically that's what I'd recommend (I'd still recommend starting with C of course). I haven't tried GLFW, but I've read good things about it. Heck there might be other alternatives to SDL and GLFW nowadays, I don't know.

Quote:Basically, for now, since I'm not going to be making a real game for a while, learning C++ using SDL on my Mac and not worrying about Windows will not be wasted time.

Right.

Quote:How are windows created when using SDL and C++ on Mac?

Read the docs and find tutorials! Smile There is a lot to learn just to get going with SDL at first.
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #21
(Jun 24, 2013 10:49 AM)AnotherJake Wrote:  *What AnotherJake said. I cut it out for space.*

Ok. Thanks to both of you! Great information. I will download SDL (wish it worked with other IDE's besides Xcode) and play around with that and Unity for now.

(Jun 24, 2013 10:38 AM)AndyKorth Wrote:  If you use SDL or GLFW, you will do something like this:
Do one Mac build with your game (probably in xcode) and the precompiled Mac version of SDL (or GLFW).
Get a windows computer, build your game with visual studio and the windows version of SDL (or GLFW). Figure out how to make a windows installer, since most users really really seem to want one.

Wait. After reading a bit more online, I have a question. Well, not really a question, but an "am I right?" kinda thing:

You still need SDL/GLFW to do this because if you were to make your game on Mac using Cocoa, and try to build it on PC, it would not work, which is the whole purpose of SDL/GLFW, correct? - having the ability to build your apps with the same code on different systems, and thus allowing for cross-compatibility?

*understands*
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #22
I found this. http://gameprogrammer.com/sdl.html

In the third paragraph, he explains exactly what SDL is and how it works. This is old, but it is accurate, right? If so than I completely understand SDL and am very excited!

Thanks.
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #23
I want to know because I am very curious if it'd work: Would building a Windows version using Visual Studio and SDL work on Mac under something like Wineskin Winery (Wine)? It doesn't matter to me right now obviously but I am just wondering for the future.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #24
in theory, every windows app works in wine. but why would you write cross-platform code and then not utilize the crossplatformness?
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #25
(Jun 29, 2013 12:26 PM)OneSadCookie Wrote:  in theory, every windows app works in wine. but why would you write cross-platform code and then not utilize the crossplatformness?

I am asking if I could run Visual Studio in Wine on my Mac and use SDL to make the Windows version of a hypothetical game, following what AndyKorth said. Using Wine has nothing to do with the code I write or the games I plan to make, just using it to run Visual Studio to build a Windows version with SDL.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #26
Oh, sure, in theory VS & compilers would work. Debugging probably wouldn't work though, and either way, you'd still need to actually test your app on real Windows.

You could also potentially build MinGW as a cross-compiler.
http://crossgcc.rts-software.org/doku.ph...ingwformac

IMO, either way is probably going to cause more pain than forking out for a Windows install disk...
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #27
Ok. Thanks.

(Jun 29, 2013 06:59 PM)OneSadCookie Wrote:  IMO, either way is probably going to cause more pain than forking out for a Windows install disk...

What does that mean? Ponder
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #28
it means to make windows software, buy windows, install windows, use windows.
Quote this message in a reply
Member
Posts: 60
Joined: 2013.03
Post: #29
(Jul 4, 2013 06:30 PM)OneSadCookie Wrote:  it means to make windows software, buy windows, install windows, use windows.

Ah. Yes, thanks.
Quote this message in a reply
Post Reply