My own Prince of Persia... - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Design (/forum-5.html)
+--- Thread: My own Prince of Persia... (/thread-3582.html)
Pages: 1 2
My own Prince of Persia... - TBeezee - Jan 5, 2007 04:15 PM
Here goes for my first post. I have browsed this forum quite extensively and found the wealth of information to be impressive as well as a little bit daunting. In any case, I hold you guys in high regard as esteemed programmers and I am well aware that my ambitions might come across as sounding naive. Let me just quickly state that while I am admittedly looking for the easiest way to achieve my goals, I am willing to put in the necessary work, if you guys would be so kind as to point me in the right direction.
OK. Here is my goal: I want to make a 2d sprite based platformer/sidescroller in the vein of Prince of Persia/Flashback.
I'll just bite the bullet and go ahead and say it: I have next to no programming experience...
For some reason I am keen to use the following: XCode with C++, SDL and OpenGL, but since I have just barely started with these tools, I think I can easily make the transition into any language that you guys recommend.
To better articulate why I thought the above would be good is because I have strong reservations about commercial engines which seem to come and go. I do not feel that they would give me the flexibility I would like if I was at some point later on (when I hopefully become a great programmer ) to decide that I wanted to add more features to my game. The same could be said about my regard for the simplar languages like TNT Basic and Flash. While I think all of these would no doubt give me some satisfaction in quickly getting something on the screen, I guess that they would only leave me ultimately dissatisfied and wanting to achieve more, i.e. the image of the game that I have in my head.
I figure it's like building a house. Sure I could have shelter quickly if I stacked some boxes on top of each other, but I figured that if I was to use real bricks, even though it might take longer and be harder to do, I would be happy with the fact that I knew I was working on something that would eventually realise my ideas. I am happy to take this on as a long-term project.
I had desperately been searching for some source code which I could use in Xcode that resembles a platformer. (I had even hoped that somebody had made an Xcode version of Flashback or Prince of Persia... maybe that's naive?) I figured that I could learn a lot from playing with that code so that as I learned more, I would eventually bee able to edit the more complicated aspects that make a game unique.
If no complete xcode platformer source code exists, could you please tell me the steps I need to take to achieve a 2d sprite based Prince of Persia of my own?
My own Prince of Persia... - Leisure Suit Lurie - Jan 5, 2007 04:33 PM
The art will be more intensive than the coding, IMHO. The original PoP was rotoscoped, I believe (as was Flashback and Out of This World.) I suppose you could videotape yourself and make sprites by tracing over the video.
As for the coding end of it, take a gander at these.
If you weren't dead set on C++, I suspect you could make something like Prince of Persia with Power Game Factory.
My own Prince of Persia... - maximile - Jan 6, 2007 05:13 AM
Sounds like a good project. I think you were right to choose to use OpenGL rather than SDL's 2D graphics; you'll find that that makes life much easier.
The thing is, SDL and OpenGL make it almost as easy as TNT to get something on the screen. It works perfectly with Xcode; just install the SDL templates and you're ready to go. You sound like you want to make it work, so I don't think the programming will be the hardest part.
My own Prince of Persia... - TBeezee - Feb 2, 2007 11:15 AM
Hello! Thank you all for your helpful advice. I apologise for my slow response.
The art is actually one thing that I am confident about! I really enjoy making sprites and I have already made a lot of progress in this department. This dream project of mine to create a Prince of Persia-esque game has been stewing in my head since I played the original on my dad's LCIII now a number of years back; and it has been one that has been so far met with the thoughtful development of sheets and sheets of my own sprites and tiles.
I say thoughtful because I developed my sprites from what I think is a programmer's point of view, i.e. with consideration for the way in which they will be used in code, for example, the necessity to have a standing frame, starting to run set and then running loop that could be repeated until the direction key is depressed upon which the stopping from running to standing set will play (to give quite a basic example). It is definitely a big task and one which will no doubt present me with more, unexpected challenges as I begin to make my own game, but do I think I have a solid understanding of what needs to be done as well as the capability to do it.
As for Power Game Factory, I did take a look at it and well, while I am not set on anything yet, I am sure that this will present me with some hindrances in the longrun. It's difficult to explain how a model which offers so much can be limiting, but I hope you understand what I mean. I think that as I hopefully become an able programmer I would be much freer to work within a structure I had developed myself than one which was made already - not to mention the greater satisfaction I would get if I do make my own engine. I will definitely keep Power Game Factory in mind though as I am sure it can be educational in a lot of ways as to what considerations are needed for example in making a similar project to the one I am interested in.
So I am set on learning to code!! - but within what language exactly?! The following options seem to be the ones in which I am heading...
â€¢ C++ (SDL?) - using and building upon the jnrdev links provided by Leisure Suite Lurie
â€¢ Open GL + SDL
I have downloaded the jnrdev1 example source code but have so far been unsuccessful in getting this to build in Xcode. I have created a new SDL project, dragged the gfx and maps folders to the project folder and dragged-added the gfx.cpp, gfx.h and jnrdev # 1.cpp to the "Other Sources" folder within the Xcode app, but I get the following errors when I try and build:
running @ 640x480 32bpp (done)
loading sprite gfx/t1.bmp ...
ERROR: Couldn't load gfx/t1.bmp: Couldn't open gfx/t1.bmp
loading sprite gfx/t2.bmp ...
ERROR: Couldn't load gfx/t2.bmp: Couldn't open gfx/t2.bmp
loading sprite gfx/t3.bmp ...
ERROR: Couldn't load gfx/t3.bmp: Couldn't open gfx/t3.bmp
loading sprite gfx/left.bmp ...
Any help with this would be really appreciated.
To be honest though, I am more interested in getting into open GL because I have heard it is preferable to SDL alone because it is faster, and as Maximile says, makes life easier. Yet, it is 3d based, am I correct?
Would this mean that to make a 2d platformer, I would need to load sprites onto the surface of a polygon and view it from a fixed camera, in effect creating pseudo 2d? I don't have a problem with that by the way, but I am not not sure what resources I would need to get started learning how to do this. If I am completely off track and OpenGL can be used to make normal 2d based games, then I would probably prefer to do that! In any case, I would really appreciate if someone could point me in the right direction to loading sets of sprites in OpenGL and additionally developing that into a game. Good books would be great, perhaps even better would be internet sites with source code if they are available.
Thanks again for all your help.
My own Prince of Persia... - unknown - Feb 2, 2007 11:21 AM
Maybe OpenGL & GLUT or SDL and a programming language other than C or C++.
My own Prince of Persia... - OneSadCookie - Feb 2, 2007 02:03 PM
You seem to be confused.
C++ is a programming language.
OpenGL and SDL are "APIs", sets of functions provided to you. Both can be used from a large number of different programming languages.
OpenGL is a general-purpose graphics API. You can use it for either 2D or 3D (2D just being a special case of 3D). On Mac OS X, OpenGL is by far the fastest way to draw graphics, and is therefore recommended for all games.
SDL is a simple cross-platform way to get a window and input. It works together with OpenGL (though it also has its own slow non-OpenGL graphics API).
I recommend you read all the other "I want to start programming" threads on these forums. There are a *lot* of them, and all contain good ( conflicting ) advice.
My own Prince of Persia... - maximile - Feb 2, 2007 02:28 PM
First of all, I bet that if you put the gfx folder next to the built application (in the build/debug or build/release folder) those errors would go away.
And you don't need to render to a texture to make OpenGL do 2D. Do a search for glOrtho2D(), that should set you in the right direction.
Edit: Oh, and I'd recommend plain C and SDL. For no good reason, really, but I find it nice and simple and easy.
My own Prince of Persia... - TBeezee - Feb 2, 2007 07:03 PM
Thanks all for the comments. Ok. So I want to learn OpenGL and some programming language in which to implement these functions in order to make a prince of persia-esque 2d game engine in Xcode.
I had leaned towards C++ because I was attracted by its power and recently purchased the great book "C++ primer plus". I appreciate the suggestion to go with C if it is simplar though Maximile - it's still early days for me, so I can be swayed!
Are there any 2d sprite platformer engines using Open GL that can build in Xcode that somebody could direct me to? I would be most, most appreciative.
By the way, regarding the jnrdev1 example code, I have put the gfx folder in the build/debug folder and the errors have dissappeared! However, I am still left with a black run screen and spinning rainbow wheel with no graphics! Any other ideas would be much appreciated.
My own Prince of Persia... - TBeezee - Mar 22, 2008 06:51 PM
Hello again! It's been a long time... but I have not lost interest in this topic. I am still chugging away on the graphics side of things and I am feeling that I would really like to get into coding! - as you may have guessed, I have not started that yet...
So, I apologize for my lack of understanding before, but I think I can say the direction I want to take in coding has become a little bit more solid now.
To put it simply, I would like to take advantage of the OpenGL API to produce this 2d game. I haven't yet decided what language I am going to code in... I am still leaning towards C++ because I shelled out for that book you know and I have started learning it already.
Anyway, now for my questions (sorry):
1) are the calls for APIs such as OpenGL the same irrespective of the coding language employed?
2) Will I need to learn Cocoa and/or Carbon? (I may be off-track -again- but for some reason I thought that these APIs are necessary to produce software that implements features of and/or runs on the Mac OS X)
3) Besides Nehe's tutorials are there any resources that you guys particularly recommend (websites, books, open source code) for OpenGL programming? Anything that is particularly geared towards 2d stuff is in my case the most useful... I have found that unsuprisingly, a lot of stuff dives straight into 3d. A golden egg for me would be source code for a 2d game using OpenGL API! would I be fortunate enough to find anything like that anywhere??
Thanks so much for your help!! Let's continue to program for the mac!!!
My own Prince of Persia... - OneSadCookie - Mar 22, 2008 11:36 PM
1) No. But a very large number of APIs you use (such as OpenGL) are C APIs, and these are usable directly from C, C++ and Objective C.
2) No. You could use something like SDL (a cross-platform window and event library for games) instead. The Mac version of SDL is itself written in Cocoa. If you're Mac-only, you should probably just use Cocoa. Carbon is all but dead.
My own Prince of Persia... - TBeezee - Mar 24, 2008 06:26 AM
Thank you very much for your answers. I am sure my questions are rudimentary for you but believe me, (in my case) the time you took to clear them up saves me a lot of scouring and fretting, so I am most appreciative!!
OK please let me know if I am off base - in a nutshell the way my project should be going to take shape is as follows: C++ for the coding, SDL calls for simple tasks (drawing windows etc) OpenGL calls for dealing with the rest of the graphics. Does it sound good?
By the way, do OpenGL calls exist for the simplar tasks as well?
If you or anyone could point me in the best direction to resources for getting started with
By the way, I think those jnrdev codes that provided by LeisureSuiteLurie are excellent I just wonder if you have come across or could even better recommend a more thorough and polished tutorial for making 2d (esp. platformer) games on the mac. Books, websites, anything! You know, I am especially searching for info coding in C++ and using OpenGL calls. I have spent hours searching myself and dug up some stuff, but I would really value the opinion of experienced mac programmers like you.
Some issues I hope to deal with are: assigning keyframes to a set of sprites (for example during the set of say 8 sprites for throwing a punch, assigning only sprite number 5 - where we assume the arm is fully extended - the potential of causing damage etc.) setting up masks of sprites for appropriate determination of transparent parts and collision detection.
My own Prince of Persia... - OneSadCookie - Mar 24, 2008 01:47 PM
TBeezee Wrote:OK please let me know if I am off base - in a nutshell the way my project should be going to take shape is as follows: C++ for the coding, SDL calls for simple tasks (drawing windows etc) OpenGL calls for dealing with the rest of the graphics. Does it sound good?
My own Prince of Persia... - gatti - Mar 24, 2008 06:18 PM
From the perspective of art:
In respect to the amount of character animation that a game like Prince of Persia may call, it might be beneficial to look into a 3D application called Poser. It has many pre-created models and animations. In addition, (I think) it also allows user-importable models and animation movements. You could render out the animation as still frames with alpha channels. You can then use the exported frames as place-holders for the characters until you get around to really designing the characters within the game.
My own Prince of Persia... - TBeezee - Mar 25, 2008 01:32 AM
OneSadCookie - ah, that is a relief! haha Now the plan is in place I will get moving then. Thanks very much.
Gatti - Thank you for your advice. Actually, I have heard of Poser and played with the demo a little before. I appreciate it as a valuable tool and at one point seriously considered using it to help me with character animation. In the end however, I decided against it. Although I am hoping to achieve smooth animation that is realistic in terms of movement in my game, I think my sprites are a little bit more cartoonish than real in their appearance and (although time-consuming to create under any circumstances) would not be significantly easier to produce with Poser. In addition, (and I am sorry if I wasn't clear before) I have already got a lot of sprites drawn in the traditional sense - albeit digitally - in the betaware called Pixen; and I am quite happy with the results.
Does anyone have any recommended books/tutorials/links that are particularly geared towards coding a 2d platformer in C++? (Hopefully utilizing OpenGL calls as well!)
My own Prince of Persia... - stevejohnson - Mar 25, 2008 04:23 AM
I doubt there are any. Your query is far too specific. If you want to learn OpenGL, go here.
Also, beware Pixen. It is VERY crashy on newer machines.