Particle Kinematics

One of my favorite books is “Physics for Game Developers” by David Bourg from O’Reilly.

Amazon Link

Well written, excellent explanations, a very approachable book to a fairly daunting subject. It was released quite a few number of years ago, but Amazon is indicating that an updated version is due out soon. In the beginnings of the book he gives a few examples that have to do with a canon firing a canon ball. It’s a 3D Particle Kinetics demonstration and I’ve ported it to Real Studio. It’s pretty simple, but it is using real world physics calculations relating to mass, gravity, etc. I would imagine the developers who wrote the “Crazy Birds” iPhone app had a copy of this book on their shelf. This type of physics “engine” code can be used in a remarkably broad set of circumstances limited only by your imagination to apply it in a game or simulation project.

The demo shows a top view and a side view of a canon (on left) shooting a projectile that hits a target (red rectangle). The path of the ball is traced out as the timer based animation plays. Again, nothing real fancy, but I think it’s pretty cool way to wrap your head around the physics of particle kinetics.

The project also includes a “bonus” folder of a Rb 3D Vector Library. This library includes a port from the C++ vector library presented in “iPhone 3D Programming” by Philip Rideout from O’Reilly Publishers. Vectors, Matrices, Quaternion and Parametric classes, nifty stuff.

Amazon Link

Download Project Here …..

Posted in Code | 1 Comment

Bresenham Plots

On the real studio forums there was a request for code to draw a rounded rectangle with dashes. Interesting problem. So this is my little project implementing some source code sources I found online. Source web sites given in project. The rectangle is shown in the bottom right of the screen shot. Came out nice if I do say so! I added an ellipse and antialias Wu line too. These are all drawn to a picture buffer graphics context writing to the individual pixels. Runs pretty fast!

I’m using a call to Drawline with the same x and y locations, essentially like calling a plot pixel call. This technique doesn’t seem to work on my tests with Vista. I think you need to make sure GDI is enabled, might be a bug, again, not sure. Works like butter on a Mac. :-)

Download Project Here …

 

Posted in Code | Leave a comment

Date Picker Cocoa

Update 4.28.2012

Added a feature request to be able to set the calendar to a particular date.

The API is to set the calendar to a specific date, Pass Year, Month, Day, Hour, Minute, Second. This is for GMT time.

Me.SetDateFromComponents 1985, 7, 5, 12, 20, 10

****************************

Cocoa comes with a nifty calendar and clock option. If you want to add a simple display of this information in your Mac Cocoa App, you might want to give this module and class a try. It’s very easy to use with only a few lines of code required. This project wraps this functionality up for you. It is encrypted and free to use.

The above screen shot of the included project is using five custom canvas classes. I added the ability to have the clock animate if you want.

Download Project Here …..

Posted in Code | 1 Comment

OpenGL Planets

A question was posted on the Real Studio forum about rotating spheres in OpenGL. I remembered that the “red book” had an example of doing this. So I whipped up a little port of the demo. Some code from the red book is listed here. Site Here ..

The brown sphere represents a planet, the blue, smaller planet spins around the other one.  I added depth testing so the blue planet is not drawn as it goes behind the brown one. I’m on a Mac, you’ll have to see if it runs on your PC. :-) If you click on the window, the animation will toggle.
Download Project Here …

Posted in Code | 2 Comments

Update NeHe OpenGL Lessons

Updated the ported lessons two thru six to Real Studio 2011 R4.2. These are Mac Carbon build only projects.

Download Projects Here …

Posted in Code | Leave a comment

Chrysanthemum And Butterfly Paul Bourke

When I get a little time to kill, time and time again, I end up at Paul Bourke’s web site, too cool, His Site …

This little project is a port of his Chrysanthemum code.

This is a “butterfly” example,

Download Projects Here …

Posted in Code | Leave a comment

Simple Bezier Class

A simple free open source cross-platform class that utilizes two different methods of drawing a Bezier line. Tons of sources on the net regarding the Bezier line. This class uses two control points to create the line. Pure Rb code.

Download Project Here …..

Posted in Code | Leave a comment

Live HTTP Streaming Class

A very simple to use Mac only class that will allow you to play live streaming audio from your Real Studio app. This is for Cocoa builds only. Tested on OS X 10.7.2 (Lion). The class is provided at no charge and is encrypted. A demo project comes with the download so can get up to speed on how to use it.

The public methods for the class are,

  • AboutMe – the license for use with the class.
  • Constructor – pass the HTTP link for the station you want to listen to.
  • Play – once the class loads up the web address, play the stream.
  • Stop – stop the playing of the stream
  • Status – the class will report back the status of what it is doing. The status states include, ‘ready’, ‘stopped’, ‘loading’, ‘playing’ and ‘could not play file’ and ‘error’.
  • StationURL – a string of the current HTTP link.

The demo project provides a few sample links that the class will play. If the link is not playable the class will report back to you via the status method. I hope you find this little class fun and useful. :-)

Posted in Code | Leave a comment

Steve Jobs

I never knew the man, yet he spoke to me countless times through his products and his brilliant presentations. My kids work at Apple. I program on an iMac. I always thought cell phones were a waste of time before my iPhone. As a young man with very little money, he some how convinced me to spend thousands on a Mac Plus – I’m so glad he did. I strangely find myself missing him with a tear in my eye and a smile on my face. He lived an incredible, inspiring life. A true American story of the American Dream. May God Bless Steve Jobs.

Posted in Blather | Leave a comment

Pong – Game Classes IV

A continuation of the Pong series. Seems to run fine for Carbon, Cocoa and Windows builds.

I decided to give this project an old school Pong look using some Rb native drawing calls. The game still lacks a few things that  I will add for the next version. And there are some design things I’m not pleased with, but all in all, not too bad.

Download Project Here …..

Posted in Code | Leave a comment