Mushy Avocado
@MushyAvocado
I know HTML/CSS/JS and Node.js. I'm Learning Unity and C#.
0
[QUESTION] Host Unity dedicated server on Replit?How do you simulate a Windows OS and run a dedicated Unity server that does not shut off when the page is closed?
4
0
0
0
Fix choppy movement for multiplayer game?
I'm getting choppy movement with my multiplayer game I'm making. rokket.io
How I have it working right now is that the client sends its inputs to the server, and the server sends the client's position and the position of the other players to the client. The client attempts to predict where its player is currently at by getting the time the server sent the update and drawing the player a few frames ahead based on the ping. The player position is lerped, so it should look smooth.
"lerp" is used here as a verb for linear interpolation
The problem is the player shakes. It can be a lot if the ping is bad. I think it has to do with the fluctuation in ping between the client and server, so if the ping is 100ms, it predicts ahead a lot, and if it's 20ms, it goes back because it doesn't predict ahead as much. Is my theory correct? Is there a way to fix this without lowering the speed it lerps to the correct spot? But then it would just make it lag behind...
I could use some suggestions. The code is well-commented to show what's going on. All the game is right now is rockets moving around. Please do not take code/art from this game.5
1
0
1
BASIC ES6 FEATURES
BASIC ES6 FEATURES
Hope this helps!
let and const
let is very similar to var. You can read about the difference here.
const is short for constant. It does just that. Its value can't be changed, or it will throw an error. This does not apply to the properties of the constant. They can be changed.
Arrow functions
Arrow functions are a really nice shorthand for a function definition. It goes like this:
// Or let or var
const functionName = (arg1, arg2, arg3) => {
// stuff goes here
};
You can also do it on a single line. It returns whatever the output is. Example:
`const baz = (num1, num2) => num1 + num2;
baz(10, 5); // output: 15`
Classes
These are the best new feature. You know how object inheritance is a pain with prototype-based OOP? It's really easy with classes. Like this:
// Define the class
class Person {
// This is what's called on object creation
constructor (name, mood) {
this.name = name;
this.mood= mood;
}
// This is how you define a method
greet () {
console.log('Hello I\'m ' + this.name);
}
myMood () {
console.log('My mood is: ' + this.mood);
}
}
const person = new Person('Mushy', 'code');
person.greet(); // Output: Hello I'm Mushy
// Coder inherits Person class
class Coder extends Person {
constructor (name, username) {
// The "super" keyword references the parent
// Inside the constructor, it is the corresponding constructor
// on the parent.
super(username, 'code');
this.username = username;
}
profile () {
console.log('My profile is https://replit.com/@' + this.username);
}
}
const mushy = new Coder('Mushy', 'MushyAvocado');
mushy.greet(); // output: Hello I'm Mushy
mushy.profile(); // output: My profile is https://replit.com/@MushyAvocado
`4
2
1
Tiny
a new perspective
You wake up and realize something's wrong when blades of grass tower above you as thick as tree trunks. Make your way to your
HTML, CSS, JS
CheeseTheRat Could you add a way to open your unlocks on mobile? Its a big problem and makes the game way harder, but otherwise great game!1 year ago
EdwardBentler That was amazing! The difficulty wasn't too hard or easy, the gameplay was fun, and I was constantly challenged, and that ending was pretty good.1 year ago
7
TinyYou wake up and realize something is wrong when blades of grass tower above you like tree trunks. Journey through your own backyard and fight for your life. Make your way to your shrink ray to return to original size.
Discover a miniature world that is overlooked by humans.
A new perspective
Feedback would be appreciated
This game was submitted for the 2021 Kajam contest.
163
26
7
What I want is simple. I took the Kaboom.js platformer template and I'm learning from it. The ground always has grass on top, but I want it to change