Jump to content




TheOriginalBIT's Programs, APIs, and Utilities

turtle api utility

349 replies to this topic

#1 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 24 January 2013 - 11:58 PM

THEORIGINALBIT'S
Programs, APIs and Utilities


Welcome to my thread. This thread contains programs, APIs, games, and more, that I have made for ComputerCraft.

To keep up-to-date with progress of most of the following programs go to my GitHub account also take a look at my pastebin account for lots of other scripts I make but don't always post.

I hereby give permission for use of these programs or APIs in your programs. I do however ask that you give me credit and leave any appropriate licenses intact!


Games

APIs

Computer Program

Turtle Programs

Code Snippets

Edited by theoriginalbit, 25 November 2013 - 11:38 AM.


#2 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 25 January 2013 - 08:02 AM

I'm glad you made a topic for your programs again. I'm sorry to do this, but your first reply will be some constructive criticism. :P

I took a look at your circle drawing API a week ago and I noticed some odd design choices that could cause inefficiency. I know it's quite stupid to go correcting something trivial as a circle drawing API, but I decided it was worth it.

First off, I did some testing on a large monitor and noticed that drawing big solid circles would be noticeable slow (often 0.5 seconds). Also, you seemed to not use the factor 3/2 on the x-axis for the solid circles because that causes artifacts.

These are the improvements I could come up with both in efficiency and logic design:
  • Defining the character to draw on the screen before the loop instead of branching each time (small issue).
  • Iterate over the angle as radians directly, rather than converting them on each iteration.
  • Calculating only a quarter of a circle and mirroring the point over both axes and the center.
  • Rather than of copying most code from the normal circle function to the solid one, merge them in favor of modularity.
  • For the solid circle function: instead of drawing all circles with decreasing radius, simply draw all horizontal lines between the extremes on each y-coordinate. This increases speed significantly and solves the artifacts for compensated circles (multiplying x with 3/2).
Applying all that led me to modifying your script to this: http://pastebin.com/Qb9fbudS . The solid circle on a giant monitor took between 0.01 and 0.03 seconds on average instead of the previous 0.50 seconds with this script.

I just thought that this was a perfect example of optimization and decreasing complexity of 'algorithms'. No matter how short or simple it is. :P I hope you appreciate my shameless attempt at improving this script for the sake of teaching others. :P

#3 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 25 January 2013 - 10:49 AM

Horray!! Central place for stuffs! *le follow*

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 25 January 2013 - 01:02 PM

View PostOrwell, on 25 January 2013 - 08:02 AM, said:

I'm glad you made a topic for your programs again. I'm sorry to do this, but your first reply will be some constructive criticism. :P
Yeh I was always going to do it... just had to get motivated :P

View PostOrwell, on 25 January 2013 - 08:02 AM, said:

I took a look at your circle drawing API a week ago and I noticed some odd design choices that could cause inefficiency. I know it's quite stupid to go correcting something trivial as a circle drawing API, but I decided it was worth it.
I like how you wait a week and a new post to do this :P

View PostOrwell, on 25 January 2013 - 08:02 AM, said:

First off, I did some testing on a large monitor and noticed that drawing big solid circles would be noticeable slow (often 0.5 seconds). Also, you seemed to not use the factor 3/2 on the x-axis for the solid circles because that causes artifacts.
Yeh thanx, I test code in cc-emu so obviously couldn't test on a monitor...

View PostOrwell, on 25 January 2013 - 08:02 AM, said:


Rather than of copying most code from the normal circle function to the solid one, merge them in favor of modularity.

I hope you appreciate my shameless attempt at improving this script for the sake of teaching others. :P
The main reason I did it that way was so they could use either one if they wish, for some reason late at night it didn't occur to me to just combine them in with a 'solid' parameter. Yes thank you for the suggestions/code, I updated the code in the pastebin link.


View PostNeverCast, on 25 January 2013 - 10:49 AM, said:

Horray!! Central place for stuffs! *le follow*
Lol! You crack me up :P :'( naw I have an anonymous follower... I wanted to know who it was... :P

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 26 January 2013 - 02:32 PM

oh wow... fixed issue with OP. I had some programs hiding in one of the programs spoiler.... I knew there were more programs than that!

#6 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 27 January 2013 - 06:34 PM

CCTube Format Transcoder has had it's first line of success today. Converting Gravity's LightShot videos in to our own format. Test results show file sizes at 21% and 46%. This is BEFORE the compression pass. So on average, file sizes are a 3rd!

