Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: LazyPool game loading from .an8 file  (Read 6699 times)

Leslie

  • Newbie
  • *
  • Posts: 17
    • View Profile
LazyPool game loading from .an8 file
« on: January 21, 2013, 08:44:00 pm »

A couple of years ago I tried to convince my daughter (12 then) to learn the basics of programming. What could be better for that purpose than making a game? So I showed her how to design and program a 2D game. We made a new level each day for a week, until we both got bored. She wasn’t too impressed, you can imagine, with all those 3D games one can get for free from the web… I told her we can do better than 2D, so I promised her a 3D game with lights and textures.
It was just a programming demonstration, so I wanted it done in minimum time. I borrowed the .an8 file loader and the OpenGL renderer from Terranim8or. The very basic modeling was done in Anim8or, of course. The game is an 8 ball pool with strait-forward logic, but not at all trivial due to issues involving simultaneous collisions and optimizations. Finally it came out as multithreaded server-client architecture, playable over the net by two players, or standalone.

I’ve decided to tell you about it only for one funny reason: as I was progressing with the game design, I had to solve a detail regarding the pocketed balls. One way of showing the balls stuck into the pockets was to render them static somewhere in the game window (which I think is the classical approach). It’s the easiest way, but it takes away from the realism – we have a dynamic 3D environment, but there is a floating array of balls kept in the same place in the corner of the window. Pathetic!
I was heading for the challenging way, of having the balls enter the pockets and landing in a net. Now that proved to be too challenging to make it look real, besides the visibility of those balls couldn’t be too great :).
Change of plan: the ball enters a certain pocket then continues in some kind of carved corridor under the table surface till it hits the wall, or a previous ball. Now we have a natural array of pocketed balls, visible from the outside, but it’s too difficult to program it compared to how little spectacular it could be. Not a good time investment.
At this point came the revelation, well deserved by any lazy individual like me! Why bother with pocketing the balls when we can leave them to fall off the table, just like that? It’s a simple pool, so simple that there are no nets under the pockets (no need the model them)! I checked the web and rechecked several times: no such design. Seemed that my laziness provided me with an original idea that I’m copyrighting right here in our Anim8or Forum :)!

When playing the game for the firs time, I had quite a shocking surprise: the balls that landed on the floor continued to behave correctly, obeying the laws of physics regarding decelerated rolling and collisions with each other. I didn’t intend to program them like that, but the balls continued to do exactly what they were supposed to do on the table :).
Logged

SpeedLow

  • Newbie
  • *
  • Posts: 11
  • Beginner
    • View Profile
    • SpeedLow
Re: LazyPool game loading from .an8 file
« Reply #1 on: January 22, 2013, 09:45:05 am »

Very Nice For Game You  :o
Logged
?

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1482
    • View Profile
Re: LazyPool game loading from .an8 file
« Reply #2 on: January 22, 2013, 06:12:11 pm »

Nice to see you didn't completely disappear Leslie ;) It looks good, got a vid or demo of it in action?
Logged

headwax

  • Sr. Member
  • ****
  • Posts: 600
    • View Profile
    • Headwax's Website
Re: LazyPool game loading from .an8 file
« Reply #3 on: January 23, 2013, 03:03:42 am »

Good on you Leslie! Welcome back :) And thank you for sharing! I hope your pocketless pool table you just copywrited here takes off like a Saturn Two rocket :) PS thanks for all the help you gave me when I first started.!
Logged

Leslie

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: LazyPool game loading from .an8 file
« Reply #4 on: January 24, 2013, 09:21:20 am »

Thanks for not forgeting me :)! I'll try to make some video of the game in action.
Logged