MineCraft Boat Race Port Part 6

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am bringing you another part to the slowing saga of the boat race port. Let’s get started!

Well, I have all the features ready to hopefully impress anyone interested in seeing it. The two landmark objectives this week were getting the teleport commands just right, and getting the boats to spin as the level starts.

The spin was an interesting story. This project is sort of a semi-secret from the rest of the server, so when I need help, I ask how to get a related problem. In the case of the spinning boats entering the level, I asked about how to make a cow spin in a tornado. I adjusted the selector (more generally: stuff I understood) to ask about actually getting a cow [boat] to spin. I ended up coming up with and refining my own solution, which in turn was unsuitable for the spinning cow.

Overall, the project is as close to the original as it’s going to get, barring some changes to reduce unwanted behavior. From this point, I’m going to be introducing new elements, making the whole experience even better.

At this point, I just need to show it off for that blind reaction I mentioned last week. It may be a while, so I think I’m going to start another project next week. Besides, I could blog about half of all the little, uninteresting optimizations I keep doing, but I’d just get bogged down and things would forever get thinner.

This project has been good for me. I cannot recall all the lessons I’ve learned along the way, but one of the newer ones is a reminder not to stop looking for a solution just because you ask out for an answer.

Final Question: What lessons from long projects have you learned?

MineCraft Boat Race Port Part 5

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am excited to announce the near completion of my project. Let’s get started.

Who would have known, not more than 24 hours after writing my last post, 12 after it went live, I would finally have the last major chunk of code working for my demo? I even made my goal of finishing before MineCraft 1.13 launched!

This week was kind to me even after my breakthrough, as I not only finished that up, but I got the other two alcove/arena combos working. Jam was helpful with getting the /tellraw commands working when he told me to just change out the old selecters.

I also worked over the end of level win condition, patching a bug where you could import a boat and cheat your way to the end. It turns out the boat would sometimes get stuck on elevators and break apart, forcing the player out of the level and resetting their progress. I made the level require the use of the original boat by setting (and checking for) an invulnerable flag on the boat. Unfortunately, I have no way of testing the invulnerable flag on glitching boats.

As it is now, I think the experience is at about 99.9% of the original. The original boats spun in air as they were summoned, and I still need to nail the /teleport commands.

I showed my work off to a few people this week. Duke, the guy who built the levels and my first guest after the workable demo, came by and helped me with a potentially embarrassing bug for when Tango (the owner of the Patreon server I play on) eventually does a blind reaction. New players need a valid score before they can enter the level for the first time. I fixed that for him and when DropDaBass, the server’s head moderator, came by.

There are still a few minor bugs. Sometimes timings don’t work out the best and you take a little damage on the way to the arena. Once in a large while, the level unloads around you without returning you to the lobby. There’s trouble with FPS (Frames Per Second) when connected over the Internet and a level unloads. There will always be something to polish.

One of my major goals for this build is the flexibility to add more games. I brought another patron over called Pendl3, who is looking to help me with my random throw away idea of a golf course. Getting the code ready for running dual games will be interesting, but I will complete the challenge.

Final Question: Simple, what games should I add? I think it would be good for me to add a few a year and they can either players or moderators swap them out with a control panel.

MineCraft Boat Race Port Part 4

Good Morning, from my Robotics Lab! This is Shadow_8472, and today, I’m almost done with my port of 2Cubed’s boat race. Let’s get started!

This week felt like progress was made in spurts thanks to both jam and Grifter, the two people from my MineCraft server helping me. About all my major accomplishments this week are in part to their command proofreading. Early on, I was working on the code to start the level. The /tp command and its supporting code was challenging to get just right. I came up with the idea to use an identifier block no player could [normally] see and reference it from commands later and jam helped me get something working. I was able to tune it in from there.

Jam once again helped me understand how the scoreboard works so I could build a level select. Long story short, imagine a spreadsheet. You have objectives at the top and entities on the side. Each cell at the intersection has a score to edit. There are no “global” scores, as much as I’d like to think that would make it easier on the learning curve. Objectives are added without attachment to an entity, but scores in those objectives are. Once I had that, I could step on a pressure plate to set my next_level objective to some level and load it with the alcove pressure plates.

