CodeBlocks
Part of the Minds of Chimera Project (dev)
CodeBlocks | MOCPlaytimeTracker | MOCDBLib | RegenBlock | MOCGoodEats | MOC3DImporter | ImageImport | MOCKiosk | MOCRater | MOCFizziks | GravitySheep | MOCChemistry | MOCRegistry

THIS PROJECT WILL CONTINUE AS CODEBLOCKS 2 HERE
Description
Codeblocks is a plugin that allows you to control a robot by creating programs out of special blocks. The programs are ordered sequences of these blocks. The programming constructs available are: Functions, Looping through recursion, and Branching (If / Else) through Sensing/

Commands
- run <program name> - Runs the specified program from the beginning
- pause - Pauses execution of program
- stop - Stops execution of program
- resume - Continues execution of program where it was stopped
- blocks - Clears inventory and fills it with code blocks
- save - Saves programs
- speed <number> - Sets the speed of program execution (1 is fastest, 20 is one instruction per second)
- shift [number] - Shifts the column of code blocks the number of blocks away from the start of the program. If the number is ommitted, shifts by 1 block
- unshift [number] - Shifts the column of code blocks towards the start of the program. If the number is ommitted, shifts by 1 block
- compass - Indicates which cardinal direction you are facing
Robot Actions
- Forward - The robot moves 1 block forward in the direction it is facing
- Backward - The robot moves 1 block backward
- Turn Right - The robot rotates 90 degrees clockwise
- Turn Left - The robot rotates 90 degrees counter-clockwise
- Up - The robot ascends 1 block
- Down - The robot descends 1 block
- Destroy - The robot removes a dirt or grass block directly in front of it
- Defuse - The robot removes a TNT block directly in front of it
- ShootArrow - The robot fires an arrow
- Pickup Block - The robot will pickup the block in front of it. These blocks are placed in a stack internally
- Place Block - The robot places the topmost block of its internal stack in front of itself
- DigInFront - The robot will mine and collect the block in front of it
- DigBelow - The robot will mine and collect the block below it
Blocks that require signs
- Sense - The robot compares the block in front of it to the specified block. If the robot sees the specified block, it will continue executing actions placed on the green arrow. If it does not, it will instead execute actions placed on the red arrows. The first line of the sign on the Sense block needs to specifiy which block to sense for
- Build - The robot will create the specified block at the specified location to the robot. The first line of the block needs to be the location relative to the robot. Possible locations are (Front, Back, Top, Bottom, Left, Right). The second line needs to be the type of block to place (e.g. Wood, Brick, Gold_Block, etc).
- Function - The robot will perform the specified function. The function can be specified with either one or two lines. If only the first line is used, the system will assume that you are running a function that belongs to the program. If you use both lines, the system will look for the function that matches the name. See the section on functions for further explanation
Creating Programs
Programs are described by a sequence of blocks built from North to South (You can determine which direction you are facing by typing '/cb compass'). The start of a program needs to be a sign which describes the name of the program. The first line needs to be the word 'program' and the second line is the name (See below). The following program is named 'example1' and tells the robot to Move Forward, Turn Left, and Move Forward. To run the program, you would place a robot on the ground and type '/cb run example1'.

Functions
Creating a function is much like creating a program; however, instead of the first line of its starting sign having the word 'program', you instead place the name of the program the function belongs to.

To call a function, place a function block with a sign on top. The sign should read the name of the function. You can use shorthand by just writing the name - the system will look for a function with that name belonging to the program. You can also write the full name of the function (this allows you to call functions from other programs - on my server I have a set of 'global' functions that I use in several of my programs). Both of the function calls below reference the same function.

Looping
Looping is accomplished through recursion. To have a set of actions repeated, place the actions in a function and put a function call at the end of the function that tells the robot to perform the function again.
Sensing
Branching (If/Else) can be accomplished with the Sense Block. See above for an explanation.

Saving
The system remembers which programs belong to each player. This way, players can have programs and functions with identical names and not conflict. You can manually save your programs so that they will exist on server restart by typing '/cb save'. Additionally, all of the programs are saved when the plugin is disabled (i.e. on a graceful shutdown).
Dependencies
Requires the Spoutcraft client (Uses custom blocks)
Permissions
codeblocks.all - Gives access to the plugin
Texture Pack
The robot will be converted into a dispenser when it is placed on the ground. If you would like to have the robot retain its texture, you can use this texture pack. It is the default texture for Minecraft, with the one change that makes dispensers look like the robot.
http:isue-server.eecs.ucf.edu/CodeBlocks/CodeBlocksTextures.zip
Other
This plugin was created as part of a research project. Upon running 5 programs, players will be prompted with a short survey. The survey must be completed to continue using the system. After 30 programs have been run, the survey will be shown again. Please try to take the survey seriously, we are very interested in your responses.
We are very open to suggestions and feature requests, so if there is something you would like to see added, let us know.
-
View User Profile
-
Send Message
Posted Aug 15, 2012Let's get some more people using this, I bet you can make a lot of cool stuff!
-
View User Profile
-
Send Message
Posted Jul 27, 2012@Pwnzsolo
Ha ha. Thanks for the great comments. Glad you like it. This is the start of some really fun stuff for us. Our Midns of Chimera server is just opening up to non-developers now and this plugin is going to see a lot of action now. Grab Spout sometime. You can still run normal Minecraft. Cheers!
-
View User Profile
-
Send Message
Posted Jul 26, 2012Truly brilliant. I am in complete awe of it...i wish there was a way to do custom blocks with regular minecraft. I have nothing against spout really. I just don't currently use it. Though this plugin tempts a person I'm tellin ya. Wow:)
-
View User Profile
-
Send Message
Posted Jul 22, 2012I've uploaded a tutorial explaining how everything works. Sorry it's a bit long, but I was trying to be detailed. http://youtu.be/CpmDidHU6ak
Things that I plan to address in the next update
Things I'll work on for future updates
@UndefinedDecoder
What you experienced with the blocks was unrelated to the button commands plugin. The custom textures must be hosted on a server, and the server was down for a few hours the other day. In the next update, they will be moved to a more stable server.
What did you mean exactly by your wishlist item #1?
-
View User Profile
-
Send Message
Posted Jul 20, 2012ok so i didn't really feel like making a video so i just took snapshots with explaining text. it all works the same right?
(12.4MB size on disk)
hope this helps!
i'll definately be waiting for an update because i installed 'button commands' to my server and caused codeblocks to look like this and all the blocks in the inventory look like this.
Restarting the server and client didn't fix it. Removing button commands and its config folder didin't fix it. Removing both button commands and code blocks (& config) then reinstalling code blocks didn't fix it. :( If the next release doesn't fix it, i'll just have to rebuild my server from scratch and never touch button commands again!
Cheers!
-
View User Profile
-
Send Message
Posted Jul 20, 2012Very cool plugin guys! Excellent work! Just a few bugs i've noticed;
A) kolorafa is right, robot doesn't pick anything up. haven't tried placing yet as i made a mining bot. sensing works correctly though.
B) sometimes the plugin will detect signs (or functions) that don't exist anymore and new signs with different function names must take their place for the plugin to realize what's happened.
C) most likely the same as B but the /cb save command will sometimes save signs written that don't exist anymore. it will also save signs that have nothing to do with the program as well. restarting the server doesn't fix this. the function signs must take on a new name for it to become 'unstuck'.
Wishlist:
1) enable functions to be placed on sense thens and elses. (the red and green blocks)
2) enable sensing of entities so guards can be made
3) make an end block (exit0)
4) make a counter block that would break a loop after n loops or to execute a function or program n times
5) tell the robot to communicate to you what its inventory looks like or its current action or function.
6) it's happened once but a recover command would be nice from the last save command, as part of a program was destroyed by a creeper. >:( ANGERRRR!!!!
Once again, excellent work on this. This is a great plugin and by far the most baddest asser of them all! I never would have thought of this and it opens up so many possibilities in minecraft, espically with construction. Making sure each corner and side is symmetrical with systematic construction. Man... I'll be working on a video tutorial of my mining bot when the pickup works. Keep up the good work guys!
-
View User Profile
-
Send Message
Posted Jul 19, 2012This description could REALLY use a video... ;)
-
View User Profile
-
Send Message
Posted Jul 19, 2012@kolorafa
Hmm, this might be an interesting approach to permissions. We assumed most would just put this in a creative world. I wonder how easy this would be to implement.
The robot block actually disappears and reappears each time which explains what you are watching. We're trying to think of the best way to support this. In a previous version, we just logged blocks that were mined and gave them to players when they typed a command.
-
View User Profile
-
Send Message
Posted Jul 17, 2012Could robot check for residence? As you write it remembers the user login, so if a user X runs a robot, can it fire an place/break event from bukkit as that user? then it will be possible to make protected areas where robot can't destroy/build ! and now if i allow players to use that everyone can grief on everyone residence.
Thanks for you hard work.
Bugs:
1. Robot block after place changes to dispenser (on first place it looked ok, but after few placements and first running program it changed)
2. Robot drops everything that you put in it
3. Block destroy/Pickup block doesn't place anything in robot, destroyed block just disappear.
-
View User Profile
-
Send Message
Posted Jul 17, 2012I hope people start to see this plugin. This is actually a VERY cool plugin, still under development. EdBighead11 is working on a video to demonstrate. This is basically robot programming in Minecraft. Forget pistons... this is the next level. Cheers!
-
View User Profile
-
Send Message
Posted Jul 16, 2012@kolorafa
The program counter isn't a block you can use to instruct the robot. Instead, it will appear above your blocks as you run the program indicating which action the robot is currently performing.
-
View User Profile
-
Send Message
Posted Jul 16, 2012How to use the program counter?