I made a game!

A spot for all things TestTube
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

I made a game!

Post 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!
Convincing people that 0.9999... = 1 since 2012
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: I made a game!

Post 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.
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: I made a game!

Post by robly18 »

Ah, darn.
If you have python though, you could probably run the .py file. Try that I guess.
Convincing people that 0.9999... = 1 since 2012
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: I made a game!

Post 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!
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: I made a game!

Post by robly18 »

As a side note, in case this is what you're doing, this is python 2.7, not 3.
Convincing people that 0.9999... = 1 since 2012
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: I made a game!

Post 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.
Convincing people that 0.9999... = 1 since 2012
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: I made a game!

Post 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)
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: I made a game!

Post 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
Convincing people that 0.9999... = 1 since 2012
exfret
Posts: 585
Joined: Sun Jul 28, 2013 8:40 pm

Re: I made a game!

Post by exfret »

Remind me to try it out...

Sorry that it's been two weeks...
Nobody ever notices my signature. ):
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: I made a game!

Post 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
Convincing people that 0.9999... = 1 since 2012
Post Reply