Author Topic: How do you make games with coding???  (Read 10042 times)

0 Members and 1 Guest are viewing this topic.

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: How do you make games with coding???
« Reply #15 on: February 25, 2012, 11:29:51 am »
Did you watch the video? To do what you asked, you would just update everything that needs to be updated when your update method is called. Here's some pseudocode to demonstrate what I mean:

update:
    move ball based on travelling direction
    if ball collides with wall or paddle
        method to make ball bounce off of surface
    if ball has passed some paddle
        add point to winner
        reset ball location
    if user presses a key we will use (i.e. Up, Down, W or S)
        update player's paddle location
    update AI
draw:
    clear background
    draw scores
    draw walls
    draw ball

Basically after each draw method is done, the update method will be called, and when each update method is done the draw method will be called.

Offline runeazn

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +5/-3
    • View Profile
Re: How do you make games with coding???
« Reply #16 on: February 25, 2012, 11:29:53 am »
thats no explanation D:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: How do you make games with coding???
« Reply #17 on: February 25, 2012, 11:32:16 am »
Do you know what you should do? get a 84+ and learn programming in BASIC and then in Axe. I'm not rude, but that REALLY helps A LOT. In fact, w/o my 84 i would never have been programming stuffs.
I'm not a nerd but I pretend:

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: How do you make games with coding???
« Reply #18 on: February 25, 2012, 11:33:22 am »
OP, if you don't have much experience, I don't recommend you to try out coding games just yet. However, in the near future, try pygame, it's great for making games with Python. I don't recommend C# or XNA because it's not cross-platform :)

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: How do you make games with coding???
« Reply #19 on: February 25, 2012, 11:36:13 am »
If you're doing pong, you're going to want four variables for the ball: x, y, x velocity, and y velocity. To start the ball going to the lower right, we'd set the x vel. and y vel. both to 1. Then we'd increase x by x vel. and y by y vel. each loop iteration to make the ball move. To flip the direction of movement do
velocity variable *= -1
« Last Edit: February 25, 2012, 11:36:19 am by Spyro543 »

Offline runeazn

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +5/-3
    • View Profile
Re: How do you make games with coding???
« Reply #20 on: February 25, 2012, 11:47:48 am »
how do you make the bal move?
yes let it draw every frame but how do we let it add the x and y coordinates?

as the spot where the ball hits the uhh stick it will decide the movement the ball will make.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: How do you make games with coding???
« Reply #21 on: February 25, 2012, 11:49:11 am »
You define more variables. Just like 1->x and stuff. ITS EASY BRO.
Look up a python tutorial for dummys.
I'm not a nerd but I pretend:

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: How do you make games with coding???
« Reply #22 on: February 25, 2012, 11:58:29 am »
I'm going to go with aeTIos on this and say read a Python tutorial. A lot of games do basic math and updating, which are covered in tutorials.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: How do you make games with coding???
« Reply #23 on: February 25, 2012, 12:00:54 pm »
My experience:
90% of programming is saying "calculate x+24c+6-f*2(55y)" and stuff. Not a joke.
I'm not a nerd but I pretend:

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: How do you make games with coding???
« Reply #24 on: February 25, 2012, 12:00:59 pm »
I still dont get how you can make games with coding after getting a little taste of coding language python :P

Eck, this question sure is vague...

A nice analogy might be "I still don't understand how they predict the weather after using an iPhone app." :P

Here's a high level overview of how games work though:

  • The user executes the program by running it in some fashion
  • The program initializes itself (allocates memory, checks to make sure the levels are present, sets constants, etc...)
  • The program then begins executing. It will often go into a menu around this point, which will allow the user to select what level they want to play and other stuff.
  • The program loads all the data necessary then begins executing the game code.
  • The program enters what is referred to as a "big honkin' loop." This loop is where the entire game happens.
  • Inside the "big honkin' loop, many things occur. The first is sometimes that the world is generated and rendered onscreen.[/li
    • Then all of the stuff the player will interact with is rendered (such as enemies)
    • The player's controls are checked for inputs. If there are inputs, the world is adjusted accordingly. Otherwise, the game continues as if nothing happened (because that's exactly what happened).
    • When the player tells the game to quit/exit, the game breaks out of the loop and shuts down.

∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: How do you make games with coding???
« Reply #25 on: February 25, 2012, 12:03:33 pm »
My experience:
90% of programming is saying "calculate x+24c+6-f*2(55y)" and stuff. Not a joke.

Yes games also have a lot of complex math, but even games like Crysis have simple math in them.

I still dont get how you can make games with coding after getting a little taste of coding language python :P

Eck, this question sure is vague...

A nice analogy might be "I still don't understand how they predict the weather after using an iPhone app." :P

^ This. One does not simply know all the programming after a "little taste."

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: How do you make games with coding???
« Reply #26 on: February 25, 2012, 12:32:43 pm »
Games like Crysis are largely an exercise in "How simple can we make the code to do this?" I've used some of the published algorithms from games including Crysis before and it's amazing just how simple some of the things are. In crysis II, for example, a lot of the stuff they use are best described as hacks. Were you a bit disappointed when you saw that Deep Thought's fruit ninja used a bunch of static sprites to make the fruit "rotate?" Turns out, that's what Crysis does for some of its plant shading. Complete rubbish as far as true realism goes, but who can argue with the results? Being able to simplify things tremendously like that is part of the Art of Game Programming. It's also a very advanced topic in places :P

EDIT: I love Deep Thought's way of rotating the fruit, if it's not clear. Great job, Hal!
« Last Edit: February 25, 2012, 12:33:56 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: How do you make games with coding???
« Reply #27 on: February 25, 2012, 12:46:40 pm »
Personally I wasn't surprised when I saw it. That's exactly the way I would've done something like that. In fact, it is the way I do things. For animations I just use a bunch of sprites and loop them together based on the game's time. Plus I'd imagine that's the fastest way to do that kind of thing, especially with shading and in large games like Crysis. I always love finding out how things that seem complex are actually really simple. It all comes down to whether or not you're over-thinking something or not.

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: How do you make games with coding???
« Reply #28 on: February 25, 2012, 01:40:52 pm »
I know quite a bit of Python already: all of the basic built-in functions, how to do GUIs, and how to connect to the internet with it. However, I still don't have enough knowledge to make a decent game. It takes quite a lot of programming knowledge to make good graphical games.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: How do you make games with coding???
« Reply #29 on: February 25, 2012, 01:41:59 pm »
The program enters what is referred to as a "big honkin' loop." This loop is where the entire game happens.
Lol, people call it the big honkin' loop? :P