Then came a day or few where nothing much happened, but with MineCraft 1.13 almost out, I wanted a workable demo by its launch date. A friend showed interest in seeing my work so far, and part way through the week, I scheduled a viewing on Friday, but I didn’t make it.

The next major hurdle after the teleport was how to tell if there were any players in the arena outside their boat and outside the starting area. After tossing the old command to jam and back (without luck), I passed the problem to Grifter, and he was awesome. He isolated a targeting selector I needed, where I likely would have figured it out in another few hours.

My focus sort of drifted to the win condition. Sure, it took me a while, but I eventually realized I could do it with a single command. Getting that command was another topic. I did most of the work in assembling it, and jam got me a snippet that gave me a working theory. The commands were a bit stubborn, but after I got something almost working, another chat with jam and it’s working.

The most recent challenge was targeting “cheating” players. The old game used scoreboards for almost everything. Something about a cheater tag showed up if you stood up and you weren’t in the start area. I wrote a command, finished by Grifter after hours of me doing trial and error, that spammed the word “hi” at any “cheating” players in adventure mode. And that’s where I am now. The next step is to replace the /say command embedded within the /execute with a function command to clean up players who might be done with a level.

I guess I have been making more progress than I thought this week. Before those last two breakthroughs on Sunday evening, I was all ready to make a big speech on progress and how a lack of success doesn’t mean you aren’t making any. Thomas Edison comes to mind with his brute force work on the electric light bulb. Once you know something doesn’t work, you don’t try it anymore. My difference here is that I’m documenting my progress with personal messages.

Final Question: I’ve now doubled my original project estimation time. I don’t really care. I’m getting working results on a semi-regular basis, and I might just get my 1.13 deadline. Even if I don’t make that one, I’d still like to get it working before my server updates. Have you ever worked with multiple deadlines for the same project?

Minecraft Boat Race Port Part 3

Good Morning from my Robotics lab! This is Shadow_8472, and today, I am bringing you another short chapter in the history of my port project. Let’s get started.

Work is still slow. I have a fairly solid idea of what the structure of the final product is supposed to be, but it’s coming along. Jam and I weren’t exactly able to work on it constantly, but he did help me with a few ideas and get the teleport command for entering the level.

I really hope I can do a demo for next week encompassing the original experience for the boat race. In the meantime, I can finish fine tuning what I have and showing my progress off and comparing it to the last time I showed it off to someone. Early on, I showed it off to my self, playing the levels just for old memories’ sake. That was just the levels loaded into a field after aligning them correctly. Later, I had a friend over where I loaded each level half in manually. After that, I demonstrated how I only needed to load one half, and it would load the other automatically. Another step toward completion let me show someone else how I had the structure blocks correctly placed to load the five available levels. This week, I provided my mother with an experience one step closer to completion when I played interface between the pressure plate and loading the level; the level now teleports its players to its own starting point.

Right now, I can think of two remaining challenges: I need to do the interface between pressure plate and level loading, and I still need to do the level end functions. Other than that, I still haven’t even looked at the original celebration commands.

Final Question: The teleport command came to me after goofing off all day. Have you ever gotten a critical idea in a similar fashion?

MineCraft Boat Race Port Part 2

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am updating my progress on the boat race. Let’s get started.

The race still isn’t playable. I managed to get the levels loading correctly from the command block room, special effects and all. All I’m just waiting on the completed functions back from jam.

In the meantime, my vision of this project has expanded. I’m now calling it the “Modular Game Center.” Basically, someone will be able to come in, flip some switches and play one of a number of games. Let’s say I have the expanded boat race and a golf course packed in there as well. The hardest part was programming for that eventual possibility.

Other than that, I showed off my work for last week’s post to a lot of the people involved in making the original boat race as well as my server admins. There’s word of the server resetting soon, so I’m hoping it will be done by then.

