last day (43 days later) » 

13:55
I LOVE YOU NODE.JS
2
Yes thats silly
Tom
Tom
14:11
@Raynos poke
@Tom what?
Tom
Tom
@Raynos You said you'd only use RequireJS for packages, however if you want to separate each object into its own file, you need to use it for objects too
you build up a tree hierachy
I honestly dont know how it works and I personally wouldnt use it :D
Tom
Tom
@Raynos you'd not use requirejs?
Id namespace everything and load in libraries as and when needed
Tom
Tom
14:23
@Raynos talking with joose author now, he says there's inbuild functionality for all that (see link)
@Tom did you email him?
Tom
Tom
@Raynos, no talking on IRC
irc.freenode.net #node.js and #joose
@Tom I see. Id rather just do it myself rather then rely on those frameworks
Tom
Tom
@Raynos really? It seems really stable and well structured actually
Aslong as it doesn't limit you in anything
@Tom defeats the point of javascript for me :)
Tom
Tom
14:31
@Raynos point of javascript is to make your own worser version of goodness?
@Tom to throw objects around loosely
Tom
Tom
@Raynos I don't think joose does anything with loose typing?
@Its style preference. but using joose on the client side and the inbuild require on node.js seems fine
Tom
Tom
I think I will use joose on both server and client, you still need to use require on the server though.
@Raynos are you on ubuntu?
14:54
@Tom nuh. I am a windows guy
@Tom what are you writing in node.js ?
Tom
Tom
@Raynos up to this new project only crawlers
crawlers ?
Tom
Tom
@Raynos apps that screen scraped websites or statistical data like finance stocks
New project is supposed to be a high availabilty web server run over multiple servers
With redis, couchdb I think and some fancy web server environment and a modelling engine
I mean, the project is a website with that infrastructure
Good luck :)
Tom
Tom
@Raynos thanks ;)
@Raynos I will start with a client side application
When I am comfortable with javascript and Joose I will go server side
when I have used every framework and technology I need I will start from scratch
Back in 15 mins.
15:09
@Tom I think ill dive into the deep end with node.js render engine and websockets
15:28
And fuck up. And give up
Tom
Tom
@Raynos render engine?
@Tom renderengine.com but this isnt serious stuff. Maybe writing serious business solutions might be better
Tom
Tom
@Raynos check this example book, developer.yahoo.com/blogs/ydn/posts/2010/11/…
@Raynos that's just client side though right, not node.js
@Tom well I need a frontend for the game. and a back end for the multiplayer logic
@Tom is that you?
Tom
Tom
@Raynos yeah, would be nice if you have a easy way to handle messages between server and client
@Raynos no, I wish it was me ;)
15:39
@Tom html5 websockets
Tom
Tom
@Raynos, yeah, but you need to parse your messages on the server and client
@Tom json?
client -> javascript -> json -> server -> javascript
Tom
Tom
@Raynos, yeah, that's what JSON does ;) That's not what I mean.
You need an easy way to handle these messages, basically.
@Tom An object containing strings, each string matches a regex. If the regex fails shoot the client. if it passes then your serverside validation just passed
writing an input / output handler shouldnt be so hard
Tom
Tom
@Raynos use a JSON schema, see github.com/akidee/schema.js
15:47
@Tom yes thats even better
Tom
Tom
@Raynos still not what I meant though, I am not sure how to explain
I created a multiplayer game once in flash
Basically, it'd be nice if you only need to create a message once for both server and client
@Tom how and when to send data is a different matter
Tom
Tom
Like a general place for messages and both server and client need to understand them
@Raynos when you create your game I think you will meet this issue
I dont know what you mean
Tom
Tom
@Raynos when you receive a message from the client on the server, you need to know what object is going to handle this particular message
16:07
@Tom generally only one object
@Tom generally only one message type
Tom
Tom
@Raynos one object per message you mean
in thread:

