Programming Code needed to make game?

Started by Dullstar, September 17, 2009, 10:43:43 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Dullstar

I can't seem to find good tutorials online, so I'll just throw this one out there.

What's the coding needed to make a game (please explain the structure as well for me!)?  I am currently considering these three languages:

http://en.wikipedia.org/wiki/C_Sharp_(programming_language)" class="bbc_link" target="_blank">C#
http://en.wikipedia.org/wiki/C_(programming_language)" class="bbc_link" target="_blank">C
http://en.wikipedia.org/wiki/Java_(programming_language)" class="bbc_link" target="_blank">Java

http://en.wikipedia.org/wiki/C_(programming_language)#Absent_features" class="bbc_link" target="_blank">This fact about C kind of concerns me, but I don't know if it would have an effect on any of my projects...

Yeah, I'm a Wikipedia freak...  get over it...


Things I need to do...

I would like to make the game somewhat of a cross between "Cave Story" and Metroid Games...

Features from Cave Story:
Doors/Teleporters
Dialogue/Signs
Boss Health Bars

Features from Metroid:
Metroid has a different door system from Cave Story, so I do want Metroid-style doors as well.  However, of the doors that do not require any upgrades to get through, I shall use Cave Story's occasional Metroidish doors (imagine the Blue Doors in Super Metroid, minus the hatch).
Stackable upgrades?

Features from both:
Platformer
Doesn't Metroid have a shaking display during the Self Destruct sequences (in Super Metroid, at least)?  I KNOW Cave Story has this at its last area...
Enemies (DUH)
Upgrades, of course
Multiple Endings...


So, how overambitious is this sounding? http://www.lemmingsforums.com/Smileys/lemmings/XD.gif" alt=":XD:" title="XD" class="smiley" />

BTW...
http://www.en.wikipedia.org/wiki/Cave_Story" class="bbc_link" target="_blank">www.en.wikipedia.org/wiki/Cave_Story
http://www.miraigamer.net/cavestory/" class="bbc_link" target="_blank">http://www.miraigamer.net/cavestory/

Dullstar

Oh dear.  I forgot...  we could use a starting point to make things less complicated...

Let's see...  music programming can come later (note that we DO need support for any (or all) of these three formats:  .xm, .it, .mod).

Let's start with a basic platformer tutorial with the doors implemented as well.  That seems like a reasonable start.  Note that I only need to see one target language, not all three.  If I can gather enough information for any one of the three languages, I will use that one.

GuyPerfect

Unfortunately, computers aren't abstract enough to understand what it means when you say "do some platforming." You need to break absolutely everything down into individually representable steps that a computer can understand. In this case, a "platforming tutorial" isn't likely to exist because the topic even in its most general form is too complex to cover in a succinct manner.

As a developer, it will be your task to identify how you want your platforming to function, then to design a system and implement it. Older games like Super Mario Bros. use a simple block terrain setup, and newer games generally have geometric objects interacting with line segments or polygons.

A subset of the greater platforming concept, and probably the one you'll want to look into first, is http://en.wikipedia.org/wiki/Collision_detection" class="bbc_link" target="_blank">collision detection. I've http://www.perfectkiosk.net/Metroid/003.html" class="bbc_link" target="_blank">written an article for what I'm doing in my Metroid project, but it all still depends on how you want it to function in the first place.

Dullstar

