Page 1 of 1

Drop. Drop. Drop. goes the asteroids

Posted: Mon Jan 27, 2014 8:07 pm
by A Random Player

Code: Select all

import math
def xfrange(start, stop, step):
    while start < stop:
        yield start
        start += step
#"Stolen" from http://stackoverflow.com/questions/4189766/python-range-with-step-of-type-float

output = "Gravity Fun at TestTubeGames: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0]"
time = 1000
step = 40
start = 200
xv = 5
yv = 0
for a in xfrange(start,start+time,step):
 output = output + ", [x0: 0,y0: 0,vx: " + str(xv) + ",vy: " + str(yv) + ",t0: " + str(a) + ",who: 3,m: 0]"
print output
http://codepad.org/MPhGKhZ8

Example:

Code: Select all

Gravity Fun at TestTubeGames: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 200,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 240,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 280,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 320,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 360,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 400,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 440,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 480,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 520,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 560,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 600,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 640,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 680,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 720,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 760,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 800,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 840,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 880,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 920,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 960,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1000,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1040,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1080,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1120,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1160,who: 3,m: 0]
time is how long the asteroids are added, step is how often, start is when the adding begins (useful to put something down before they start shooting), xv and yv are how the asteroids move after they're shot. The sim's playback isn't perfect (it looks off by a factor of 2? or maybe it's just the save/load part).

This can be eerily organic:

Code: Select all

Gravity Fun at TestTubeGames: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: 33,y0: 64,vx: 0,vy: 0,t0: 0,who: 1,m: 1000], [x0: 65,y0: -12,vx: 0,vy: 0,t0: 0,who: 1,m: 1000], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 200,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 240,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 280,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 320,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 360,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 400,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 440,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 480,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 520,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 560,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 600,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 640,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 680,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 720,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 760,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 800,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 840,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 880,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 920,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 960,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1000,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1040,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1080,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1120,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1160,who: 3,m: 0]

Re: Drop. Drop. Drop. goes the asteroids

Posted: Tue Jan 28, 2014 6:27 pm
by exfret
I made stars with your asteroid code! (Yes, my experiments are a little less technical than yours).

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 0.38,xSet: 89.25,ySet: 0.4], [x0: 88.56,y0: 81.87,vx: 0,vy: 0,t0: 0,who: 1,m: 1000], [x0: -62.68,y0: 241.06,vx: 0,vy: 0,t0: 0,who: 1,m: 1000], [x0: -423.53,y0: 153.5,vx: 0,vy: 0,t0: 0,who: 1,m: 1000], [x0: -373.11,y0: -305.52,vx: 0,vy: 0,t0: 0,who: 1,m: 1000], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 185.4,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 225,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 265.5,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 305.1,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 345.6,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 385.2,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 424.8,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 465.3,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 504.9,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 545.4,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 585,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 625.5,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 665.1,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 705.6,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 745.2,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 784.8,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 825.3,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 864.9,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 905.4,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 945,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 985.5,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1025.1,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1065.6,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1105.2,who: 3,m: 0], [x0: 0,y0: 0,vx: 5,vy: 0,t0: 1144.8,who: 3,m: 0]

Also, with codes like your second, it almost becomes unbelievable that all those asteroids are following the path of a single, lead asteroid. They just seem to have minds of their own with how they travel around!

Re: Drop. Drop. Drop. goes the asteroids

Posted: Tue Jan 28, 2014 7:01 pm
by testtubegames
Yeah, it's neat to watch that second one with the orbits 'on'. After about 10 seconds or so, your 'organic' comment suddenly clicked. The asteroids looked like blood cells flowing through veins.

Makes me wonder if it would be fun to add 'sources' into the new version. So you put down an asteroid with a certain velocity, and it has a train of followers. Would be pretty easy, and it seems like there's some cool stuff we could make with it. (Especially since the new version tends to lag less than the old one)

Re: Drop. Drop. Drop. goes the asteroids

Posted: Tue Jan 28, 2014 7:57 pm
by exfret
testtubegames wrote:Makes me wonder if it would be fun to add 'sources' into the new version. So you put down an asteroid with a certain velocity, and it has a train of followers. Would be pretty easy, and it seems like there's some cool stuff we could make with it. (Especially since the new version tends to lag less than the old one)
No. Focus on the bigger issues first. Don't start adding in all these features for 'source asteroids' and stuff before you've even allowed panning or zooming! How am I supposed to watch my beautiful source asteroids move if they move, even the slightest bit, off-screen?

Re: Drop. Drop. Drop. goes the asteroids

Posted: Sat Feb 08, 2014 12:27 am
by testtubegames
exfret wrote:No. Focus on the bigger issues first. Don't start adding in all these features for 'source asteroids' and stuff before you've even allowed panning or zooming! How am I supposed to watch my beautiful source asteroids move if they move, even the slightest bit, off-screen?
Right! Gotta stay on track, of course! Well, panning and zooming are done and done.