My First Computer Program!

giacomopoppigiacomopoppi Member, PRO Posts: 914
edited November -1 in Introductions
Hi guys! The past couple of days i have been learning C language and i have just finished my first computer program. well... really it is just a console program but i think i consider it a computer program... right?

Anyway, it is a simple game and the aim is to guess a number between 1 nd 1000 with the least tries possible. if you want to try it out it can be downloaded here:
http://www.2shared.com/file/2OLq3q1n/Guess_The_Number.html

I am only 14 so i think it is quite good!! :D

P.S. i know this post isnt related to GS it was just something i would like to share :)

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    Nice work :) gotta take baby steps!
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    Yep... i need some advice from an expert.....
    do you think i should finish learning properly c language or pass directly to Obj-C (or another object orientated language)?
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Haha don't ask me! Just starting learning, myself. I've started straight with objective C but C is probably better if you want to code for other systems too.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Everything that you are learning is built off of C,
    so it is a good idea to have a fairly solid understanding of it.

    Objective-C is built on top of C. It is what is known as a "superset".
    Cocoa is is a superset of Objective-C.
    Cocoa Touch is a subset of Cocoa.

    Then there's C++, another object-oriented superset of C.

    It can all be pretty daunting!

    I think what you are doing with this little game demo is great!
    I think that is the best way to learn a new language.

    I would keep on making little demos.
    And eventually try to link a few together.

    Learn these little building blocks.
    Eventually you will be able to put things together into larger projects.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Hey Joe, I've started with objective c. Would it be safe to say that once I have decent grasp of it, c itself will be pretty simple to understand?
  • expired_012expired_012 Member Posts: 1,802
    @firemaplegames, you seem very experienced with coding. Do you have any projects in xcode that you may submit?
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    @firemaplegames, should i continue making these projects in C or Obj-C? i have just started to learn Obj-C and i notice that it is very similar to c.

    also:
    :S i have never understood pointers tho.... i mean... why do we need them?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    @polygame: C is actually a fairly small language. Everything is built on top of it.
    It has no standard routines for graphics, for example.

    Making a full game with GameSalad and submitting it to the App Store, and then starting with C and making "Hello World", can certainly seem a little backwards and be frustrating!

    You said that you are following along with a book. I think that is great. I think it is fine to start anywhere that interests you. Get some understanding, then delve deeper.

    @arton: I actually can't program C or C++ or Obj-C. I understand the basics, and I have 200$ of books sitting here, but I actually haven't made anything yet. Just little stuff here and there.

    I am generally what you would call a "scripter". I have been writing Actionscript in Flash for ten years now. I LOVE scripting.

    Everything you do in GameSalad is considered scripting. It doesn't really matter if you type it or use drop-down menus.

    It's all in how you look at it of course, but generally a programmer would create a program like GameSalad, and a scripter would make something WITH a program like GameSalad.

    Flash is very similar.

    In Flash I have a thing called a movieclip. In GameSalad I have a thing called an Actor.

    I (and everybody else who uses gamesalad) scripts the game logic. We script the Actor's behaviors. How they move. What happens if I click on them, what if they collide with another Actor? etc. etc.

    That is all called scripting.

    How the Actor actually interprets the scripts that I write, how it manages memory, displays images, etc., How the Actor actually works, its guts - that is what programming is.

    I love game design, art, and stuff like that. I do not care about frame buffers, blitting pixels, memory management, garbage collection, etc. etc. I HATE that stuff. My eyes glaze over when I think about it.

    I just want to work on the gameplay!

    It all comes down to what you enjoy.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    It's rude to point! Haha
  • iDeveloperziDeveloperz Member Posts: 1,169
    lol, i'm really struggling to learn it.

    It's just really hard to remember everything :S
  • firemaplegamesfiremaplegames Member Posts: 3,211
    @giacomo: pointers are generally a tough concept for beginning programmers to comprehend. They point to specific places in memory. Instead of constantly looking up where something is in memory, which is slow, you can access a pointer to that memory location, which is much faster.
    It acts sort of like a bookmark.

    But that is a shabby explanation. A programmer could probably give you a better answer.

    Here is the wikipedia definition:
    http://en.wikipedia.org/wiki/Pointer_(computing)

    Those first couple of paragraphs are a perfect example of why I don't like programming!
    (and that illustration is no help!)

    I am much more interested if an Actor's rotation is correct, or if I'm using the correct trig calculation, or if an animation looks better at 12 frames per second vs. 13 frames per second...

    I simply do not care if its memory allocation is correct!
  • StusAppsStusApps Member, PRO Posts: 1,352
    I highly recommend this site:

    http://mycodeteacher.com/

    It is objective c for iphone and very friendly. I did this for 2 months prior to gamesalad and made half a childrens story book app (in retrospect the app is really crap).

    The whole of mycodeteacher courses can be accessed for only $10, which is pretty good. You can download the source code to each lesson for xcode and they always try to teach you to actually make something in each lesson.

    You have to repeat lessons over and over again until you understand them properly, no way you can watch them once and fully understand it. I got about a quarter of the way through in 2 months (with some actual understanding, I could have watched all the lessons in a couple of days). For me I gave up as I know I am quite results orientated, my results looked super crappy (to be expected) and I found it was like learning a foreign language in that I kept forgetting stuff from one day to the next. If I were to move on from gamesalad I would definitely not try to learn objective c.

    My recommendation is that if you want to learn to program then maybe look at learning to use cocos2d for iphone, it is a game engine for 2d games that actually uses objective c instead of a scripting language. Fine to move on to after objective c, but why not learn it in connection with cocos2d. Personally I don't want to learn obj c that much and would look at learning corona or itorque 2d scripting.
  • expired_012expired_012 Member Posts: 1,802
    firemaplegames said:
    @polygame: C is actually a fairly small language. Everything is built on top of it.
    It has no standard routines for graphics, for example.

    Making a full game with GameSalad and submitting it to the App Store, and then starting with C and making "Hello World", can certainly seem a little backwards and be frustrating!

    You said that you are following along with a book. I think that is great. I think it is fine to start anywhere that interests you. Get some understanding, then delve deeper.

    @arton: I actually can't program C or C++ or Obj-C. I understand the basics, and I have 200$ of books sitting here, but I actually haven't made anything yet. Just little stuff here and there.

    I am generally what you would call a "scripter". I have been writing Actionscript in Flash for ten years now. I LOVE scripting.

    Everything you do in GameSalad is considered scripting. It doesn't really matter if you type it or use drop-down menus.

    It's all in how you look at it of course, but generally a programmer would create a program like GameSalad, and a scripter would make something WITH a program like GameSalad.

    Flash is very similar.

    In Flash I have a thing called a movieclip. In GameSalad I have a thing called an Actor.

    I (and everybody else who uses gamesalad) scripts the game logic. We script the Actor's behaviors. How they move. What happens if I click on them, what if they collide with another Actor? etc. etc.

    That is all called scripting.

    How the Actor actually interprets the scripts that I write, how it manages memory, displays images, etc., How the Actor actually works, its guts - that is what programming is.

    I love game design, art, and stuff like that. I do not care about frame buffers, blitting pixels, memory management, garbage collection, etc. etc. I HATE that stuff. My eyes glaze over when I think about it.

    I just want to work on the gameplay!

    It all comes down to what you enjoy.

    Thanks for that! Very ineresting info right there! Do you do game development, or "scripting" as you call it for a living?
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    @firemaplegames i had already understood that it points to a spicific path in the memory... but i dont find the use in it?? cant you use any variable instead? and not have to use the "*" and the "&"?
    MAYBE i have managed to understand it a bit better with your explanation Joe.... so what you need them for... is to save allocating space in the memory? or to have faster access to a variable?
    The thing i dont understand is why on earth we have to point to the MEMORY of a computer?? why would i want a number like 1135476bit to be remembered?

    I really dont like pointers.... could a programmer code without them???
  • Rob2Rob2 Member Posts: 2,402
    not in C based languages... they account for much of the speed and power

    http://publications.gbdirect.co.uk/c_book/chapter5/pointers.html
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I do. I am a Flash programmer at my day job. I also make Mac and PC games for the Desktop (also using Flash) and now I am making iPhone games with GameSalad.

    My games actually make more money than my regular job, which is nice!

    I agree with what StusApps says above. Cocos2D is a nice collection of Cocoa Touch game programming libraries, written in Obj-C.

    It's a nice middle ground between writing something from scratch or using something like GameSalad.

    Games all basically need the same stuff. You need Scenes. You need Actors or sprites, You need animation. Sound. Collision. Physics. Logic. etc. etc.

    You can either create all that yourself, or you can use libraries of code that other people have written.

    It depends how much control you want.

    In the old days (15 years ago!) you didn't have a choice. If you wanted something, you had to create it from scratch.

    Now, with things like Flash, GameSalad, GameMaker, Unity, Corona, Torque, Director, RunRev, etc. etc. you are able to use high level scripting languages to create software. And computers and devices keep getting faster and faster.

    These programs eliminate the barriers of entry for creative people. I think it is so awesome.
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    I'm just giving up right now :S too much work done already today.
    my brain is hurting.
    stupid pointers....
    Thanks for your help anyway Rob2 and Joe :)

    @StusApps Yeah, that site could help eventually when i start to try out to program iphone apps, but right now i need to concentrate on the basics... thanks anyway :)

    I strongly advise these books for learning:
    http://www.amazon.com/Learn-C-Mac-Dave-Mark/dp/1430218096 - C language
    http://www.amazon.com/Learn-Objective-ndash-Mac/dp/1430218150 - Obj-C
    then there are other books of the series which teach different stuff (there is one also for programming for iphones and ipads.)

    if anyone wants these books just ask and i will upload them (i have the ebooks). i am learning from these, they are for the "real beginners" :P
  • firemaplegamesfiremaplegames Member Posts: 3,211
    @giacomo: Programming is all about the memory of the computer. Accessing the RAM addresses. Making sure bits are moving around properly in the registers. Computers are just based on 1s and 0s after all.

    Personally I don't want to know about that stuff. I don't enjoy it as much as making the game logic.

    I depend on people like Gendai to take care of that stuff for me. Because of that I am at their mercy. If the memory is leaking somewhere I cannot fix it. I have to wait for them.

    On the other hand, I was able to make Danger Cats! in eleven days...
  • quantumsheepquantumsheep Member Posts: 8,188
    Joe, I have to agree with pretty much everything you've said in this thread! :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • A3MGA3MG Member Posts: 152
    Good stuff Joe.

    I started in 95 as a Lingo Programmer (Macromedia Director) and love scripting as well.
  • jessicaleahyjessicaleahy Member Posts: 144
    Hi giacomopoppi,

    Thanks for the link. It was fun.

    Jessica Leahy
    http://CollectWealth.ws
Sign In or Register to comment.