Page 1 of 5

I made a game!

Posted: Sun Dec 15, 2013 7:36 am
by robly18
So I've been messing with python and the libtcod library, and recently finished an early version of something I've been working on, and I thought I might as well show you.
But what is it?
Everyone's favorite game, connect 4 !*


*Not to be confused with connect 4!, or connect 24


Here's a download link. It contains a bunch of requirements and a cnct4.exe, which is the main game, or if you want to read the source code it's within cnct4.py, with a few annotations.
Controls:
Left/right arrow keys to move
Down to drop puck
http://www.mediafire.com/view/yca1dlig7 ... ect4v1.rar
EDIT- Download this one instead. Fixed a bug.
http://www.mediafire.com/view/grwi7628b ... t4v1.1.rar

Let me know what you think! I already have a few planned features, such as automatic restarting, different cursors for each player, and even an AI!

Re: I made a game!

Posted: Mon Dec 16, 2013 1:04 am
by testtubegames
I'm afraid I've got a mac, so the .exe file won't work for me. Hopefully some of the others here will be able to take a look.

It sounds really exciting. Congratulations on having a game! Isn't it so cool to type a bunch of code -- and then see it *do* something on the screen? I got hooked after my first little prototype.

Re: I made a game!

Posted: Mon Dec 16, 2013 9:37 am
by robly18
Ah, darn.
If you have python though, you could probably run the .py file. Try that I guess.

Re: I made a game!

Posted: Mon Dec 16, 2013 1:17 pm
by testtubegames
Yeah, it gave me some tracebacks (so it's accessing the file) -- but no display and no game. I'll try it again when I visit family for the holidays next week -- I think there's a pc there I could download it on.

...and some people I could challenge!

Re: I made a game!

Posted: Mon Dec 16, 2013 1:55 pm
by robly18
As a side note, in case this is what you're doing, this is python 2.7, not 3.

Re: I made a game!

Posted: Sun Dec 22, 2013 9:30 am
by robly18
Woo! Guess what I made now!

Spoiler alert: it involves plagrism.


That's right, a gravity simulator!
Sue me.
Or not, because you're benevolent... Right?

Anyway, here is a link to an exe.
http://www.mediafire.com/download/wlrja ... 8/gsim.rar
And Andy and anyone else who uses a mac, I looked up py2app but couldn't figure out how to get it to work. So with it comes source code, to be used with python 2.7. Put contents in folder, run gsim.py and enjoy my contraption.
Bonus: modify the planets and such if you can figure out how.
Bonus2: much smaller
http://www.mediafire.com/download/52bh6 ... source.rar

To do: make planets easier to modify, add panning of camera, objects with negligible mass... I oughtta give you credit Andy, you sure are a great person to plagrize from ;)
Oh yeah, also, this is an overclocked version. Due to rounding errors I had to decrease the steps and make it run at 80 frames per second.

Enjoy your non-detailed-at-all solar systems thing.

As a side note, worth noting that, like the connect 4 game, it was coded entirely by myself. Hardest part was to code the force part thing. Oh boy, was it hard.
Lotta algebra involved.

Re: I made a game!

Posted: Sun Dec 22, 2013 11:11 am
by A Random Player
robly18 wrote:As a side note, worth noting that, like the connect 4 game, it was coded entirely by myself. Hardest part was to code the force part thing. Oh boy, was it hard.
Lotta algebra involved.
The forces were hard? I always thought forces were the easiest part of making a gravsim:
Pseudocode for one massive body (like satellites):

Code: Select all

For each object:
 Move it based on position and velocity (x+=Δt*xv, y+=Δt*yv)
 Update velocity based on new position (dist=sqrt(x^2+y^2), xv+=-Δt*x/d^3, yv+=-Δt*y/d^3)
 #Or do it the other way around
For multiple objects:

Code: Select all

For each object (1):
 For each object (2):
  Update the velocity based on the pair we are looking at (dist=sqrt((x2-x1)^2+(y2-y1)^2), xv1+=Δt*(x2-x1)/d^3, yv+=Δt*(y2-y1)/d^3)
For each object
 Update position based on velocity (x+=Δt*xv, y+=Δt*yv)

Re: I made a game!

Posted: Sun Dec 22, 2013 12:17 pm
by robly18
Huh. What I did was use the f = G*m1*m2/r^2 and change it to take into account x and y

Re: I made a game!

Posted: Mon Dec 30, 2013 11:38 pm
by exfret
Remind me to try it out...

Sorry that it's been two weeks...

Re: I made a game!

Posted: Tue Dec 31, 2013 6:56 pm
by robly18
Update: new version is out!

http://www.mediafire.com/download/zk5n6 ... imv0.1.rar
I added panning of the camera using the arrow keys. This consequently led to me having to redo the trails, so expect some lag. On the bright side, I learned a bunch about optimization so that's a good thing.
Source included in the form of gsim.py