Once again, team building is the lesson up for learning here. This is a non-paid position, so if I don’t hear back from jam within a few days, I’m going to start figuring out how to do the functions myself. It will likely take a bit longer, but I found a great tutorial on how to build the commands.

Final Question: It’s a lot harder to write about writing software than building hardware. I don’t have as much to say this time… MineCraft kept crashing… Have you dealt with the pre-releases?

MineCraft Boat Race Port Part 1

Good Morning from my Robotics Lab! This is Shadow_8472 and today, I’m starting a new project in MineCraft. Let’s get started!

A couple years ago, the MineCraft server I sometimes play in, Titancraft, had a special mini-game built for it where a player gets into any one of three arenas and plays through a series of five courses and gets an award at the end. Any of the arenas would load the player’s next level, but that was about it from a technical aspect, as far as I’ve figured out. I want to port it to MineCraft 1.13. (As of this writing, the MineCraft is on 1.13 release 3, updated in the middle of this week).

First, I contacted one of the moderators, GrifterMage, and got his blessing on the project. Then, I started setting up a server as close as the target software as possible. I understand the server runs on Spigot, and that they had been making 1.13 pre-release snapshots… which I couldn’t seem to compile. I setup a vanilla server thinking this project is likely to take either two or three weeks.

I started looking into installing structure block files. They had changed for 1.13. Now, they are part of something with a steeper learning curve, but have all the more power once you get the idea of them: datapacks. Following the trend of going from texture packs to resource packs, datapacks are a new series of files that organize simple modifications to the game. All I know about them so far is that they contain both functions and structures, which before now were more free floating in their own folders, and that the packs themselves can be switched on and off.

With a vanilla server and a bit of ambition, I set about making a “Hello World” function. I asked for some help on the server’s Discord channel, and a user by the name of DrHenchman was helpful in pointing me to the correct way to structure a datapack; I sent him a bunch of screenshots as I debugged my way to victory.

Structure block files can save and load sections of the world up to 32 blocks in each of the three directions, so I made four test levels of 32×32 blocks and got them to load from a datapack on the server.

When I started thinking about the actual levels, I started looking for any videos someone may have had with footage of when the map was originally operational. I found acg1000’s posted livestream from when the custom dimension containing the boat race was opened, but two hours seemed a bit much for a just-adequate-for-YouTube WiFi connection when I needed to skip around a bit. After I skimmed it using my PC, low quality, and 2x speed. He didn’t have it…. Later, GrifterMage managed to scare up the original structure block files for me to work on. Another mod, DropDaBass, apparently had a copy. They are both awesome for that.

The files are two years old. A lot of things have changed since then. First of all, from 1.12 to 1.13, structure files no longer accept capital letters in their file names. Even though I was cautioned against it, I tried copying the files directly into 1.13 and changing the names and dropping them in the correct place to load them. I don’t remember exactly what happened, but they didn’t work correctly. I ended up having to load them all up in 1.12 and re-save them.

Which brought me to another challenge. One of the levels features floating water blocks. Before, they were simply “still_water”, a feature removed for 1.13. As a side effect, the now-regular water blocks flooded the level. As a step in the correct direction, I put a repeat command block out to continuously clean up the drips. The seizure alert results should have been expected. I then messed around with using “structure_void” blocks to hold up the water, since they look the same as air when you’re in adventure mode. Structure_void blocks are about the one block structure blocks cannot copy. So I set my commands to filling each level with them as soon as it was loaded. The next command replaced any leaked water blocks, in case of any lag Grifter pointed out there may be. Ultimately, I’m opting to just use a crazy block, like diamond ore blocks, to contain the water until they can be replaced when the level loads.

Around this time, I poked into loading the actual arena building, including the lobby and thee arena floors above it I gutted two of the three arena command blocks and started installing the hardware for my port. The existing logic no longer functioned, in either 1.12 or 1.13. After an hour or two, I found the credits to three people who originally worked on it. TheDukeMinecraft, listed as Project Manager, Designer, and Builder; 2CubedTech, listed as Tester and Command Writer; and dminer78 listed as Tester and Food Eater.

