Code Monkey home page Code Monkey logo

io-game's Introduction

Preview

Build status Quality Gate Status Lines of Code Bugs GitHub license Issues GitHub stars GitHub forks


io-game is a networking prototype using sockets and express to communicate over the network, p5.js for the graphics and input, and electron.js for cross-platform support. The end goal is to create a online RPG syncing over various elements such as NPCs, chat messages and other transforms.


Thanks to electron the game has the potential to run on Windows, Linux, Mac and any web browser.

Due to the limitations of the p5.js graphics library and the complexity of three.js, this project has been discontinued and is now a relic in time. I'm still open to working on it if anyone has any suggestions.

Setup

  1. Clone https://github.com/valkyrienyanko/io-game-v2.git
  2. Download and install LTS Node.js
  3. Make sure you have yarn installed npm i -g yarn
  4. Run yarn install
  5. Start server with yarn dev:server
  6. Create a client by opening up localhost:7777/ in your browser

Building

Use yarn build to build the electron app.

Libraries

io-game's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar guilhermefaga avatar valkyrienyanko avatar your-average-bear avatar

Stargazers

 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

io-game's Issues

Dragging Chat Offscreen

Describe the Bug

Dragging the chat off screen increases the client window size.

Steps to Reproduce

Drag the chat off screen in game. Follow the steps in the readme to setup a client and server.

Expected behavior

Dragging the chat off screen shouldn't be allowed.

Suggestions

If the chat is getting in the users way, perhaps add a minimize button?

Screenshots

Image

Chat History Enhancements

Allow client to drag the div container containing the chat history and input around the page?

Chat History / Input Box should instantly appear when the client presses enter and fade naturally over time when no input is being pressed.

Curse filters -> replace curses with meeooowww or ******** or something similar.

License

I need someone to walk me through the pros and cons of each license.

Ghost Client

Issue

Ghost client appearing after server restart. game.players gets populated when it shouldn't.

Steps to Reproduce

Read setup on how to setup client and server.

Have 2 clients open. Client A and B. Connect both of them. Restart server with rs. Connect with client A, you will see ghost clone of client A at center of spawn.

Some Chat History Bugs

Describe the bug

Bug 1

The chat history does not auto scroll down when chat messages are filled inside it.

Bug 2

You can resize the chat to be almost non-visible.

Expected behavior
Chat history should auto scroll with messages.
Chat history should have a minimum and maximum resize limit.

Screenshots
Image

No Shadows

p5.js lacks shadow / drop shadow support.

Linter not working

yarn lint and yarn lint:fix compile successfully but do not do anything nor give any useful feedback?

Preview

Chat Improvements

  • Spam Cooldown
  • Better Swear Filter (Even though "F u c k" is in the list it does not get blocked)

Trees not Aligning on Rotate

Before rotateX(90) would make it appear like it had the right rotation, but it was off by a bit. However, rotateX(HALF_PI) seems to provide the correct rotation.

More Chat System Features

Global Chat

Displayed at bottom left or maybe will allow the client to drag it around?

Auto Moderation

Curse filters -> replace curses with meeooowww or ******** or something similar.

Max Zoom

When you zoom to the maximum amount, part of the sphere will be cut off and you can see straight lines that make up the objects. Also, the text has a white background.
image

Weapons / Tools

Create animations for such things client side and sync their logic server side.

Account and Friend Management

Describe the feature you want added:

User has to create an account with the following details before being able to play.

  • Username (x character limit) (block filtered words)
  • Password
  • Email (account protection) (newsletter - user must check this to enable)

The account can be further edited to add the following.

  • Profile Picture
  • Status Message (x character limit)

This will allow us to create a user interface in game showing all the players accounts and whether their offline or online. This will allow the following.

  • Friend Requests
  • Friend DMs
  • Blocking Accounts
  • Reporting Accounts

Accounts will also allow us to make other things easier as well such as.

  • Currency / Resource / Item Management
  • Databases

Message Bug

Issue

I'm having a issue I can't seem to figure out. Consider the following scenario. I have 2 clients. Client A and client B. Client A says "foo". Client A and client B see "foo" for 1 second then it disappears. Then Client B says "bar" and Client A and Client B see "bar" on client B but they also see "foo" on client A. The problem is we're seeing messages that we're suppose to be erased. So for e.g. if there were 20 clients connected and every client said at least one message and 1 second of time passed and all the messages disappeared, then one client decided to say something, every client would not just see their message but all the previous messages on all the other clients as well.

server.js https://github.com/valkyrienyanko/io-game-v2/blob/master/server.js
Lines of interest: line 73

client.js https://github.com/valkyrienyanko/io-game-v2/blob/master/public/scripts/client.js
Lines of interest: line 149 and 153

player.js https://github.com/valkyrienyanko/io-game-v2/blob/master/public/scripts/classes/player.js
Lines of interest: lines 29 - 38

Steps to Reproduce

