Barbosik / MultiOgar

An open source Ogar server implementation, written with Node.js.
Other
61 stars 44 forks source link

Docs? #437

Closed 253153 closed 7 years ago

253153 commented 7 years ago

I am unable to find any documentation or comments for this project to help me get started. Can someone please point me in the right direction, or share their comments for this script if there are no public ones right now? Thanks!

chuushi commented 7 years ago

What do you want to do? The installation is right here. That's how you can get started.

If you want to edit the source files, you'll have to disassemble the code yourself. You may need preliminary knowledge on Node.js before you can do so.

253153 commented 7 years ago

I want to add additional features, such as skin rotation. I have knowledge of Node.js, but am having trouble with some things due to lack of documentation. I was hoping someone could possibly have documentation they made themselves to share.

makandz commented 7 years ago

Skin rotation is client sided just to let you know. The server is used to transmit information about the cell, rendering and other such stuff are done on the client itself.

253153 commented 7 years ago

@MastaCoder I would like to add skin rotation to all the Players, so everyone can see each others rotation, not just the current Player. Can that be done just on the client?

makandz commented 7 years ago

Yep.

253153 commented 7 years ago

@MastaCoder Thank you, but what would I use for other Players, I know for the current player I can use mouseX and mouseY, but for other players? Current rotation code (works for the current player that is playing the game, but doesn't show rotation of other players):

                    var dx = rawMouseX - (canvasWidth / 2); // get the mouse x position on the screen
                    var dy = rawMouseY - (canvasHeight / 2); // get the mouse Y position on the screen
                    var theta; // the radeon angle that the current player needs to be rated by
                    // the following two if statements are made to accommodate some skins which need need flipping when they are turning
                    if (rawMouseX > canvasWidth / 2) {
                        // mouse is on right side
                        ctx.scale(1, -1); // Flip the canvas context, since it needs to be flipped when its looking right
                        theta = (-Math.atan2(dy, dx) - Math.PI / 2);
                    }
                    if (rawMouseX < canvasWidth / 2) {
                        // mouse in on left side
                        theta = (Math.atan2(dy, dx) - Math.PI / 2);
                    }
                    ctx.rotate(theta);

Any clues would be highly appreciated. Thank you!

makandz commented 7 years ago

I don't think I can really tell without knowing the whole script. Skin rotation as well, I have never tried. (yet)

253153 commented 7 years ago

@MastaCoder What values would I use to determine the rotation on the client, for other players? Like, in general (I dont need the exact variable names). I am trying to figure out how to do it on the client only, you said its possible on the client, but with what values? I am using the Cigar.io client, but really it can be done with any client right? Thank you.

makandz commented 7 years ago

It should be just have them turn towards the point of mouse. But I don't think their is a way to move it towards something, I'm pretty sure it's rotate? (Judging by http://stackoverflow.com/questions/17411991/html5-canvas-rotate-image)

So you'll have to find ways to get the cell to rotate using some sort of formula towards the mouse positions. (Haven't tried ANY of this, so I can't confirm if I'm even right!)