# Porting Minesweeper to OSX advice



## bighairydog (Apr 30, 2002)

Hello programming gurus,

I'd like to learn how to program, as HTML/PHP/JavaScript has gotten way too softcore for me. Therefore, I have decided to port to OSX the best (read only) reason to own a PC - Minesweeper! (BTW, I'm aware that this has already been done, but I want to make mine better, and freeware)

I'm already competent in basic programming concepts, but am scared by 'real' programming languages that require all sorts of things like declaring variable types and sizes before use.

What language should I use? I like the idea of using cocoa, because it's part of the Mac community, and I hear it makes it easy to add cool features, but is it too advanced for a relative newbie? How about Java, C, C++, ObjC, Applescript? I'm lost for chioce!

I'm looking for a language that:
is easy to pick up
is good for programming games
makes adding multimedia bits (images, video clips sound etc...) easy
has a sensible way of dealing with realtime user input
What would you reccommend? And if you know a good book to learn from, that would be god too. any Help much appreciated.

Ta

Bernie     )


----------



## dricci (Apr 30, 2002)

You might be able to do it in AppleScript Studio which is part of the Developer Tools.

simX will have to help you with that, though. He's the ASS Expert


----------



## nkuvu (Apr 30, 2002)

Assembly programming is definitely the way to go. 

No dealing with data types, variable declarations, what have you.  Just pure programming...



Seriously, I am not familiar with ObjC, so I don't know what data types are available.  Java has pretty good predefined data types (lists, stacks, what have you).  I'd probably avoid C/C++ as a beginner's language, personally, since you'd have to build just about everything form the ground up.  Unless, of course, there are libraries already available for OS X.

You might even want to try this in Perl or something similar.  Perl has GUI capabilities, and has a lot of built-in functionality.  It might not be the fastest thing in the world, but it would get you started.

So essentially my advice is this:  Find a language where a lot of basic things are built in.  Not only does this mean you don't have to reinvent the wheel, but the built in things are frequently going to be more thoroughly tested and optimized than user-defined things.  To this end, ObjC might work (I've never even seen ObjC code), Java would work, higher level scripting languages (Perl, Python (I personally don't like Python)) may work...


----------



## bighairydog (Apr 30, 2002)

Cheers for the help.

Applescript sounds like the best bet for a simple game, but I'm worried it may limit the scope of transferrable skills I get from a project. Any AppleScript evangelists beg to differ?

Someday though, I'd really like to learn Java, so I wonder if it's best to jump in at the deep end and learn it now. Everybody loves a Java enabled programmer...

Bernie     )


----------



## simX (May 1, 2002)

I would not suggest AppleScript Studio as the way to go for games.  I would recommend Obj-C.  AppleScript is limited in multimedia tasks  although it is possible if you really want to take a stab at it.

Obj-C is not an easy language to learn, nor is AppleScript (if you haven't had previous experience from the Classic Mac OS days).  But both are powerful languages, and it always depends on what you're going to program.  Like I said, Obj-C would probably be better for the Minesweeper game that you want to program.

To tell you the truth, though, I'm really annoyed at how slow AppleScript Studio and am seriously considering migrating to Obj-C.  I'll still need to learn it, so I'll probably keep developing MUG in AppleScript Studio for a while until I can replace all the features in Obj-C.

The place where AppleScript really shines is in doing things in multiple applications.  Of course, all of the applications must be scriptable  but it's always nice to be able to do stuff in FileMaker and be able to transfer all the data over to another scriptable application like Mail.app or something.


OK, I went off on a couple of tangents.  So to sum it all up, I would recommend Obj-C for your project, and I'm sure there are many people here that would love to help you -- gplex, ksuther, JoeSpiros, etc.


----------



## bighairydog (May 1, 2002)

Cheers SimX - I'll keep an eye out for books on it.

Bernie     )


----------



## taewon (May 3, 2002)

good idea! (to port mine sweeper to os x)
i'm not a programming guru, but if u make it open source (e.g. on source forge) i'll help u...

just let me know...


----------



## bighairydog (May 4, 2002)

OK, cheers for your help guys - after a bit of rooting round the apple website I've settled on Java-Cocoa. That way I'll have more transferable skills, but can still use all the ObjC multimedia classes.

It also strikes me that all the languages I looked at are essentially just like scripting languages, just more complex. I always thought that real programming languages would be like INTERCAL, where the variables are really hard to get to grips with (only takes 2 data types, 16 bit and 32 bit). Take this quote from the INTERCAL Manual for example. 





> ...so the fastest way to assign the value '65536' to a variable would be
> 
> 
> 
> ...



As you can see, I had cause to be pleased when I saw that Java was so like the PHP I know and love...

I'll post the game when I get it together.

Bernie     )


