Minecraft Proxy in D

The Minecraft Proxy in D will probably be started within the hour. I’m going to do some minor research and then jump into some test code and then some network code. My goal is to have a connection to a Minecraft 1.8 server running and have a miner running around mining blocks and laying track.

Oh yeah, I also want to implement contract programming and unit tests. It will slow down the development, but I think it will hopefully limit the amount of debugging and problems I’ll have during development.

  1. Compile First D Program: Hello World

    Have to start somewhere. I figure if I have this done today or within an hour, that I’ll have motivation to continue.

  2. Minecraft Protocol Module

    There probably is an existing implementation in D, but I think it will be helpful to write my own module. I need to write the code to be thread safe, but I don’t plan on implementing the network code using threads yet. I won’t have the benefit of a proxy through Minecraft software, so I’m instead going to have to implement the server authentication scheme. That is getting the authentication string and passing it to the server. This will take some time and testing.

  3. Network Code

    I’ll use the completed Minecraft Protocol module and attempt to implement the network code. I hope I don’t have to implement threading, but remembering the Java experience, I’ll probably do it anyway.

  4. Minecraft Chunk Module

    I’m kind of hoping that I won’t have to require a database and I want to see how much space is taken by the D implementation. Should be fun and interesting. I’ll probably use a multidimensional array for chunks and coordinates. Should be simple, but probably won’t be efficient. I’m going for simple and quick. I’ll refactor the code later to be more efficient, but meh, it might turn out to be efficient enough that I won’t need to use something else. Of course, if I can’t implement the array in this way, then I’ll have to come up with another design.

  5. Minecraft Entity Module

    The problem and what I’ll need to implement to create some sort of intelligence is to track entities. This is something, I don’t currently handle and for what I’m planning I’m going to need to do it. The problem so far is that I don’t know where monsters, mobs and other players are. I need to be able to track this information to ensure that my code correctly handles each mob or player.

  6. A* and Dijkstra Pathfinding Module

    I had forgotten that this was a requirement. Oh well, I think I understand the A* and Dijkstra pathfinding algorithms enough now that this shouldn’t be that difficult. Or I’ll simply brute force it. I’ll probably require this be a separate thread, crap now I need to solve many different thread and dead locking with the Chunk Module. It is possible that I could have this part of the Chunk Module and simply spawn a new thread and when it completes pass it back to the caller. It depends on where the pathfinding will be.

  7. Intelligence Module(?)

    I’m debating this. Creating a Fuzzy Logic module could take anywhere from half a day to 2 weeks. I’m not sure what benefit I’ll get from it either. I want to do it, but I’m kind of hoping that I can kludge my way through some sort of algorithm that sort of doing something similar.

    I don’t know, it will be worth looking into implementing it, since a lot of the code I’ll be writing will mimic fuzzy logic. Quite possibly I’ll be saving some time instead of testing and developing it the boolean way. I don’t know. I think I’ll head down the path of not implementing true Fuzzy Logic module and instead focus on different actions.

    The main loop will check different conditions. Is there a mob within 20 meters? What type of mob is it? Does the mob have a direct line of sight? What is the players health? Is there a weapon available? Meh, it will probably be worth investing the time implementing fuzzy logic just so that I’m not writing a ton of code that will be damn near impossible to debug.

  8. Behavior Module

    My goal ultimately is to separate tasks into behaviors and then into sub actions using the intelligence module. In this way, I’ll be switching between behaviors and focusing on completing the task.

  9. Chat Module

    I’m not going to be handling this intelligently. I’m simply going to pass commands to the player using chat commands. Therefore, the code needs to be able to parse the chat and pick up on the commands. At some point in the future, I may extend the code to intelligently talk to others using the chat dialogue. Since majority of the players will be on my own personal server, I don’t really see a need to spend a lot of time on this.

Behaviors

  • Mining

    Majority of the time will hopefully be spent on this behavior. Mining will focus on precious resources and then collecting other resources depending on different needs. Like for building a chest might switch from one resource to collecting wood instead.

    The Mining action requires that the player know about lava, how to avoid lava, how to mine around lava and how to move lava. I think that since the player has a lot of time, that I’ll instead have the player move the lava to an area where there is an infinite water pool for pouring the lava and turning into obsidian. When the water pool is filled, then the player will mine the obsidian and put it away.

    My plan is basically to have the player mine the bottom 40 block layers everywhere. But not the ravines or new places. At some point, I’ll think of a plan for what to do with the soon to be large underground lair. I think it would also be funny to join a server and after a week or so, be like, “WTF?” I don’t know. I could go many different ways with this.

  • Crafting

    Need to set the player code to do this whenever it is needed. Mostly what will be crafted are chests, furnaces, rail, powered rail, mine carts, chest mine carts, workbench, tools and weapons.

  • Farming

    Food is important, so at certain points, the player’s character will go out and spend an hour or so collecting food by farming. Some actions might be to collect seeds, mushrooms, plant mushrooms and use bonemeal (if available).

  • Building

    At some point I want to develop the player to build rail stations or maintain current rail stations. I also want the player to build different architecture for the rail ways and maybe light houses and walls. This will also include farming land in such a way to enable efficient and maybe pretty solutions.

At this point, I’ll probably simply implement just enough of the Crafting and Mining in order to find resources and not run out of food, tools and weapons. I’ll tell the player where to go and what to do using signs, which should help the player not do something that I’ll regret.

Future

The application won’t just be AI player. I’ll eventually implement OpenGL display from the Java version to the D version using a library. I also want to implement a GUI using another library.

I think that if after this weekend I have the network code and minecraft protocol code working. I’ll be good. Probably spend a few weeks or months away from the code depending on motivation and finish up the other plans later. If I do get to the pathfinding parts, I think that will be fun and if I can implement some primitive mining code, that will be even better. I’m optimistic I can do the protocol and network code this weekend. Not so much all of the other stuff. I’ll really only have a day and a half work on this project, so not a whole lot of time. I’ll spend a day and a half working on the Python Web Spider project and end the weekend.

Possibly Related Posts:


Comments are closed.