Important alert: (current site time 7/16/2013 2:30:21 AM EDT)
 

winzip icon

A 200 segment slithering snake

Email
Submitted on: 1/2/2007 8:06:39 AM
By: Jason Bullen 
Level: Intermediate
User Rating: By 30 Users
Compatibility: VB 5.0, VB 6.0
Views: 15298
 
     Awesome screenshot! The fastest 2D bitmap scaled rotation on PSC! Highly optimized fixed point math for incredible speed! Please vote and send me your comments. Extra keywords (fast faster rotation fixed-point fixedpoint serpent)

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
1/2/2007 9:38:03 AMAgustin Rodriguez

Congratulations. Very nice and smart code. The compilation really it is important. @@@@@ Snakes
(If this comment was disrespectful, please report it.)

 
1/2/2007 11:55:37 AMLight Templer

Really a nice one! Very good idea for the demo and great code. My ***** for this gem and regards - LiTe
(If this comment was disrespectful, please report it.)

 
1/2/2007 3:18:19 PMPaul Bahlawan

Thats cool! I was able to squeeze out a few more frames per sec just by changing all the Integers to Longs in modRotate8. Changing them in frmMain made no noticable improvement... Cheers
(If this comment was disrespectful, please report it.)

 
1/2/2007 6:34:39 PMSpector

Excellent submission! Very original and runs extremely fast especially when compiled.
(If this comment was disrespectful, please report it.)

 
1/2/2007 9:17:52 PMT Jackson

Awesome! Using 90 segs I get around (80-90)fps on a PIII 866 MHz.
Suggest adding a speed regulator for stability. Excellently coded. *****

(If this comment was disrespectful, please report it.)

 
1/3/2007 5:16:45 AMRobert Rayment

Jason I still have your original submission which include this with other demos but I think you have removed it. Very clever system 5/5.
(If this comment was disrespectful, please report it.)

 
1/3/2007 8:10:04 AMOption Explicit

EXCELLENT. Thanks for sharing.
(If this comment was disrespectful, please report it.)

 
1/3/2007 9:53:15 PMUlli

With your permission I'll try and turn this gem into a screensaver.

*****
(If this comment was disrespectful, please report it.)

 
1/4/2007 5:04:25 AMIdealSolution

Very good.
If anyone create a screen saver out of this, please post the link here. Thanks
(If this comment was disrespectful, please report it.)

 
1/4/2007 1:10:04 PMNoName

How can i make this snake appear alone on top on my desktop? Thanks
(If this comment was disrespectful, please report it.)

 
1/4/2007 9:48:21 PMT Jackson

NoName: I think the general trend for doing something like that is to use GetDesktopWindow and GetDC API’s to be able to blit the desktop to a maximized form or picture box (this is the background), then finally blit the snake onto the foreground. It would make a good screen saver actually. I take it this is what you have in mind?
(If this comment was disrespectful, please report it.)

 
1/5/2007 7:02:12 AMRichard Mewett

What more can I say - its a very fine submission! Great code & demo. It's certainly fast - my laptop consistently clocked 190+ FPS (>200 when running nothing else). *****
(If this comment was disrespectful, please report it.)

 
1/5/2007 8:09:45 AMT Jackson

Likewise, with your permission, I'll have a crack at a screen saver for this if one hasn't been posted by a month or so time.
(If this comment was disrespectful, please report it.)

 
1/29/2007 8:21:32 AMdafhi

optimization
'For x = 0 To dstWidth - 1
For dIndex = dIndex To dIndex + dstWidth - 1

'dIndex = dIndex + 1
(If this comment was disrespectful, please report it.)

 
1/30/2007 9:44:30 PMJason Bullen

Hey dafhi, I missed that one. Well done. :)
(If this comment was disrespectful, please report it.)

 
2/4/2007 9:31:06 AMSachin Krishnan

Really Wonderfull!!!!!
(If this comment was disrespectful, please report it.)

 
2/9/2007 10:02:20 AMSandeep.G

Simply gr8!!!!
(If this comment was disrespectful, please report it.)

 
2/9/2007 8:12:01 PMdafhi

with the round operation, before \ 65536, you're basically shifting the read position half a pixel up and to the right. why not just do that outside the loop?

btw, a really helpful project. i was skeptical whether integer math sped things up, but i made a floating point version and yup, yours is faster.

thanks for this really cool code
(If this comment was disrespectful, please report it.)

 
2/12/2007 7:07:21 PMdafhi

in other words

iss2x = (srcX + .. - dstCenY * sina + 0.5) * 65536

iry = issy \ 65536

(If this comment was disrespectful, please report it.)

 
2/26/2007 3:15:58 PMLefteris Eleftheriades

amazing! it's just too fast gr8 submission.
(If this comment was disrespectful, please report it.)

 
3/6/2007 1:30:18 AMJason Bullen

To slow it down just reduce the global value: SNAKE_SPEED.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.