Archangel's Turtle Gambit [NOW Pre Alpha]

Started by ArchAngel075, Oct 06, 2022, 02:08 PM

Previous topic - Next topic

ArchAngel075

After a week of inspiration I present (turtle code only for now)

ArchAngel075's Turtle Gambit
Originally inspired by Ottomated - I set about creating a turtle gambit project of my own, except this time leveraging Unity3D and its 3D powers.

Installation and Preperation
1. First prepare by getting ngrok if you intend to run this on a server.
2. Setup ngrok to point to your local machine by doing the following :
2.1 in ngrok terminal enter `ngrok config edit`
2.2 setup a channel such :
tunnels:
 gambit:
  addr: <computer ip address here>:13337
  proto: http
  host_header: localhost:13337
For now the port is locked to 13337 (cool kids use 1337. cooler kids use 13337)

2.3 Save and close the config.
2.4 Whenever you feel like interfacing with the turtle army use `ngrok start --all` in the ngrok terminal to get a new endpoint. it will likely look something like `https://4ccf-156-95-227-198.ngrok.io`
2.5 We are only interested in the section after 'https://'. IE "4ccf-156-95-227-198.ngrok.io" remember it somewhere.

3. do `pastebin get gBpf7yPS startup.lua` on your turtle child. No upgrades are needed though mining and one minecraft chest in inventory are required to open and interact with other inventories

4. reboot the computer.
4.1 You will be prompted to enter a server name. This must be unique to the *server* but the same for all turtles on that server. Name it anything memorable. SinglePlayerServer works just fine for SSP
4.2 You will be prompted to enter an address. This will be that '4ccf-156-95-227-198.ngrok.io' entry.
NB. IF EVER you create a new ngrok endpoint for whatever reason. you will have to update the _address.lua on *every* turtle - I leave it up to you to manage this some way.
4.3 The boot will download a modified json.lua file. It contains a small edit to manage serializing function definitions.

Now your turtle should be making an attempt to connect to your ngrok endpoint which will point back to your local host, the endpoint is automatically appended with the server name to seperate turtles and prevent overlap.

At the time of this post I have not released a build of the Gambit control center as I have some small edits to make yet before I want to release a version 1.00 properly.
I am willing however to share a low support build to anyone interested.

Features of the project :
  • Control more than one turtle child across dimensions
  • see and manipulate turtle inventory
  • move items from/to any specific slot of a chest to/from a specific slot of turtle
  • Scripting System to manage lua files and push to a turtle
  • tries to use block textures if found (yoinked from assets folder)
  • Pathfinding using the AStar project. Still in infancy but one can select a destination and attempt to create a instruction set to reach the destination.
  • Procedures : different to scripts, these are lua scripts that expose a function that runs until completion. The turtle will refuse any other message except Abort. Unless awaiting a request* (You can for instance write a script that builds according to a schematic. OR explore/Dig)
  • Requests : Turtles now can make a request. with some payload the server will process and reply to. When doing requests turtles will not respond to any instruction except Abort. Requests have a "On Reply" callback.
  • Navigation Requests : Built in ontop of Requests and Pathfinding is the Nav Request. a special payload provides destination subjects (vectors. closest block of type. another turtle etc) - The server will attempt to find a path and reply with the instruction set or "no path" message.
  • Scripts get Helper and variable injection on demand : using {!! observation_helpers !!} or {!! movement_helpers !!} in *any* script injects various helpful lua functions predesigned to make life better.
  • Logs : Turtles now have volatile logs (not saved to disk) that truncate every 500 characters.
    lua side do "report(payload)" to log. C# side Turtle.Current.Log.Log(string)
  • Block Properties : Using Json you can assign unique key value properties to blocks by name. This is handy when some blocks expose certain functions or so. Properties values can point to scripts. Handier when some blocks need unique scripts to "open and take" items
  • Probably something else i forgot to mention. I add features ad-hoc.

In Progress Features :
  • User Defined Variable Injection : Do {!! <string> var_name !!} to define a variable of type in lua code. Then expose context sensitive GUI elements when selecting a script to run (you can now input dynamic variables on the server side)
  • Auto Update turtle startup to latest
  • *Maybe* Auto fetch ngrok endpoint via pastebin.
  • Probably something else i forgot to mention. I think up features ad-hoc.

Pics or it didn't happen :

You cannot view this attachment.

Tungsten

Ok, so im getting a 502 bad gate way error? how does the networking work for this? also getting a "no server atempting for server name"

ArchAngel075

Its...been a while.

The short story: A hard drive fault caused me to lose 2 years of collected projects and tinkering, one of which was the Unity3D portion of the Turtle Gambit Project.

After some recent deliberation, hyper coding away.
I present the VERY SOON (you can actually maybe get it sooner***) Alpha version!


What has changed
  • UI. Massive improvements to QOL and UI for this remake. You can now drag items from and to inventories you open. This makes it /feel/ like you are playing minecraft.
  • Improved Replication and startup. The startup.lua, self replication code has been improved. Hopefully to also make more sense!
  • Event driven code. This is more for me right now than you. But code is being rewritten to use a more event driven hook and unhook approach. This shall open doors for more /addon/ and user custom content creation.

some features were lost sofar unfortunately.

ALL procedure code was lost, I do plan on bringing it back but as no one else but I used this app i doubt you will know or care....

Logs are currently not implemented on the Unity side, but this is short on my list of todo.

Some textures are not supported. But I have *big* plans to support nearly any minecraft save possible.

Yet behold I present this time, my ugly repo for you to follow along. As usual im happy to share test runs with anyone interested. I say this more to fish for end users to test the look and feel. Feel free to ping me if you want to be a test user!
Turtle Gambit Repo

ArchAngel075

Quote from: Tungsten on Nov 01, 2023, 07:09 PMOk, so im getting a 502 bad gate way error? how does the networking work for this? also getting a "no server atempting for server name"

Im not familiar with that error myself.
No server* Message likely means that the code presumes there is no gambit running, which given I hadn't shared the code with anyone must be true. Unless you attempted to write the other end up yourself...