#7 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 27 January 2013 - 07:08 PM

View PostNeverCast, on 27 January 2013 - 06:34 PM, said:

CCTube Format Transcoder has had it's first line of success today. Converting Gravity's LightShot videos in to our own format. Test results show file sizes at 21% and 46%. This is BEFORE the compression pass. So on average, file sizes are a 3rd!

O.o That's cool! I must see how you do it! Is this after files are compressed using the new compression system in 1.2? Cause that is fantastic if it works properly...

#8 AnthonyD98™

  • Members
  • 193 posts
  • LocationAuckland, New Zealand

Posted 27 January 2013 - 07:18 PM

Nice Programs, :)

#9 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 27 January 2013 - 09:16 PM

View PostNeverCast, on 27 January 2013 - 06:34 PM, said:

CCTube Format Transcoder has had it's first line of success today. Converting Gravity's LightShot videos in to our own format. Test results show file sizes at 21% and 46%. This is BEFORE the compression pass. So on average, file sizes are a 3rd!
Feel like pushing out that commit by any chance? :P Wait nvm, stupid GitHub changed the branch on me :P

View PostAnthonyD98, on 27 January 2013 - 07:18 PM, said:

Nice Programs, :)
Thank you :)

#10 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 28 January 2013 - 09:22 AM

View PostGravityScore, on 27 January 2013 - 07:08 PM, said:

O.o That's cool! I must see how you do it! Is this after files are compressed using the new compression system in 1.2? Cause that is fantastic if it works properly...

I'll run it on a compressed lightshot video today and let you know the results. They were just standard videos that were in the git repo.
Here's the link to the repo: https://github.com/t...be/tree/develop

Currently using the dev' branch until we've got a stable release.

#11 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 28 January 2013 - 10:20 AM

GravityScore, Just transcoded one of your compressed videos successfully. Down from 28,379 bytes to 10,045 bytes. If my calculator operating skills are up to scratch. That is 35% of the size. 65% compression! :D

Edit: Adding all the file sizes together to get an average.
41% of the size is average.

Also I've pushed the transcoded video to the github repo ( see above )

Edit2: Direct link to one of them: https://raw.github.c...oded-compressed
Isn't it beautiful!

#12 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 28 January 2013 - 02:08 PM

Huh, that's one weird looking file format :P The compression news is great!

Does it have to run in your video player? Or can you just shell.run the file for it to work? I take it you can't from looking at that file...

#13 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 28 January 2013 - 02:25 PM

shell.run would freak out :P
No it has to be run through the decoder :)
But this format has a lot of cool future proof features like multiple streams, codecs and version support. So we can implement audio or CCLights support in the future :D

#14 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 28 January 2013 - 03:03 PM

View PostGravityScore, on 28 January 2013 - 02:08 PM, said:

Does it have to run in your video player?
Yeh it does, but the main reason for doing it this way is for smaller file size on transmission, allowing multiple video formats, since they are just compressed to ours anyway, and its easier to do frames, also meaning easier support for playback controls.

#15 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 28 January 2013 - 03:47 PM

Also, if it was executable, It would provide the ability to run viruses.
I back this format with the statement, and you can quote me.

There is NO chance AT ALL of any viruses from this format! PERIOD.
:)

#16 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 28 January 2013 - 11:44 PM

Updated!

Advanced Door Lock Program v4.0

See OP for more details!

#17 redeye83

  • Members
  • 202 posts
  • LocationUnited Kingdom

Posted 29 January 2013 - 01:34 AM

Two words: Screenshots! :)

#18 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 January 2013 - 02:26 AM

View Postredeye83, on 29 January 2013 - 01:34 AM, said:

Two words: Screenshots! :)
Well here is the thing. They are coming soon because I have to find them all again, copy/paste from the old topics didn't copy the images or the links they were from.

#19 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 January 2013 - 03:35 AM

Ok screenshot links have now been added. I attempted to have them all in as embedded images, but apparently there is a cap on the amount of images you can have, so they are all links to them on my imgur.

#20 Skullblade

  • Members
  • 470 posts
  • LocationThe Big Apple, NY

Posted 29 January 2013 - 04:59 AM

View Postredeye83, on 29 January 2013 - 01:34 AM, said:

Two words: Screenshots! :)
Screenshots is one word...(the way u spelled it)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users