----------



## googolplex (May 5, 2002)

Good choice with cocoa. If your wanting to get into it I'd suggest getting the book Cocoa Programming for Mac OS X by Aaron Hillegas. It is a very good book, and I'm learning form it right now.

Simx: you want to have a nice MUG of cocoa?


----------



## bighairydog (May 5, 2002)

Doesn't that deal with use of ObjC, not Java?

I've found it hard finding Java specific cocoa resources, because everybody assumes you'll be using ObjC for coding. There's a good tutorial on the apple developer site though.

Bernie     )


----------



## googolplex (May 5, 2002)

Ahh, you want to do cocoa with Java? I personally wouldn't recommed it, since its kind of a hack. Cocoa has a layer called the Java bridge that basically converts java code into objective-c. Also, cocoa is natively objective-c so it might be easier in the long run to do it with objective-c. But if you don't want to deal with objc go ahead! .


----------



## ksuther (May 5, 2002)

I don't recommend using Java in Cocoa. It's not nearly as powerful as Objective-C is, but slightly more than ASS 

A minesweeper game shouldn't be too hard to make, just have to subclass a view handle it's clicks and draw it and make a basic engine, blah blah blah blah blah 

You might want to pick up Aaron Hilegasses Cocoa book, but it's not necessary. cocoadev.com and cocoadevcentral.com are good ways to learn cocoa, especially cocoadevcentral for newbies.


----------



## bighairydog (May 5, 2002)

Yeah, I hear Java isn't as fast as compiled languages, but it has the advantage of portability. If you know Java then you can create web Applets and Applications that run on any platform; there's just more uses for Java. I might learn ObjC next though, because the sample code I've seen looks similar, so it shouldn't be hard.

Besides, I've played simple games written in ObjC, and they're disconcertingly fast - A bit of latency to user responses is essential for relaxed gaming ;o)

Bernie     )


----------



## googolplex (May 5, 2002)

Any java apps you create with cocoa will not be portable. They will be OS X only. If you create an app with just straight java and don't use any cocoa stuff it will be portable, but it wont be cocoa


----------



## simX (May 5, 2002)

> _Originally posted by googolplex _
> *Simx: you want to have a nice MUG of cocoa?  *



My NAME is *simX*.  Please respect MY capitalization. 

Anyway, YEAH, a nice MUG of cocoa SOUNDS good right NOW.


----------



## simX (May 5, 2002)

*sigh*  Sorry about this.. really tired and accidentally responded instead of editing.


----------



## macguy17 (May 5, 2002)

I'd like to see that game freewqrae... /me recalls losing many hours to that old game when he was a slave of the windows world.....


----------



## bighairydog (May 6, 2002)

> _Originally posted by googolplex _
> *Any java apps you create with cocoa will not be portable. They will be OS X only. If you create an app with just straight java and don't use any cocoa stuff it will be portable, but it wont be cocoa  *


True, but in the process of learning how to code Java-cocoa apps, I will learn how to make pure Java apps.

Also, what you said isn't strictly true - I assume it's possible to confine all calls to cocoa wrapper classes into a seperate class, and conditionally use that when the app is running on OSX, as opposed to native Java UI calls on other systems. That way might be a bit backwards, but at least you can let the non-enlightened use the app, allbeit without flashy cocoa interface.

Bernie     )


----------



## googolplex (May 6, 2002)

hey sImX 

bighairydog, do what you wish. Java is a good language and if your learning it so you know cocoa and pure java then thats cool. Tell us when you come up with something!


----------



## bighairydog (May 6, 2002)

> _Originally posted by macguy17 _
> *I'd like to see that game freewqrae... /me recalls losing many hours to that old game when he was a slave of the windows world..... *


Of course... I love freewqrae games as much as the next guy ;o) And you can guess what site's members will be the first to be offered it.

Bernie     )


----------