I reached out to the only original designer still present on Titancraft’s Discord server, Duke. He was eventually able to put me in contact with 2Cubed. Both seem excited that their old project is getting some love, but I got the impression both are busy with their own endeavors.

While I was waiting for messages back from Duke and later 2Cubed, work continued on the design. One of my priorities is minimizing load on the server. This means as few repeat command blocks running their contents every tick as possible. (Another reason why the blinking water was a bad idea). All I really need is two end conditions listening for if the player is standing or if his boat is at the goal, a line of three gold blocks. To make things more interesting, I wanted the ability to load one of two maps for each level, one classic or one newly built for the grand re-opening. While I still don’t have the logic figured out, I have a comment version of it in the server files. These are very likely to get rethought and scrapped.

I looked out in the vast, 30×30 room that was the command block room. It is so big! There’s room for a lot more than just a few levels. I mocked up some structure blocks and found that each arena can hold up to 4 separate games of 5 levels each, with 6 variants of each level. And then I did one better. After working with the levels themselves, I produced a version that loads both halves from a single structure block. Now that that 4×5 corridor can hold even more levels. Plenty of room for expansion.

This week, my lesson has been about building a team. My skills don’t quite encompass the full spectrum of tasks that need to be done. As I was starting my writeup, a fellow Titancraft member, jamcdonald120 just agreed to help with the scoreboard commands. As soon as I get the files transferred over to my server computer, I’m looking to have him help me with those.

Final Question: Did you know that, even though it will work and act all normal, MineCraft 1.13 pre-releases don’t seem to like dashes in their file names?

Open Beta

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I’m opening up my turtle program for open beta. But first, a few words about the challenges I dealt with this week. Let’s get started!

Timings. My greatest enemy this week was timings. Something might be a little off and an item slips in when a turtle is busy and the whole thing breaks. I had to put several lines of code in to print to the console just to figure out when an item made it in to glitch the system. I can only imagine how much more I’m going to have that problem when using a more sophisticated robot.

I’m declaring all my programs at version 0.9 for the purpose of beta testing. In the future, I may use a different scheme, but I will need to look into it farther first.

My notes assume you have a stable installation of ComputerCraft (specifically the Computeacube implementation.) I developed it under 1.12.2 Forge.

Link to code: https://letsbuildroboticswithshadow8472.com/?page_id=275&preview=true

Final Question: Practical question, What bugs are left in my code?

A Final Delay

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am delaying the publication of my modded MineCraft skeleton farm. Let’s get started.

For the past month or so, I’ve noticed I’m on an on-week, off-week cycle. This was an off-week. I didn’t get the project finished, despite how little there seemed to be left. When I publish, I want to make sure my code is solid and well-documented. I may have a workable prototype, but with the constant lack of concentration, I ended up with almost zero progress.

For when I do make progress, I have a few challenges in the way of making a solid program. Parallel editing between an in-game editor and an out-of-game editor often leaves me behind in either one or the other spots; I either find myself fixing the same bug over and over again in the same program each time I make a new transfer (usually the case when I have a bunch of tiny, bug fix type edits), or I have to make a new transfer to propagate extensive changes. I plan on publishing when I can transfer straight from Notepad++ to ComputerCraft.

Up until now, I’ve been working purely in survival server across the room. Maybe I should consider working in a creative, single-player. That’s it. I’ll edit my code directly from Notepad++ and run it in-game. I’ll be able to drop the version number nonsense, and my busywork will drop off dramatically. Why didn’t I think about this a month ago?! I suppose I did, but the server computer is across the room, and the station is frequently occupied. I know ComputerCraft has some PastBin feature, but I don’t want to mess with that yet/ever.

Final Question: I know this has been a short blog with a lack of time spent on it, but I feel like this week, I made more progress than any other week working on this project so far. Have you ever had a comparable moment of inspiration?

