Author Topic: Pool  (Read 46394 times)

0 Members and 1 Guest are viewing this topic.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #80 on: March 09, 2007 »
its the collisions only it needs rules better graphics etc. but the mechanics are up and runnin and we are one step closer btw Hows College ?

Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Pool
« Reply #81 on: March 09, 2007 »
Uni is great! haha. hadn't had too many hard assignments, and my group are flying with our Innovation and Design assignment (we're making a rope bag for water skiing and abseiling and other rope sports haha!)

Staying on campus is a ball! Haha!

Yea, nice. Do you think you'll use the graphics I used?
« Last Edit: March 09, 2007 by CLANKY »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Pool
« Reply #82 on: March 09, 2007 »
The collisions look like they work really well, I liked the graphics that you had before, I hope you use them in the finished version. The only things that I would suggest are that the balls are too dark, they take forever to slow down, also aiming and adjusting the power should be faster. These are just minor tweaks though, you've accomplished a lot here. It might be one of the toughest projects you'll do for quite a long time too!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #83 on: March 09, 2007 »
Yes Clanky the graphics that you developed are going in there but I wanted to get the rules etc in there first. But I think I will work on this first since both of you guys noticed it (which is a very good indicator that the time is right to address it)
Thanks for pointing out the controls and slow down Shocky I had blinded myself to this as I was building it this became unnoticeable but now that you mention it it does take forever for the balls to stop.

Challenge Trophies Won:

Offline Tetra

  • DBF Aficionado
  • ******
  • Posts: 2532
  • Karma: 83
  • Pirate Monkey!
    • View Profile
Re: Pool
« Reply #84 on: March 09, 2007 »
Seems to be coming along very nicely, looking forward to see the final prod :)

Pool games are great  :updance:
Challenge Trophies Won:

Way.net

  • Guest
Re: Pool
« Reply #85 on: September 10, 2009 »
Just following the spiders earlier and came across this interesting thread. :)

Did a final version ever get released as would love to see it O0

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #86 on: September 10, 2009 »
Never did finish this but I will have another go at it. I would like to see this completed myself

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #87 on: September 22, 2009 »
Update, this is the current game engine. Ball spin is not gonna be included because these routines require straight lines. Collisions are time based and I've used swept routines for everything so ball speed is not constrained.

Well that's the theory anyways in practise it still has some minor glitches in the ball / wall collisions. This is as good as its gonna get cause I wrote that routine over a year ago and it was only loosely commented, I have no idea how it works any more.

The graphics are modified from Clankys design but I made the balls and holes larger the reason being that larger balls seem to reduce issues with the the wall collisions.

I just have to merge some game logic which Clanky has already done some work on. Rules and what not.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Pool
« Reply #88 on: September 22, 2009 »
Excellent engine Rain Storm, I find the controls strange, when I pull the cue back and then hit X the cue flies forward and the cue ball just seems to creep forward, maybe I am missing a trick here?
Shockwave ^ Codigos
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #89 on: September 23, 2009 »
if you tap X it works best, the distance the cue is to striking the white ball when you release determines the power of the shot. I wanna use a timer eventually cause pulling back the cue just doesnt feel right. But it is good for debugging.

Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Pool
« Reply #90 on: September 23, 2009 »
Awesome RS! That looks so sweet.

The collisions are great.. although it seems as though the balls have the tendency to speed up if they bounce and bounce.


Just a few bugs;
When you sink the white ball - it is placed in the 'sunken balls area'. You can still shoot however.. collisions are calculated within the 'sunken balls area' as well.
Scenario: Once you have sunken a ball, sink the white ball. This will place the white ball in the area outside the table. You will still be able too shoot.. aim at the balls which have already been sunken.. these balls will collide and move around.
The cue is 'stuck' on the white ball after you shoot.. maybe the cue could disappear until you want to shoot again.

I'm still playing it : ) soo cooool.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Re: Pool
« Reply #91 on: October 10, 2009 »
Whew!
I could only juggle two balls, when trying my hand at this.
And I almost dropped them, when coming up with the maths
to get this basic pinball!

Code: [Select]
open window 640,512
ang1=pi/180
ang2=180/pi
ra=30
ball=6
dim dirs(ball),xs(ball),ys(ball),ssp(ball)
dim hitang(ball),hit(ball),reang(ball)
for a=1 to ball
dirs(a)=0
read xs(a),ys(a)
ssp(a)=0
next a
dirm=30
xm=500
ym=100
msp=8
repeat
setdispbuf vm
vm=1-vm
setdrawbuf vm
clear window
  setrgb 1,200,200,0
  fill rectangle 0,0 to 640,512
  for a=1 to ball
  setrgb 1,0,256,0
fill circle xs(a),ys(a),ra
  setrgb 1,0,0,0
  circle xs(a),ys(a),ra
