A few initial questions about my first game (2D)

Nibbie
Posts: 2
Joined: 2009.07
Post: #1
Firstly - hello!

Found this forum through the multitude of helpful responses indexed by Google.

By way of introduction: I'm a formally trained (i.e degree in computing) programmer, with 10 years coding experience, mostly in Java (but lots of bits of other stuff, to varying degrees), and mostly financial applications. So I'm a newbie both in the sense of Objective-C and games programming. Been playing around with the SDK a bit, and finding Obj-C intuitive enough.

I am now embarking on my first game, and first iphone app (hey, I do enough 'serious' programming in my day job!).


Very brief description of the game:

1) 2 player abstract boardgame (bit like a cross between Go and Chess). One player is green, the other red
2) There are hexagonal pieces on the nodes of a hexagonal/isometric lattice (6 nodes to a side). The pieces can move from each node to the other along any of the six connecting lines.
3) Aim is to surround your opponent's centre piece with your 'strike' pieces.

So, I quite quickly got something working with Cocos2D, just to get a feel for how the board/pieces might look, and how one might control the pieces. It's just one 'Menu' scene, with a 'Start Game' option, which transitions to a 'Game' scene, with a PNG of the board, and 26 pieces placed on the board, and 'touch' enabled. Zero logic implemented (you can move the pieces anywhere, not just the node)



So some questions:

1) I want to get the game logic sorted completely separately from the interface; the primary reason being it makes no sense to fire up the simluator every time I tweak the game logic. The game is simple enough that I could easily represent the board state in ASCII, and issue simple 'move a,b to x,y' commands. Normally in the Java world I'd do this by just writing what's essentially a console based app. My first thought it to just use one of the non-iphone Xcode templates - but my worry there is I might end up using some Mac-only part of the Obj-C libraries. How do you guys manage this? I know you can do unit tests with the iphone, which I will defintiely do, but it wouldn't be a sufficient replacement for console-based development.

2) With the above separation in mind - would it also then make sense to do the game core in something a little more portable, like C++, and just leave the visual stuff in Obj-C? Both still have a bit of a learning curve for me, but C++ is more prevalent generally.

3) Given that the pieces/board are abstract (simple hexagons), they are easily described as vectors. In my initial tests, I actually created the pieces in a vector editor, then generated a .png. But I can see from the Quarz framework sample code from Apple that it's pretty easy to generate this sort of shapes. My worry is that it won't be possible to get the smooth anti-aliased effect you could get by using bitmaps. What would you recommend? Has anyone written an SVG XML file to Quartz converter? Smile I can't decided in this case whether Cocos2D would be overkill? I can see the potential, if I have time, to have essentially 3D effects (the hexagonal pieces might, for instance, be made to rise above the board and turn, catching the light, before moving back down to their destination) - would it therefore make more sense to start from scratch with OpenGL ES? Also, to do the higlighting, would you just super-impose some alpha-belnded circle, or can you think of some other method?

4) Because the board is quite large, to fit it on the screen the pieces end up being about 30 pixels. This actually turns out to be large enough to accurately drag the pieces around, but small enough to be completely obscrued by one's finger. For that reason, I'm considering instead having the user tap once to highlight a piece, then tap a second time for the destination. I'd then like the piece to animate in a smooth speed up/slow down way. If there's a piece already in the destination, that piece should also simultaneously swap places. A further option for beginner player would be to highlight valid move destinations. What would be your methods/frameworks/libraries of choice for these kind of animations?

Sorry, all a bit rambling. I'll stop (for now!)

Thanks

Marcos
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
Hello!

marcosscriven Wrote:1) I want to get the game logic sorted completely separately from the interface; the primary reason being it makes no sense to fire up the simluator every time I tweak the game logic. The game is simple enough that I could easily represent the board state in ASCII, and issue simple 'move a,b to x,y' commands. Normally in the Java world I'd do this by just writing what's essentially a console based app. My first thought it to just use one of the non-iphone Xcode templates - but my worry there is I might end up using some Mac-only part of the Obj-C libraries. How do you guys manage this? I know you can do unit tests with the iphone, which I will defintiely do, but it wouldn't be a sufficient replacement for console-based development.

2) With the above separation in mind - would it also then make sense to do the game core in something a little more portable, like C++, and just leave the visual stuff in Obj-C? Both still have a bit of a learning curve for me, but C++ is more prevalent generally.

Yes. I think the second question basically answers the first; if you implement the game core in pure portable code, you can just compile for the Mac for testing, then port to the phone to add the actual UI layer. Sounds like a perfectly sane approach to me.

I'll let other forum members chime in on the other questions...
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2009.07
Post: #3
Thanks

Actually found this link which helps to answer some of my questions too:

https://developer.apple.com/iphone/prere...index.html

Re using a command line xcode template - which template should I use? 'CoreFoundation' sounds about right...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Questions Using Source Code and Drag & Drop Game Makers Thunder_Strike 2 1,747 Jul 12, 2013 07:59 AM
Last Post: Thunder_Strike
  Basic Questions for a Word Game avidgamer101 4 4,497 May 19, 2012 07:26 PM
Last Post: MattDiamond
  What data format for a quiz game with nearly 10,000 questions? monteboyd 2 4,373 Dec 23, 2010 02:56 PM
Last Post: monteboyd
  SQLiteBooks example and initial database Toontingy 3 4,515 Jul 16, 2009 02:56 PM
Last Post: Toontingy
  Game Programming Questions miigman 11 6,688 May 21, 2009 11:24 AM
Last Post: MikeD