Prototype Automated Spawner

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am going over my completed pure ComputerCraft prototype automated spawner. Let’s get started.

I now have a turtle program I’m mostly, but not completely happy with. The notepad++ doc I originally coded now has the bugfixes I missed while parallel coding, but there’s still a bug when the program is deployed across many turtles. As of this writing, I have yet to look into it, but it’s simple enough to repair for a functional prototype.

I’ve turned my attention to the other two programs. I have a program to attack the gathered mobs, and it works at about 98% for a pretty heavy load, but it’s sloppily coded. I will be reworking it before publishing. When will I publish? I honestly don’t know. Whenever it’s done. At this point, I doubt I have anyone waiting on it, but at the same time, if I did, I’d be asking for help.

Long story short, I’m focusing on a program to filter out matching items before the attack program. Already, I’m considering potential benefits of making a custom library. One function, itemOut(), should be useful for a lot of turtle programs. As long as I use the same variables it depends on, I can just copy it into each program. A library would let me just access it without having to have it in each program. With a little modification, I might even be able to write some code to read a comment in the header and get library version numbers… and with a little expansion, I could setup a software update system.

Unfortunately, that neat idea is unlikely to save me any time. I don’t think it’s likely to happen unless I come back to ComputerCraft in a while. I want to get back around into more real world applications some time here.

Getting back on topic: the sorting program. I’m trying to recycle as many of my ideas for the loot repair program as possible. I started with the getState-action structure. As mentioned earlier, itemOut() is exactly the same. I do have an evalItem() function in both programs, but I have no desire to try and reconcile the two. Even if there were a way to make a unified evalItem() function, getState() itself must be different; the two programs have different possible states. Of course, good programming gives you a “control panel” of variables to edit.

Final Question: For anyone who knows: What is the best tutorial for Gazebo?

Debugged and Ready for Polish

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am updating my progress on my LootRepair program. Let’s get started.

It wasn’t easy, but I finished pulling the crippling bugs out of my program. Using the turtle’s actual state as the program’s state was a good call. It can more easily handle an unexpected situation and sometimes auto-correct in the case of a minor inefficiency, like when I was missing a line of code to select slot 1 before crafting.

I think the biggest bug I had was my use of an OR statement. The line was:

elseif state == “good2” or “new2” then

I thought the logic was

IF state MATCHES (EITHER “good2” OR “new2”) THEN DO THIS CODE.

When it was more like,

IF (state MATCHES “good1”) OR (“new1” ISN’T false) THEN

Note the elseif statement. I had two such options in my huge list of things to do. I ended up just removing all traces of the “new” states  since they did exactly the same thing as the “good” states.

Another bug I pulled out involved confusion over bitwise operations. I was having trouble with what I thought was the “correct” way to bitshift a set of 2 bit flags for comparison; the exact required steps of which escaped me, so I pulled a programmer’s trick and did it slightly differently, by shifting the flag to be read to the 1’s and 2’s places, instead of moving the mask reading the code.

Pulling that tough bug was an interesting journey, taking up a couple days. For a while, I thought it was a problem with the limitations of the 80’s style computing model (tiny floppies can get filled up when you have about 5 backup copies of a program with 200-300 lines of code.) I had it printing the program state from a variable at each elseif statement for handling the state, but it was only after I appended a hard-coded confirmation of the state that I spotted the error.

With the prototype program thoroughly tested and (hopefully) debugged, I set it to work on four turtles. The good news is that they can work, but the bad news is that they still need someone to check in from time to time; one of the turtles keeps losing track of the item it’s supposed to repair. I haven’t even tried to tackle that one yet.

My program is almost ready. Once I finish this round of it, I plan on redoing the melee turtles under the same state-do something model. If I’m bored and don’t have anything else to do, I may even look into redeveloping this into either a custom API or framework (I’m not sure what the proper word is here).

Final Question: ComputerCraft has been perfect for getting into coding, but I feel I’ve been lacking in the presentation of actual code. Any idea on how you’re supposed to denote that with WordPress?