Automation Techs For Productivity And Fun

Showing posts with label games. Show all posts
Showing posts with label games. Show all posts

Create A Block Breaker Viewer (Not A Game Yet) With Vue.js And SVG

Using Vue.js and SVG looks like the best choice for a web programmer who wants to create interactive games for kids.

I'm working on a Breakout game for practice, and it's much easier than I thought so far.

You can see it moving here. It doesn't have any event listeners, so you can just watch the balls breaking the blocks.

Source is on GitHub:


3 Ways To Run Commands Externally For Minecraft Bedrock Edition

My kids are into Minecraft lately, especially for building houses and other buildings in Creative Mode. It's like playing with LEGO blocks in a virtual world.

Minecraft provides a command system to control the world, like putting blocks to specified point and teleporting objects. And I found some ways to run these commands from outside of Minecraft, that means that I can create programs to build complex buildings automatically without clicking or tapping for each block.

These are the 3 ways I found to run Minecraft commands from external programs.

Using "function" command

The first and the easiest way is to use the "function" command.

As it's explained in the document above, create a function file with the extension ".mcfunction", write list of commands in it, and save it in function file directory.

If you create a function file named "Sample1.mcfunction", you can run in Minecraft by using the function command like this:

/function Sample1

The "function" command was only allowed in Java Edition before, but it was added to Bedrock Edition in version 1.8.

MakeCode For Minecraft

The second way is to use MakeCode For Minecraft.

This is a Scratch like graphical application provided by Microsoft. You can create a custom command by dragging and dropping Minecraft commands together. It seems custom commands are converted to Javascript programs, and you can also write custom commands directly with Javascript.

I think this is the best way for kids, not only for automation, but also for programming education.

Unfortunately I couldn't use this app because my Windows PC was too weak to run Minecraft and MakeCode together.

Creating An Original WebSocket Server

This is the third way, and the way I've adopted.

As I wrote above, MakeCode was too heavy for my Windows PC, so I needed a more lightweight tool to send commands to Minecraft. MakeCode communicates with Minecraft using WebSocket, so it should be possible to replace MakeCode with another original lightweight WebSocket server.

I found hints from these links:

It seems Minecraft uses JSON data for request and response.

You can catch events in Minecraft by subscribing it, and run commands by firing "commandRequest"s.

What you have to do is...

  1. Write a WebSocket script to subscribe events and send command requests
  2. Start your WebSocket server
  3. Connect to your WebSocket server from Minecraft by running "/connect" command
  4. Fire events from Minecraft to trigger your custom commands

For example, I wrote a WebSocket server that puts a block in front of the player when the player says "build" with Node.js.

Connect to this server from Minecraft with "/connect" command.

/connect SERVER_IPADDRESS:3000

Then just say "build" from Minecraft, and you would see a stone brick block put in front of the player.


Whichever way you choose, it would make it easy to create more complex buildings like these.


Search This Blog


Generate Data For Testing With PostgreSQL

When developing a software using PostgreSQL database as storage, the function "generated_series" is very useful to create data ...

Powered by Blogger.


Recent Posts