Author Topic: Programming Code needed to make game?  (Read 9063 times)

0 Members and 1 Guest are viewing this topic.

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Programming Code needed to make game?
« on: September 17, 2009, 10:43:43 PM »
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:

C#
C
Java

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? :XD:

BTW...
www.en.wikipedia.org/wiki/Cave_Story
http://www.miraigamer.net/cavestory/

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: Programming Code needed to make game?
« Reply #1 on: September 17, 2009, 11:20:42 PM »
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.

Offline GuyPerfect

  • Posts: 363
    • View Profile
Re: Programming Code needed to make game?
« Reply #2 on: September 18, 2009, 04:55:31 AM »
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 collision detection. I've 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.

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: Programming Code needed to make game?
« Reply #3 on: September 18, 2009, 05:03:09 AM »
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.

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: Programming Code needed to make game?
« Reply #4 on: September 18, 2009, 05:12:54 AM »
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.

Online Simon

  • Administrator
  • Posts: 3876
    • View Profile
    • Lix
Re: Programming Code needed to make game?
« Reply #5 on: September 20, 2009, 12:13:40 PM »
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

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: Programming Code needed to make game?
« Reply #6 on: September 20, 2009, 06:13:31 PM »
My current experience?  Not too much.  Why?  Most tutorials you find with a google search are crap.

Online Simon

  • Administrator
  • Posts: 3876
    • View Profile
    • Lix
Re: Programming Code needed to make game?
« Reply #7 on: September 21, 2009, 01:37:58 AM »
That's fine. So which language are you going to play around with?

-- Simon

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: Programming Code needed to make game?
« Reply #8 on: September 21, 2009, 01:39:19 AM »
The ones listed in the topic's first post.

Offline Adam

  • Posts: 424
  • Just one more level....
    • View Profile
    • Lemmings Forums
Re: Programming Code needed to make game?
« Reply #9 on: September 21, 2009, 01:01:43 PM »
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.

Offline The Doctor

  • Posts: 301
  • Jason the Human
    • View Profile
    • zapzupnz.com
Re: Programming Code needed to make game?
« Reply #10 on: September 25, 2009, 12:17:06 PM »
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*!

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: Programming Code needed to make game?
« Reply #11 on: September 25, 2009, 08:38:05 PM »
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.

Offline The Doctor

  • Posts: 301
  • Jason the Human
    • View Profile
    • zapzupnz.com
Re: Programming Code needed to make game?
« Reply #12 on: September 26, 2009, 01:10:07 PM »
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*!

Offline Dullstar

  • Posts: 2092
    • View Profile
    • Leafwing Studios Website (EXTREMELY OUTDATED)
Re: Programming Code needed to make game?
« Reply #13 on: October 12, 2009, 04:10:00 AM »
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!

Offline GuyPerfect

  • Posts: 363
    • View Profile
Re: Programming Code needed to make game?
« Reply #14 on: October 12, 2009, 04:23:02 AM »
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.