If you can spare the time to look at it, I really like the terrain set up and the physics in Cave Story (which is a great game, btw, plus it's free).  I don't need anything TOO complicated with the terrain set up.  Probably will use blocks, as long as I can do some ramps angled like the ones in Lemmings 2.

Dullstar

OK.  Got a basic drawing of what the terrain might be like (I will do a lot of editing to it, though, later...).   If I do more complicated terrain, I'll probably make a system of invisible collision detection areas so things don't need to get too complicated.  Every angle in here is what we may see in the final game.  There may be slightly less sloped areas, but...  shouldn't be too difficult once we have these.  The staircase if probably off proportion.  Colours aren't final yet...  at all.

NOTE:  The dark green area is actually a little background.  And again the final game won't look so cruddy, I just was trying to use MS Paint to get the idea across.

Simon

What is your current experience with compiled programming (i.e. not scripting) languages?

If it's rather scarce: Pick any compiled (or to byte-code compiled) language, google on how to install a compiler for it, and play around. Write a program that reads a file and writes it somewhere else (Dullstar file copy deluxe v1.0), and write the guess-the-number game, and write tic-tac-toe with a computer opponent. Or similar text-based games.

See if you like it. If you do, look around for a graphics library for your chosen language, and program a demonstration with colored shapes. And then Pong, or Snake, or Minesweeper, or... anything you want, it's programming for a hobby after all.

Then learn another language, and how to think in it. You want to be able to decide on which tool (language) to use for which job.

-- Simon

Dullstar

My current experience?  Not too much.  Why?  Most tutorials you find with a google search are crap.

Simon

That's fine. So which language are you going to play around with?

-- Simon

Dullstar

The ones listed in the topic's first post.

Adam

Right, normally a user would go through the warning system if they made a post which broke the rules. However, the severity of this, combined with the fact that this user has signed up JUST to slate Dullstar leaves me with no choice but to request a ban. I don't have the priveleges to ban this user myself, but I have requested such action be taken.

Thank you to the people who reported this post. Dullstar, I would just ignore this troll... it's a shame there isn't an option on SMF called "Tachy goes to Coventry." - it would be perfect for ADmiral.

The Doctor

I suggest you use an object oriented language (C++ or C# or Java ... you know I'll steer you toward C# and Java but it's up to you), and then make a class diagram. For the purposes of what I'm going to talk about, we'll talk about C# and .NET/Mono.

In that way, you can draw a class diagram. Do an abstract one (not a strict UML one) to get the basic concepts down to a T. Decide what your classes will be.

Classes should reflect real world objects. When you try to think of classes for a game, imagine it as a board game, it helps. For example, you have a player. That's one class. You have the game field, that's another class. You have items, that's a class. You have enemies, you can have an enemy class. You'll also have the game as a whole, that's a class in itself.

When you do this, think about inheritance. Inheritance is when a class can be based off another class. Rather than have a billion classes for different kinds of items, perhaps you could have a single item class. Each different kind of item could inherit from the generic item class. Therefore, you re-use code efficiently.

Code-wise, when you instantiate a class (turn it into an object in memory) you can use constructors. Constructors plus inheritance equals code reuse if done properly.

You should learn about the object oriented programming paradigm as a concept rather than jump into programming without it. Learning an object oriented programming without learning object oriented concepts means you'll write a semi-procedural program which is event-based but not object oriented.

The reason I promote object oriented languages and concepts to you is that it can dramatically simplify the development process. Procedural programming has its advantages too, but for the purposes of your game, I think OOP would be simpler.
This Lemmings forum is simply *fabulous*!

ccexplore

While I agree that ADmiral's posts were incredibly rude, unhelpful and uncalled for, I do think that it could be helpful and more fun if Dullstar starts off not with a programming language, but something more along the lines of GameMaker etc.  There are still elements of programming involved, but such tools are much more directly geared for creating games, so I think it would be a perfect stepping stone for someone like Dullstar, being able to make some games and getting a sense of how programming works, before he moves on to a true general purpose programming language.

I've seen a whole bunch of beginners like Dullstar who hasn't done any programming but has been able to pull off a bunch of decent amateur games with tools like GameMaker, so it's definitely a proven route to go I think.

The only issue is that Dullstar only has Linux not Windows, and most of these game-making tools I think are only available in Windows rather than multi-platform.  Although some of them might work well enough with WINE though, you'll have to try and see.

As for tutorials, you'll never find a single tutorial that can cover "how do you make a game" because making a game is a complex undertaking no matter what.  Just like there's no hope of someone learning to write an essay if he still hasn't mastered the alphabet, basic vocabulary, and sentence structure, etc., tutorials can only help you cover the fundamentals of programming.  So I don't suggest Googling in that direction because you won't get very far.

The Doctor

A game making suite is indeed a good idea. However, that issue of Dullstar using Linux is a big point because Dullstar is looking to create games that are cross platform from the word go, rather than after tedious porting. Those game making suites lock you in to a specific platform nine times out of ten.

I think using something like GameMaker is a good idea for a prototype, but I still encourage Dullstar to learn programming concepts properly along side, so that in the future he can ... well ... tediously rewrite! Hehe.

I'm not sure what kinds of game making suites exist outside of the Windows world. The few I do know about still require some level of programming expertise (such as Unity player, which requires knowledge of Objective-C but runs of a few platforms).
This Lemmings forum is simply *fabulous*!

Dullstar

So far, of the ones I've tried, it appears the best one is C...  is there a way to get the object oriented part with the same (or at least similar) syntax to C?  C# just seems, well, harder to write in than C.  Or is it already object oriented?  Argh, what a great hour to be on on and off checking Wikipedia!

GuyPerfect

Object-oriented more or less just means that the elements you declare have code attached to them. So to declare something like "Object Q;" where Q is something like, oh, an apple-to-orange converter, you might also be able to say later "SomeVariable = Q.ConvertToOrange();"

When classes are not available for use like that, you simply need to write functions that take structs as one of their arguments instead. Declaring "Struct Q;" could later be used as "SomeVariable = ConvertToOrange(&Q);" and you're at the same spot as you are in the previous example.

For anything you're likely to be using classes for, you should easily be able to do the same thing using structs as arguments to the functions that would otherwise have been menthods of the classes. Unless you intend to delve into things like inheritence or abstraction, you won't benefit from using classes in the first place.

Personally, I dislike classes and object-oriented programming based on a matter of principle. Though it unarguably increases productivity when writing functional code quickly (such as would be the case in a business environment), it requires a considerable amount of processing overhead and unnecessary memory management when the program actually runs.

Remember: from the perspective of the CPU, there's no such thing as object-oriented programming. That chip simply takes one instruction at a time and processes it. You can do that with structs. You can't do that with classes. Structs have inherently higher performance.