Comments (14)
Guys do you guys sometimes get the chills playing minekhan like you arent alone there is someone else playing in the emty world of minekhan ???
(It would be funny if willard added herbrine for fun after basic mobs get added lol).
from minekhan.
hmm AI would be a huge thing to figure out first.
from minekhan.
hmm AI would be a huge thing to figure out first.
I'm unaware of whether Minecraft uses genuine A.I. or not, but it's no necessary, we just need a way to measure the shortest path from one block to another, and to make the mob follow it.
Mobs don't learn, they aren't smart.
from minekhan.
hmm AI would be a huge thing to figure out first.
I'm unaware of whether Minecraft uses genuine A.I. or not, but it's no necessary, we just need a way to measure the shortest path from one block to another, and to make the mob follow it.
Mobs don't learn, they aren't smart.
Let me rephrase my sentence how bout we need to just code a simple bot/AI for mobs that tell them not to fall off a cliff or not to go into a cave which would require tons more of work
Maybe There could be a different word instead of AI but 🤷
from minekhan.
These will be Very Hard, near to impossible
but only near, most likely will make the project incompable with Khan
from minekhan.
hmm AI would be a huge thing to figure out first.
I'm unaware of whether Minecraft uses genuine A.I. or not, but it's no necessary, we just need a way to measure the shortest path from one block to another, and to make the mob follow it.
Mobs don't learn, they aren't smart.
its possible for us to implement A* or some other form of naïve path finding.
from minekhan.
I just used:
this.speed = 0.1
if (this.x > p.x - (this.height / 2)) {
this.x -= this.speed / 4
;
}
if (this.x < p.x - (this.height / 2)) {
this.x += this.speed / 4;
}
if (this.z > p.z - (this.height / 2)) {
this.z -= this.speed / 4;
}
if (this.z < p.z - (this.height / 2)) {
this.z += this.speed / 4;
}
if (this.y > p.y+0.1 - (this.height / 2)) {
this.y += this.speed / 4;
}
if (this.y < p.y+0.1 - (this.height / 2)) {
this.y += this.speed / 4;
}
and
this.updateVelocity(now)
dumbest AI ever.
If you want it to rotate towards you,
function angleToPointDegrees(point1, point2) {
return (angleToPointRadians(point1, point2) * 180 / Math.PI);
}
function getPos(canvas, evt) {
var rect = canvas.getBoundingClientRect();
return {
x: evt.clientX - rect.left,
y: evt.clientY - rect.top
};
}
var playerPos = {x: p.x, z: p.z};
let now = performance.now()
let d = p.direction
this.yaw = -angleToPointRadians(playerPos, this) + 110;
from minekhan.
Edit: this is in the modded ver. I dunno if it works on the real thing.
from minekhan.
var path = []; // Array of path branch checks
var path_switch = false; // Triggered when the generated path is switched to use
var path_i = 0; // Number of branch check iterations
var path_count = 0; // Number of path branches made
var path_end = false; // If the path has found its destination
var path_loopcount = 0; // Number of path entries to check
var path_target_x = 0; // Target X co-ordinate
var path_target_y = 0; // Target Y co-ordinate
var path_start_x = 0; // Starting X co-ordinate
var path_start_y = 0; // Starting Y co-ordinate
var path_parent_x = 0; // Stored parent X co-ordinate for building final path
var path_parent_y = 0; // Stored parent Y co-ordinate for building final path
var path_done = []; // Final path
var path_done_count = 0; // Final path count
var path_coords = []; // Recorded co-ordinates of each move for mapping best path when a proper one isn't possible
var path_coords_count = 0; // Number of recorded co-ordinates
var path_store_x = 0; // Closest possible co-ordinate if the path isn't possible
var path_store_y = 0; // Closest possible co-ordinate if the path isn't possible
var path_store_n = 0; // How close a set of co-ordinates is to the target
var path_limit = 3000; // Number of steps in the pathfinder
function calcPath(x1,y1) {
// Set target location
path_target_x = Math.floor((Math.abs(screen_x)+x1-(bound_x*0.2))/gridsize);
path_target_y = Math.floor((Math.abs(screen_y)+y1-(bound_y*0.2))/gridsize);
// Set current location
path_start_x = Math.floor(((spawn_x*gridsize)+xoffset)/gridsize);
path_start_y = Math.floor(((spawn_y*gridsize)+yoffset)/gridsize);
// Build array of landscape for pathbuilding
path = [];
for (y=0; y<ls.length; y++) {
path[y] = [];
for (x=0; x<ls[0].length; x++) {
path[y][x] = '';
}
}
// Set initial variables
path_i = 0;
path_end = false;
path[path_start_y][path_start_x] = 'start';
path[(path_start_y-1)][(path_start_x)] = 'up';
path[(path_start_y+1)][(path_start_x)] = 'down';
path[(path_start_y)][(path_start_x-1)] = 'left';
path[(path_start_y)][(path_start_x+1)] = 'right';
path_coords = [];
path_coords_count = 0;
cx = path_start_x;
cy = path_start_y;
p_dir = 'right';
p_num = 1;
p_count = 0;
// Main checker
while (path_i<path_limit&&!path_end) {
//alert(p_num+' - '+p_count+' - '+p_dir)
cancel = false;
// Spiral outwards from starting position to check tiles
if (p_dir=='right') {
if (p_count<=p_num) {
p_count++;
cx += 1;
if (p_count==p_num) {
p_dir = 'down';
p_count = 0;
}
}
}
else if (p_dir=='down') {
if (p_count<=p_num) {
p_count++;
cy += 1;
if (p_count==p_num) {
p_dir = 'left';
p_count = 0;
p_num++;
}
}
}
else if (p_dir=='left') {
if (p_count<=p_num) {
p_count++;
cx -= 1;
if (p_count==p_num) {
p_dir = 'up';
p_count = 0;
}
}
}
else if (p_dir=='up') {
if (p_count<=p_num) {
p_count++;
cy -= 1;
if (p_count==p_num) {
p_dir = 'right';
p_count = 0;
p_num++;
}
}
}
// Limit spiral to within the area
if (cy<1) { cancel = true; }
if (cx<1) { cancel = true; }
if ((ls.length-2)<cy) { cancel = true; }
if ((ls[0].length-2)<cx) { cancel = true; }
// Check current tile
if (!cancel&&path[cy][cx]!=''&&path[cy][cx]!='start') {
// If down is free
if (!calcPathTiles(cx,cy+1)&&path[(cy+1)][(cx)]=='') {
path_coords[path_coords_count] = [cx,cy+1];
path_coords_count++;
path[(cy+1)][(cx)] = 'down';
}
// If right is free
if (!calcPathTiles(cx+1,cy)&&path[(cy)][(cx+1)]=='') {
path_coords[path_coords_count] = [cx+1,cy];
path_coords_count++;
path[(cy)][(cx+1)] = 'right';
}
// If up is free
if (!calcPathTiles(cx,cy-1)&&path[(cy-1)][(cx)]=='') {
path_coords[path_coords_count] = [cx,cy-1];
path_coords_count++;
path[(cy-1)][(cx)] = 'up';
}
// If left is free
if (!calcPathTiles(cx-1,cy)&&path[(cy)][(cx-1)]=='') {
path_coords[path_coords_count] = [cx-1,cy];
path_coords_count++;
path[(cy)][(cx-1)] = 'left';
}
}
if (path[path_target_y][path_target_x]!='') {
path_end = true;
}
path_i++; // Count iterations
}
// If we didn't find the destination get the closest co-ordinate
if (!path_end) {
path_store_x = 0; // Closest X co-ordinate
path_store_y = 0; // Closest Y co-ordinate
path_store_n = 100000; // Number value of how close it is
// Loop through all recorded co-ordinates
for (i=0; i<path_coords_count; i++) {
nx = Math.abs(path_target_x-path_coords[i][0]);
ny = Math.abs(path_target_y-path_coords[i][1]);
// If current co-ordinate is closer to the target than the current closest
if ((nx+ny)<path_store_n) {
path_store_x = path_coords[i][0]; // Set current closest X co-ordinate
path_store_y = path_coords[i][1]; // Set current closest Y co-ordinate
path_store_n = nx+ny; // Set current close value to check by
}
}
px1 = path_store_x; // Set the starting X co-ordinate to the closest co-ordinate
py1 = path_store_y; // Set the starting Y co-ordinate to the closest co-ordinate
// If we did find the destination
} else {
px1 = path_target_x; // Set the starting X co-ordinate to the destination
py1 = path_target_y; // Set the starting Y co-ordinate to the destination
}
// Reset the finished path map vars
path_done = [];
path_done_count = 0;
path_mapped = false;
path_mapped_i = 0;
direction1 = '';
direction2 = '';
direction3 = '';
px2 = 0; // One step forward X
py2 = 0; // One step forward Y
px3 = 0; // Two steps forward X
py3 = 0; // Two steps forward Y
diagonal = false;
// Calculate the route from the spidered array
while(!path_mapped&&(path_done_count<path_limit+20)) {
// Move co-ordinates forward a step
direction3 = direction2;
px3 = px2;
py3 = py2;
direction2 = direction1;
px2 = px1;
py2 = py1;
// Head backwards from the direction to trace the route back
direction1 = path[py1][px1];
if (direction1=='up') {
py1 = py2+1;
px1 = px2;
}
else if (direction1=='down') {
py1 = py2-1;
px1 = px2;
}
else if (direction1=='left') {
py1 = py2;
px1 = px2+1;
}
else if (direction1=='right') {
py1 = py2;
px1 = px2-1;
}
// Overwrite diagonal tiles
var overwrite = false;
if (direction1=='up') {
if (direction2=='left') {
overwrite = true;
direction1 = 'upleft';
}
if (direction2=='right') {
overwrite = true;
direction1 = 'upright';
}
}
if (direction1=='down') {
if (direction2=='left') {
overwrite = true;
direction1 = 'downleft';
}
if (direction2=='right') {
overwrite = true;
direction1 = 'downright';
}
}
if (direction1=='left') {
if (direction2=='up') {
overwrite = true;
direction1 = 'upleft';
}
if (direction2=='down') {
overwrite = true;
direction1 = 'downleft';
}
}
if (direction1=='right') {
if (direction2=='up') {
overwrite = true;
direction1 = 'upright';
}
if (direction2=='down') {
overwrite = true;
direction1 = 'downright';
}
}
if (overwrite) {
if (diagonal) {
diagonal = false;
} else {
path_done_count -= 1;
diagonal = true;
}
} else {
diagonal = false;
}
// Add to the route array the direction and co-ordinates
path_done[path_done_count] = [direction1,px1,py1];
// Count the backwards steps in the route
path_done_count++;
// If we have reached the start
if (px1==path_start_x&&py1==path_start_y) {
path_mapped = true;
}
}
}
nailed it!
from minekhan.
Took longer than expected, but I now have a fully functioning AI!
from minekhan.
Actually.... I don't. errors... errors... more errors...
I managed to do it in p5.js.... but not in js...
from minekhan.
hmm AI would be a huge thing to figure out first.
I'm unaware of whether Minecraft uses genuine A.I. or not, but it's no necessary, we just need a way to measure the shortest path from one block to another, and to make the mob follow it.
Mobs don't learn, they aren't smart.
it dosent its just path find and if else
from minekhan.
AI doesn't imply neural networks when referring to game entities, so learning has nothing to do with it. AI just refers to the logic used to control them. If you call entities pets, allies, enemies, mobs, or NPCs, you're attributing some level of intelligence to them, and that intelligence is artificial, making it AI. Even if it's stupid AI, it's still AI.
from minekhan.
yeah i figured when he said genuine ai i thought he meant like ML/DL
from minekhan.
Related Issues (20)
- [Question] Web Hosting HOT 2
- Backspace bug HOT 6
- How to fix lighting bug HOT 2
- Generation issue HOT 3
- The Far Lands??? HOT 2
- Suggestion: Better UI HOT 7
- Texture encoding HOT 5
- Iframes No Work HOT 1
- Mods(maybe i can create them?) HOT 1
- Armor NOW HOT 3
- A MOD adding music feature to the game, and a few useful commands HOT 1
- Website not updated to most recent version HOT 1
- hii HOT 3
- Banned from multiplayer HOT 1
- "Real Willard" HOT 1
- MineKhan Wiki! HOT 7
- Suggestion: 3rd Person View (edit: oops this already exists sorry) HOT 2
- Lighting Bug HOT 1
- How to know if banned HOT 2
- Banning question HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minekhan.