Code Monkey home page Code Monkey logo

swordbattle.io-legacy's Introduction

End of Support

It's been a long journey of me maintaining this mess of a codebase for 2+ years and I think it's time to move on... I will no longer be actively maintaining the legacy codebase.

The adventure doesn't stop here! Check out the new and updated swordbattle code here!

Welcome!

Swordbattle.io is a multiplayer game where players fight each other with diffrent 2D swords, and try to gain coins. The more coins you have, the bigger and powerful you get! Try to become the biggest of them all.

Play now at swordbattle.io and see the leaderboard.

Community

Usage

A more detailed guide will be released soon but for now, follow these instructions:

  1. Clone this repository with git clone or Github desktop
  2. Cd into your folder and run npm i and node setup
  3. DEVELOPERS ONLY: After each client change, build with npm run build (you can alternatively use npm run watch to automatically build on client changes)
  4. Start the program with node .
  5. View the game by going to localhost:3000 in your browser

License

You can use this code as a base for your IO games, but please change it to a considerable amount to make it a different game. Under libaries and code you used, please add a link to this github respiratory. Furthermore, under the GPL License, your game MUST also be open source. You cannot just take this free code and make it proprietary.

Thanks.

DigitalOcean Referral Badge

swordbattle.io-legacy's People

Contributors

3xcpy avatar avalanche000 avatar codergautam avatar cosmicwarlord avatar dillonb07 avatar eesazahed avatar hello-smile6 avatar jeffreywangdev avatar luis9799 avatar m626znq avatar makonede avatar manage-passwords avatar mollthecoder avatar neverwincsgo avatar not-a-ethan avatar py660 avatar realsketchxcoding avatar ruiwenge2 avatar simmbiote avatar sk337 avatar sonicx180 avatar yanxiaodi avatar yhuakim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swordbattle.io-legacy's Issues

Add groups

You should add groups based by account usernames. It should have a chat and also immunity to your groups members.So like your friends can all work together and get the most coins.

Mobile Support

Allow mobile players to join.

  • Fix viewport function for mobile
  • Add mobile Joystick
  • Hit button for mobile

Server-sided Interpolation Prediction

Right now, the client uses interpolation to make movements smoother. The problem is that a player might appear in a different position on a clients screen, and they might actually be in a different position on the server. This sometimes breaks collisons and hit reg. We have to make the server predict where the player might show up for that specific client and check accordingly. Heres how I picture it:

  • Get time when player movement sent to a specific client
  • Add clients ping to that time. This will be the time when player started moving on that client.
  • When that client sends a hit, get current time and Minus the player starting moving time. This will be the time spent moving
  • Using a loop, run interpolation logic on server for time spent moving.
  • Get the position from interpolation on server, and check collisions with that instead of actual position

Idk if this will work, this is just theory

Limit Max Scale

So that people don't conquer the whole map. When you hit scale 10, you will "win" the game.

FIX SPEED!

Sending "move" with controller moves the player by 5px.

People with higher fps sends move more times than people with less FPS

Server side update position by fps

Better Respawn

Make a better respawn system that doesn't just refresh the page. Also don't disconnect the sockets when they die.

Websocket Error

When I try and play the game (in new tab), this error message appears:

Failed to connect to the server, please try a different server or contact devs.
Error: websocket error

Security vulnerability involving man-in-the-middle attacks

Vulnerability:

If someone were to wait for socket.io to load, then overwrote the io function, they could perform a man-in-the-middle attack and hack/bot the game.

How to fix it:

You would need to webpack the socket.io script into your main code, that way it can't be overwritten.

Draw boudnary

Add a visual border on the client so people can see where the border is. Right now the border is invisible.

Hosting

Replit's hosting is great for basic websites. However, if it was ever, this isn't a basic website anymore. Maybe use some sort of free hosting like Heroku, vercel etc - I don't know what JS apps would use

This would probably help with performance a lot!

Coin not collecting

Since small people are moving so fast the server misses some points the player has been at.
Sometimes players don't pick coins if they move too fast.
Fix this by using eclipse circle collision instead of circle circle

Knockback

When someone get's hit, they get pushed back. Make sure they can't escape the border this way.

Mini Map

I think you should add a mini map to help players know their location on the map, and so that you can just hide from your opponents.

Leaderboard

A leaderboard that shows the players with the most coins

Knockback resistance and power.

Big players have high resistance and high power.
Small players have low resistance and low power.
Deal knockback according to resistance and power

Home Screen

Add a home screen before player joins into game.

Health

Kinda goes with #10

Make it so that people aren't one shot. People's health will be reduced when they get hit. When health is 0, kill them.

  • Health Property in Player Class
  • Take damage when hit
  • Health Bar

Bad Words

A lot of times people will use bad words in their names but that shouldn't be allowed.

Dynamic Resize

When player resizes the game, the game should adapt to the new screen size.
Also should fix sword rotation on resize.

Health Regen

You regen health if you aren't hit for the past 5 seconds

Names

Let players have names.
There should be a textbox in Home Screen
#5

The player name should be displayed above player in game.

add highscore

you can do this with cookies

you can add a leaderboard too if you want

Readable Code

Ay ay, please install some Visual Studio Code extensions (formatters like Prettier and linters like ESLint) and format your documents/files.

Fix 2x speed when going diagonally

If the up and the right key are pressed at the same time (two motions activated), the motion forward will be 0.707normal speed and the motion to the right will be 0.707 normal speed.

Prevent Hitbox Spoofing

Right now the client sends hitbox packets to the server, which means it can easily be spoofed.

Calculating hitbox on server side reduces risk of reach/infiniteaura hack

  • Server-sided SwordPos
  • Server-sided Hitbox

How to play screen

Create a how to play button in the home page with basic instructions on how to play sword.io!

Collectibles

Add collectibles like coins that the player can collect.

Should be dropped when a player dies, and should also randomly spawn around the map.

Sword Animation

Right now sword animation looks a bit bad make the sword smoothly swing.

Sound

Add sound in the game

fix movement

like when you move it doesnt show up on the other clients

Zoom Out Camera When Collect Coin

When you collect a coin, the player gets bigger. After a while, the player gets so big that it fills the whole screen. To prevent this, we must zoom out the camera when the player gets a coin.

Options menu

Add an options menu with things like:

  • Volume control, separated across sections like music and SFX
  • Disabling #38
  • Possibly different game backgrounds instead of just grass
  • Text font options?

Coin not clearing

The coins that spawn when you die still show up after respawn. Clear it.

PIXI Rewrite

Rewrite the client in PIXI. This will be a hard thing to do, but it's necessary. Phaser has some limitations, and PIXI allows more control over the client.

Particle hit effect

Add an effect that comes when you hit someone. Helpful for knowing if you hit someone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.