while(stream.isOpen) {
     var obj = JSON.parse(stream.message);
     handler.handle(obj);
}
Tom
Tom
@Raynos exactly. So in handler you want to have a method handle that knows all of your message types. That'd get way too large after a while.
That's what I mean, I had a similar handler in my project and it became way too complex
So I said it'd be nice if you have a good system in place for that
@Tom "all of your message types" The thing is you should only have one message type
Tom
Tom
@Raynos you have a different type for each kind of message
PlayerPing, PlayerMovement, etc
16:14
@Tom ClientInput -> server, GameState -> client. You shouldnt need anymore information then that
client connect is seperate and so is client disconnect. But apart from that you only need to wrap keyboard & mouse events in a clientinput and periodically send over the gamestate to the client
Tom
Tom
@Raynos sending one big gamestate object everytime seems inefficient
@Tom its not full state. the server will only send partial state with a lot of empty (unchanged) fields.
@Tom tbh I dont really know how to send state from server to client
Tom
Tom
@Raynos the client will have to do movement calculations, which you need to verify server side
@Tom on the player or on all players. Am I supposed to emulate the game state and adjust it when I receive a change?
Tom
Tom
@Raynos for the player, all clients do that - server distributes calculations and verifies them. You can emulate the game state if you need high precision
There are a lot of sophisticated and complex algorithms available
I'd look into it
If its a small or slow game you can calculate movement server-side
Anyway you cannot just import the clients GameState and trust it
You need to verify it, and some of these states will have to be set by the server and then send to client
I'm no expert though
16:33
I know you cant trust the client gamestate
but how does the client render the game.
Tom
Tom
@Raynos render? canvas
I mean does the client do any game logic?
or does it wait for the server to tell them x & y happened render x & y
Tom
Tom
@Raynos normally yeah, eg. movement calculation and object detection
is the client supposed to go. x & y are likely to happen render them and if for some reason not update from server and be laggy
Tom
Tom
@Raynos, server sends message: Type=PlayerAttack, Source=Player1, Target=Player2, Attack=Laser
16:35
Does that not mean sending a position map of all objects on screen to the client?
Tom
Tom
Then, client creates a laser attack from player 1 to player 2
@Raynos yes
When a player on server enters visual screen of another player you need to inform this other player about it
server sends message: type=playermove source=player1 distance= x+1,y+0
do I need a message for every pixel that a player moves?
Tom
Tom
@Raynos depends on your structure. I actually made a system where the server only records movement types: eg. movingForward, turningRight, turningLeft etc.
So all clients calculated position themselves with this data and every second or so adjustments were made smoothly
I see.
Tom
Tom
@Raynos Desktop games use UDP packages to send tons of coordinates a million times a second
16:38
But I wanted to wrap all those things in a gamestate from the server
Tom
Tom
But you cannot do that
Because you cannot have UDP sockets in a browser
only TCP
is tcp that much slower?
Tom
Tom
@Raynos yes but reliable, UDP is unreliable
That game has node.js server backend
I think
this is going to be a big job :(
Thankfully im taking a single player open source game and just seperating rendering & logic over a websocket
Dont have to think too hard
Tom
Tom
@Raynos just make sure you dont send useless data
16:51
I guess so.
I still think lag followed by more lag
Tom
Tom
@Raynos just use the state system and let clients do calculations, will be very smooth
@Tom you mean clientA says "I pressed jump" server -> clientB "clientA jumped" instead of server -> clientA jumps -> clientB "clientA moved up 20 pixels"
I mean passing on actions rather then physics
I still dont know what calculations the client is allowed to do and how to deal with the differences between client state and server state
Tom
Tom
@Raynos yes, you cannot pass coordinates all the time, only pass coordinates now and then to adjust calculations
I see.
I need to learn how multiplayer games deal with handling game state locally and server based
Tom
Tom
@Raynos it can do 2 things IMO, 1. movement (physics) 2. collision detection
17:02
And how it deals with lag.
I mean if you have a 2d fps you need accurate enemy location. if the enemies duck command is laggin 10ms behind then the bullet either misses or hits
thats why I cant do any of it client side
Tom
Tom
@Raynos a shooter will be very difficult due to precision requirements
I think
I am going to attempt a shooter
since if javascript can handler shooter lag then it can handle big projects
Tom
Tom
@Raynos shooter has to be 3d right?
sidescroller fps.
Ok its not an fps. its a sidescroller shooter
Tom
Tom
@Raynos I think you will have to spend a lot of time learning canvas
17:08
The render engine is supposed to wrap around the canvas and do that stuff for me
@Tom yes ill have to learn a lot but the library api will make things smoother
Tom
Tom
@Raynos hmm yeah, I wonder if that thing does not limit you
Many game engines require you to have maps etc.
They often limit you in what you do
Eg. I created an infinite universe that rendered itself
No game engine would have supported that
If its a bottleneck ill ditch it
But I cant write it all from scratch
Tom
Tom
@Raynos depends, you can simply use bitmaps with 2d games
not that difficult
the main point i need to deal with is stress test the websockets and canvas to see whether lag is avoidable
Tom
Tom
17:25
@Raynos ye
the rest is just code I dont care about and I dont need to waste time reinventing the wheel when the real bottleneck are websockets
Tom
Tom
yeah
Im off
Tom
Tom
17:42
laters @Raynos
17:57
Back
Im going to install node.js
Tom
Tom
@Raynos have fun : )
It's great, just start by creating your little server that responds to telnet commands
how do i install it on windows -.-
Tom
Tom
good practice and easy
@Raynos I wouldn't do that
@Raynos it does run with Cygwin
@Tom I havnt got the laptop dual booted on linux
Tom
Tom
@Raynos it's really easy to dual boot with Ubuntu, you can just run Wubi.exe from the ubuntu folder on windows
I am doing that
18:07
Ugh
I have to go learn linux
Tom
Tom
18:21
@Raynos you have to anyway, if you want to have a multiplayer game
You'll need a good server infrastructure

  last day (43 days later) »