Follow the setup to create at least 2 clients "A" and "B". Have clients side by side so you can see what's going on in both clients at the same time. In client A, press to open up the chat and type "foo", press again to send. Do the same for client B but this time say "bar". You should see the problem now.

Custom Cursor

Describe the feature you want added:

Cursor RPG Art?

Project refactoring

There a few things in the project that I believe are worth changing, namely:

  • Don't use batch/cmd files, migrate to npm scripts or gulp (if lengthier or complicated scripts are required) instead
  • Use local packages instead of installing global packages using npx (Installed with node.js by default)
  • Use a CDN for Libraries such as p5.js
  • Rename classes/ to model/ (files such as util should not be classes and instead use functions)

A few suggestions as well:

  • Migrate to yarn, a package manager with more features (and looks nicer too!)
  • Since this is an open source project, use a linter (I would suggest standard.js)
  • Add GitHub Issue/PR templates

I would be happy to start a PR to implement any/all of these changes.

Collisions

When I walk ontop of another client, our sprites interfere with each other. Perhaps you could draw one on top of the other?
image

Dynamic Settings

If dynamic settings is active, graphics will be adjusted accordingly based on current frame rate.

Graphic Limitations

Leaning more towards OpenGL and whatever networking library it has to offer.

Player Turns Gradually instead of Instantly

Right now the player is facing the mouse cursor instantly.
https://github.com/valkyrienyanko/io-game/blob/143c82575b391c66ad8f5b93b281499d46c29e7c/public/scripts/model/Player.js#L67

How would you make it so the player turns gradually instead?

Note the following built in p5.js functions that might come in handy for this.

Found similar issue on stack overflow.
https://stackoverflow.com/questions/5701006/ease-rotation-towards-the-mouse/5703866#5703866.html

Cannot Connect Externally

I use to be able to connect externally before but now I can only connect internally via localhost:7777?

Three.js Text

Looking for someone who can draw HTML text to canvas using three.js.

Unknown Networking Fault

client.js:163 Uncaught TypeError: Cannot read property 'updateMessage' of undefined
    at Socket.<anonymous> (client.js:163)
    at Socket.Emitter.emit (index.js:138)
    at Socket.onevent (socket.js:282)
    at Socket.onpacket (socket.js:241)
    at Manager.<anonymous> (index.js:23)
    at Manager.Emitter.emit (index.js:138)
    at Manager.ondecoded (manager.js:350)
    at Decoder.<anonymous> (index.js:23)
    at Decoder.Emitter.emit (index.js:138)
    at Decoder.add (index.js:256)

I've added a undefined check to suppress it and prevent crash for client. Not tested.

game.socket.on('messages', function(data) {
  if (data.id == game.player.id) {
    game.player.updateMessage(data.text);
  } else {
    // Should we delete the player at game.players[data.id] here? Or just check if its not undefined?
    if (game.players[data.id] != undefined)
      game.players[data.id].updateMessage(data.text);
  }
});

Dynamic Versioning

How do you get release-it working?

How do you change the version automatically in package.json?

Typescript Migration?

Is your feature request related to a problem? Please describe.
Typescript adds a lot of useful features.

Describe the solution you'd like
Every .js file to be converted to typescript .ts.

Describe alternatives you've considered
Ignore typescript completely.

Additional context
Would clean up a lot of code.

Fuzzy Movement

Describe the Bug

Other players look fuzzy when they move around.

Steps to Reproduce

Play with other people.

Expected behavior

No fuzzy movement.

electron build error

Error: Application entry file "server.js" in the "C:\Users\valkyrienyanko\Desktop\io-game-v2\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.

No Names Cause Error

Describe the Bug

Console spits out this error when someone joins with no name.

client.js:210 Uncaught TypeError: Cannot read property 'name' of undefined
    at Socket.<anonymous> (client.js:210)
    at Socket.Emitter.emit (index.js:138)
    at Socket.onevent (socket.js:282)
    at Socket.onpacket (socket.js:241)
    at Manager.<anonymous> (index.js:23)
    at Manager.Emitter.emit (index.js:138)
    at Manager.ondecoded (manager.js:350)
    at Decoder.<anonymous> (index.js:23)
    at Decoder.Emitter.emit (index.js:138)
    at Decoder.add (index.js:256)

Steps to Reproduce

Play with someone else who has no name.

Expected behavior

Error handling should take place.

Screenshots

Preview

p5.js Alternatives

Someone suggested using Unity and exporting to WEBGL.

I can see some pros and cons to this.

Pros

  • Support for more complex 3D models, and bone systems. (p5.js only supports .obj .stl models, never looked into .stl yet, don't know if it has what I'm looking for)
  • Post Processing

Cons

  • Have to deal with Unity performance bugs. (or is this just me?)

Or maybe we should convert from p5.js to three.js https://github.com/mrdoob/three.js/
Someone even made a post processing addon for it https://github.com/vanruesc/postprocessing

three.js camera camera not smooth

When changing z position of three.js camera, the green cube does not look smooth at all.

See for yourself, clone the three branch.

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.