Log In  


by Mot
Cart #mot_pool-22 | 2020-10-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
30

A work-in-progress 3D pool table simulation.

30


1

Very good starting point!!!
(90% cpu? - we need to talk 😜)


The polygon rasterisation loop could definitely use some love :)


Good news: rasterization is ok (well I do prefer mine but whatever ;)

Bad news: vector oop and operator overloading is cool but for any serious work, this is a big no-no.
Try:

function justproject(p)
 -- project
 local scale=fov/p[3]
 -- plain old table
 return {p[1]*scale,p[2]*scale,scale}
end

and fix renderpoly with:

...
local dl={
  	l2[1]-l1[1],
  	l2[2]-l1[2],
  	l2[3]-l1[3]} 
...
local dr={
  	r2[1]-r1[1],
  	r2[2]-r1[2],
  	r2[3]-r1[3]}
...

Game went from 84% to 72% cpu!


@freds72 thanks.
I went a bit further and managed to get down to 54%.
(Went up again slightly when I added a cue stick mesh).


Very nice so far, although it feels a bit strange to have the view locked in place when balls can move off-screen. Maybe it could zoom out to get a view of the whole table after a player makes a move?


1

@Jusiv thanks. And yes, I agree - I'll probably add something like that.


are rules broken? looks like foul play doesn’t auto-switch to other player.


sub-pixels balls are 😍 - I cannot do without now in my games


@freds72 whoops, maybe. I was shuffling the logic around to shoehorn the position-white-ball sequence in.
I'll have a look in a bit.


will cpu vs cpu be possible?
this is a relaxing experience just looking at balls rolling in its sub-pixel rendering beauty!


Try waiting 100s :-)


yeah!


Truly excellent game already, Mot! 👏🤩

One request: please can we toggle/flip camera movement?
(my instinct is to rotate right with right arrow, and get low on cue ball with down)


1

Added an "Invert X-Axis" pause menu option.


@Mot PERFECT! 😙👌



[Please log in to post a comment]