hitang(a)=atan(xs(a)-xm,ym-ys(a))*ang2+180
hit(a)=(abs(xs(a)-xm)^2+abs(ys(a)-ym)^2)^0.5
reang(a)=((dirs(a)+180)-dirm)*2+dirm-180
if hit(a)<ra*2 dirm=reang(a)
dirs(a)=hitang(a)-90
line xs(a),ys(a) to xs(a)+cos(dirs(a)*ang1)*ra,ys(a)+sin(dirs(a)*ang1)*ra
  next a
xm=xm+cos(dirm*ang1)*msp
ym=ym+sin(dirm*ang1)*msp
  setrgb 1,250,120,0
fill circle xm,ym,ra
  setrgb 1,0,0,0
  circle xm,ym,ra
if xm<0+ra dirm=270-dirm+270
if xm>640-ra dirm=90-dirm+90
if ym<0+ra dirm=-dirm
if ym>510-ra dirm=180-dirm+180
if dirm>360 dirm=dirm-360
if dirm<0 dirm=dirm+360
until (1=0)
data 252,126,396,126,468,252,396,378,252,378,180,252
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #92 on: October 11, 2009 »
Wow thats remarkably tight code and those collisions work very well.

Code: [Select]
abs(xs(a)-xm)^2
^taken from the pythagoras theorum is that faster (in yabasic) than the way its done below
Code: [Select]
(xs(a)-xm)*(xs(a)-xm)

also this code uses atan to reflect the movement vector about the normal of the collision plane
Code: [Select]
hitang(a)=atan(xs(a)-xm,ym-ys(a))*ang2+180
...
reang(a)=((dirs(a)+180)-dirm)*2+dirm-180
...
dirm=reang(a)
dirs(a)=hitang(a)-90
...
xm=xm+cos(dirm*ang1)*msp
ym=ym+sin(dirm*ang1)*msp
dirs is the surface normal and dirm = collision plane? Anyway its much tighter than the way I have done this
Code: [Select]
  ed = 1.0 // energy disapated (lost)
  ...
  D = 1 / sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
  ax = (x2-x1) * D
  ay = (y2-y1) * D
  va1 = dirX(A)*ax + dirY(A)*ay
  vb1 =-dirX(A)*ay + dirY(A)*ax
  va2 = dirX(B)*ax + dirY(B)*ay
  vb2 =-dirX(B)*ay + dirY(B)*ax
  vaP1 = va1 + (1+ed)*(va2-va1) / (1+mass(A)/mass(B))
  vaP2 = va2 + (1+ed)*(va1-va2) / (1+mass(B)/mass(A))
  vecX(A) = vaP1*ax - vb1*ay
  vecY(A) = vaP1*ay + vb1*ax
  vecX(B) = vaP2*ax - vb2*ay
  vecY(B) = vaP2*ay + vb2*ax

Challenge Trophies Won:

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Re: Pool
« Reply #93 on: October 12, 2009 »
Thanks.
I really had to dig deep to remember the maths you see in the code - and the way it's used - from high school (it's been a while!) and with no reference material.
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
$
« Reply #94 on: October 12, 2009 »
http://www.youtube.com/watch?v=CdpR3hU5bAI

^The 3D pool game written for yabasic, most of you will recognise it from youtube. Well here is the source code for that program...

http://canarddechien.blogspot.com/

Problem is it doesn't run, keeps giving parse errors. I've been reading through it to see how it works, but without the ability to edit and run it's not easy to see the inner workings.

Does anyone recognise this syntax cos it doesn't make any sense to me...
Code: [Select]
if ctnz< nzc="nzc+1" xoff="FOV*ctnx/ctnz"
strings are not "$" termated variable names, also are those supposed to be c like comparisons or is this source code simply erronious.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Pool
« Reply #95 on: October 12, 2009 »
It looks like most of the quotes shouldn't be there at all.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Pool
« Reply #96 on: October 14, 2009 »
also the speech marks might be brackets ( ... ) that have got jumbled with formatting. if they are at all needed.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #97 on: October 14, 2009 »
on a lighter note this game is finished check my first post for the attachment. it turned out to be >38kb. Better late than never. Hope you dont mind the changes I made to your graphics Clanky, I tried to keep them very close to what you had in mind.

Back to the youtube pool. The source code is badly corrupted it is impossible to restore it with so much of the text missing.

Code: [Select]
pad="peek(">0 then :rem R

should be something more like

Code: [Select]
pad=peek("port1")
if pad>0 then :rem Read controller only if input <> 0

with more than half of the code already corrupt in a similar fashion to this. I asked him to reupload a working copy to his blog over on youtube just wait and see what comes of it.

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Pool
« Reply #98 on: November 08, 2009 »
ps2Yabasic 3D Pool has been corrected by its author Canard De Chien
http://textsnip.com/a87d35
AWESOME

Challenge Trophies Won: