Epicness Overload - Moving turtles with a Joypad

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Darkprince97

New Member
Jul 29, 2019
29
0
0
Hello everyone,
I just finished a program for computercraft (but not only...) that took me 2 hours and I tought it would be cool to share it with you guys.
I got the idea watching one of the latest EthosLab videos,where he told that he would like to control turtles from outside of the Minecraft environment in runtime.
Well,I did it!
Using LUA,AutoIt and PHP I just made a basic proof of concept (that uses a Joypad) on how to control the turtle using the Joypad itself!
I'm gonna post a video about it soon,but this is sooooo cool! It's like having a little radio controlled robot :D!
I am gonna post the code for those of you guys who are interested :)

Bye bye.

Ok,video:

Quick language Note:
Sx : Left
Dx: Right
Interprete: Interpreter
Ricevitore: Receiver
Avanti: Forward

Autoit:
http://pastebin.com/1qqLe12T
PHP
interprete.php
http://pastebin.com/zzFrCS3s
ricevitore.php
http://pastebin.com/sYG69ACA
LUA
http://pastebin.com/1RFPsAMC
  1. function post()
  2. http.post(
  3. "http://phpdesigner.altervista.org/turtle/ricevitore.php",
  4. "a="..""
  5. )
  6. end
  7. while true do
  8. local source = http.get("http://phpdesigner.altervista.org/turtle/com.txt")
  9. local aSource = source.readAll()
  10. if aSource == "10" then
  11. turtle.forward()
  12. post()
  13. elseif aSource == "065535" then
  14. turtle.turnRight()
  15. post()
  16. elseif aSource == "00" then
  17. turtle.turnLeft()
  18. post()
  19. elseif aSource == "2" then
  20. turtle.up()
  21. post()
  22. elseif aSource == "3" then
  23. turtle.down()
  24. post()
  25. elseif aSource == "1" then
  26. turtle.digUp()
  27. post()
  28. elseif aSource == "4" then
  29. turtle.digDown()
  30. post()
  31. elseif aSource == "6" then
  32. turtle.dig()
  33. post()
  34. elseif aSource == "5" then
  35. turtle.place()
  36. post()
  37. elseif aSource == "11" then
  38. turtle.back()
  39. post()
  40. end
  41. os.sleep(0.10)
  42. end
 

tehBlobLord

New Member
Jul 29, 2019
547
0
0
250399_206931102676766_361148_n.jpg
 

Darkprince97

New Member
Jul 29, 2019
29
0
0
It could be done with the Keyboard too, you just need to modify the AutoIT script :)
Btw,some comments in my Codes are in italian,because that's my first language.
Quick language Note:
Sx : Left
Dx: Right
Interprete: Interpreter
Ricevitore: Receiver
Avanti: Forward
 

brujon

New Member
Jul 29, 2019
496
0
0
Anxiously awaiting... Apparently youtube hasn't finished processing your video yet.

EDIT: Very cool man, watched the video. I was kind of hoping for a split view of the in-game turtle moving and a video of you using the joypad so that it was easy to see the correlation. And a question... Is the program only able to move the turtle or you can program certain buttons to do certain actions, like turtle.dig() and turtle.attack()? I envision a turtle olympics game, where players compete with their turtles to complete several tasks in the smallest time frame, such as mining out 3x3x3 cube, killing a certain amounts of mobs, building a predetermined structure, navigating a maze, and even other competitive games, where two or more players compete to mine each other's turtles, or destroy each other's fort, or even a capture the flag sort of game using the turtle's built in ability to emit a redstone signal, or CO-OP games such as a "Turtle Defense". Turtle Defense can be done with zombies and villagers. Villagers attract zombies to pressure plates, connected with redstone to a block breaker, which eats away at a pillar of gravel/sand. Every piece of gravel/sand is sent to a hopper connected to a comparator. Once the hopper gets above a certain number of gravel/sand, the comparator will output a strong enough signal to complete the circuitry and detonate a piece of TNT, which destroys the player's "Fort". The players have to manually control the melee turtles using the joypad in order to kill the zombies before they reach the pressure plate.
 

Darkprince97

New Member
Jul 29, 2019
29
0
0
I know... I am going to do a better video tomorrow (with the webcam).This one was just to show that the program works :)

EDIT:
As I said, I am going to do a video with the joypad tomorrow :)
Anyway,you are able to do the following actions (It is designed for a mining turtle)
dig()
digUp()
digDown()
place()
I will eventually implement turtle.attack() too :)
Btw,Your idea is awesome,but it would be difficult to implement (The program,as it is designed now, is only able to move 1 turtle).
Nonetheless,I could implement frequencies and passwords if I want to.
 

brujon

New Member
Jul 29, 2019
496
0
0
One turtle as in, globally? My ideas revolve around each player controlling a single turtle, not one player controlling multiples. Only one instance of the program can be running at a time?
 

Darkprince97

New Member
Jul 29, 2019
29
0
0
Yes,because it is based on a single webpage,like one global control channel.But,as I said, I can implement frequencies for each player.
 

ahwtx

New Member
Jul 29, 2019
88
0
0
this is sweet!

i wanna see rock 'em sock 'em turtle tournaments! epic battle arenas! man oh man, the possibilities!

seriously, good job. :)
 

brujon

New Member
Jul 29, 2019
496
0
0
Yes,because it is based on a single webpage,like one global control channel.But,as I said, I can implement frequencies for each player.

Oh, i understand it now. But dude, it would be EPIC if you could pull it off... The possibilities are endless.
Now we just need Turtle-Vision Screens, and we can play a game within a game. Man... It's too epic. Just imagine having the ability to put a live feed of what your turtles are seeing, being able to remotely control them with a Joypad at will... Also turtles as a security system, little robots that send live feeds of their surroundings to a central location. You could send patrols, send turtles inside danger zones such as lava spills to clean the mess, or irradiated zones (Atomic Science) in order to clean the mess. Wither vs Turtle? Hell yes.
 

Darkprince97

New Member
Jul 29, 2019
29
0
0
Thank you very much,everyone :)
@brujon: Now,that would be epic! I think I would be able to pull the remote vision thingy off if I only had access to the computercraft source, but I'm not completely sure...
 

brujon

New Member
Jul 29, 2019
496
0
0
Maybe do a bit of brainstorming over at the ComputerCraft forums?
One mod i KNOW that DOES change the PoV to that of an entity that's not the player is Pixelmon. Every time you enter a battle with one of the Pixelmons your POV gets changed. There's also http://www.minecraftforum.net/topic/1706068-cctv-mod-for-minecraft-15-updated-51213new-contest/ . These guys are making a CCTV mod for Minecraft, well, remaking it, actually, as it had already been done before. Maybe if you could get in touch with those guys they could share a bit of their expertise with you?