[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

r8 my Node.js + Socket.io piece of shit

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 217
Thread images: 71

To learn Socket.io I made a shitty Club Penguin-esque game. It's unsecured and written like a pile of shit... should be easy for a haxxor like u to break it.

It has chat, a whiteboard, a playlist system with voting and more dumb shit.

https://cunt.fatdu.de
>>
update
>>
>using Socket.io instead of uWebSockets
Enjoy the backbone of your game being slow as shit I guess
>>
>>
>>59006179
also die u cuck
>>
>>
>>
bump niggers
>>
>>
>>
>>59006090
bumpin
>>
File: tic tac toe.png (70KB, 663x513px) Image search: [Google]
tic tac toe.png
70KB, 663x513px
what did they mean by this?
>>
>>59007134
3d tic-tac-toe :)
>>
>>
File: casual gathering.jpg (213KB, 1280x720px) Image search: [Google]
casual gathering.jpg
213KB, 1280x720px
>>
>>
>>59007250
?
>>
>>
People found out how to do massive changes to the background.
>>
>>
File: 2017-02-18 23_44_29-ClubCunt.png (26KB, 301x407px) Image search: [Google]
2017-02-18 23_44_29-ClubCunt.png
26KB, 301x407px
>>
I'm just waiting for some faggot to figure out how to make a javascript infinite loop run on each client.
>>
File: Toontown_rewritten_logo.jpg (79KB, 620x349px) Image search: [Google]
Toontown_rewritten_logo.jpg
79KB, 620x349px
I'd rather play this: It's pretty darn close to the original game, unlike your shitty CP clone
>>
RIP sweet prince
>>
File: ss+(2017-02-19+at+01.11.48).png (33KB, 522x381px) Image search: [Google]
ss+(2017-02-19+at+01.11.48).png
33KB, 522x381px
lmao
>>
I'm making an IP ban function. Y'all will regret this
>>
>>59008667
nice
>>
>>59008667
fag
>>
File: good_goy_cunt.png (87KB, 705x482px) Image search: [Google]
good_goy_cunt.png
87KB, 705x482px
>>
>>
that music playlist is great lol
>>
>>
>>
File: mrdink.png (74KB, 731x493px) Image search: [Google]
mrdink.png
74KB, 731x493px
Douglas
>>
Can't draw on mobile bro
>>
>>59006090
honestly interested in the source code for this, I'd like to start socket.io
>>
File: install_gentoo_cunt.png (40KB, 662x401px) Image search: [Google]
install_gentoo_cunt.png
40KB, 662x401px
>>
It's dead
>>
rip
>>
fuck I tried to draw Mr. Dink again
>>
It's back up (not for long xd)
>>
EVERYONE GET ON ITS BACK
>>
bumpity
>>
I think I did a good job, come bottom left :)
>>
>>59009742
I would but we're telling stories on the top left
>>
>>59009858
nah mate we're making shitting males cumming on apple consumers faces
>get the fuck over here
>>
Whoever is DDOSing it has autism.
>>
>should be easy for a haxxor like u to break it.
Indeed, you should put your shit in closures.
>>
this shit got me in a drawing mood and I ended up cleaning up the Mr Dink drawing that got wiped twice
>>
come back
>>
you faggots killed it again
>>
it's back up
>>
Okay admin, socket.emit(1) crashes your shit because your backend is retarded. Don't do type conversions on the client side.
t. FizzBuzz
>>
I fixed one of the exploits. While I'm not asking you to try more, I think the main one should be fixed.
>>
the art is amazing
>>
>>59010695
>>59007233
>>59007196
all me
>>
the jew is surrounded
>>
>>59010725
good work anon
>>
>>59010736
Here's the code for it for anyone who wants to see how to draw programatically: http://pastebin.com/GMnLnyxu

I did want to try writing a bitmap painter but sadly I'm not autistic enough, this will have to do
>>
very nice. the drawing code is really inefficient server-side, so it has to store everything until you clear it. you caused quite a bit of ram to be filled up bro :)
>>
>>59010829
>>59010806
meant to reply to that
>>
>>
>>59010994
>>
>>
>>59006090
Anyone have any tuts/resources for this?
>>
>>59011268
tuts/resources? for what?
>>
>>59011345
for making io games with uwebsockets/socketio
>>
>>59011359
it's not really that hard bro, just look at the client code for my game
>>
is it rip?

~anon who was drawing shit at the end.
>>
>>59011427
still up
>>
>>59011437
clubcunt is down for me, just getting a blank frame when I open it.
>>
>>59011458
You were IP banned with me, probably.
>>
File: clubunt.png (15KB, 1379x856px) Image search: [Google]
clubunt.png
15KB, 1379x856px
>>59011458
>>
>>59011458
When there's a lot of art in the world it takes fucking ages to load. Pardon the Heroku hosting, but just be a bit patient.
>>
>>59011472
>>59011475
oh yeah, that too. slow fizzbuzz is ok, fast fizzbuzz is not.
>>
File: meeee.png (249KB, 1283x730px) Image search: [Google]
meeee.png
249KB, 1283x730px
>>59011490
aight well im out
heres a better qual pic of >>59011437
>>
It fucking freezes on my phone (M8).
>>
Is JS worth learning?
>>
Gallery implemented niggers. Also, everyone who was IP banned has now been unbanned. Just don't be fucking annoying.
>>
>>59011558
it's the only good programming langiuage
>>
>>59011832
fuck off
>>
File: Capture.png (60KB, 809x444px) Image search: [Google]
Capture.png
60KB, 809x444px
Thousands of hours on paint.io
>>
pretty good anon i found it funny and entertaining
>>
>>59011974
Will be added to gallery.
Goodnight everyone, it's been fun!
>>
any wacom tablet fags?
>>
File: ehj.png (201KB, 1167x1050px) Image search: [Google]
ehj.png
201KB, 1167x1050px
YOU HAVE TEN SECOND TO PUT THIS IN GALLERY OR THIS KNIFED BIRD WILL KILL YOU
>>
>>59012251
yeah me look at my art
>>59012255
>>
>>59012263
Nice
>>
File: masterpiece.png (372KB, 1976x1101px) Image search: [Google]
masterpiece.png
372KB, 1976x1101px
well this was a nice distraction
>>
File: HACKED.png (63KB, 1115x762px) Image search: [Google]
HACKED.png
63KB, 1115x762px
hacked your shit bruh
>>
File: firefox_2017-02-18_23-17-12.png (304KB, 1169x837px) Image search: [Google]
firefox_2017-02-18_23-17-12.png
304KB, 1169x837px
xDDDD i make creeperface
>>
OP make more colors
>>
>>59013209
ask somenoe about the inspect element trick

used here >>59012746
>>
File: gentoo.png (303KB, 1751x783px) Image search: [Google]
gentoo.png
303KB, 1751x783px
add to gallery plox
>>
>>59013264
>https://cunt.fatdu.de
what the fuck, why is my "apple cumming on customers" not added to the gallery?
>>
File: 5.png (101KB, 1238x641px) Image search: [Google]
5.png
101KB, 1238x641px
Come and hang out in your designated color area."
no yellows allowed.
>>
File: 4.png (154KB, 1275x719px) Image search: [Google]
4.png
154KB, 1275x719px
>>
Awake now, will update gallery soon
>>
>>59013408
& I didn't manage to get a screenshot of it
>>
>>59007174
You need 3 people for that or player 1 always wins.
>>
>>59009251
Here is the Mr Dink
>>
>>
More fun than Club Penguin
>>
fucked the update, restarting again
>>
Here's some FOSS
>>
>>59018166
New user handles
>>
You can now change names with
!changename:The Name You Want
>>
This is pretty entertaining. thanks for filling my evening with retarded shit.
>>
>>59018731
no u
>>
Filled with bots now. Kinda boring.
>>
File: $lamforlife.png (246KB, 1434x838px) Image search: [Google]
$lamforlife.png
246KB, 1434x838px
I love you admin, thanks for the $lamz
>>
>>59019435
Is OP a faggot?
>>
romantic dinner with thinkpads
>>
>>59006090
(function () {
function line(sx, sy, tx, ty, color) {
lastDrawingPoint.x = sx,
lastDrawingPoint.y = sy,
drawingMouseDown = !0;
selectedColour = color;
selectedSize = "medium";
var b = 0;
"small" == selectedSize ? b = 5 : "medium" == selectedSize ? b = 10 : "large" == selectedSize && (b = 20), players[localId].drawing.graphics.ss(b, "round").s(selectedColour), players[localId].drawing.graphics.mt(lastDrawingPoint.x, lastDrawingPoint.y);
var c = { x: tx, y: ty };
players[localId].drawing.graphics.lt(c.x, c.y);
var d = new EncodePath;
d.moveTo(lastDrawingPoint.x, lastDrawingPoint.y).lineTo(c.x, c.y), encodedPathBuffer.push(d.code), lastDrawingPoint.x = c.x, lastDrawingPoint.y = c.y;
var e = "#fff" == selectedColour;
players[localId].drawingContainer.updateCache(e ? "destination-out" : "source-over"), players[localId].drawing.graphics.clear()
emitDrawing(!0);
}
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}

function rgbToHex(r, g, b) {
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}
var img = $('<img id="picture" style="display: none" src="{{INSERT BASE64image here}}">')[0];
var canvas = $('<canvas />')[0];
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
var pixelData = canvas.getContext('2d').getImageData(0, 0, img.width, img.height).data;
var offset_x = 0, offset_y = 800;
var x = 0, y = 0;
var step = 8;
for(x = 0; x < img.width; x += step) {
for(y = 0; y < img.height; y += step) {
line(x + offset_x, y + offset_y, x + offset_x, y + offset_y, rgbToHex(pixelData[(x + y*img.width)*4], pixelData[(x + y*img.width)*4 + 1], pixelData[(x + y*img.width)*4+2]));
}
}
return pixelData;
})()

Use http://dataurl.net/#dataurlmaker to generate the images. Sometimes you get disconnected with large images. I have no idea why.
>>
>>59020249
Change selectedSize = "medium"; to "small", "medium" or "large" to set the brush size.
Change step = 8 means render every 8th pixel. step = 1 means render every pixel.
>>
>>59020249
pretty fucking cool
>>
Dude, I just owned your server. It got owned.
>>
>>59020518
You didn't lol, I'm breaking it myself
>>
>>59008278
Please no

I don't want any more of you fags fucking up the 4chan steam group
>>
Mass drawing scriptfag problem fixed
>>
>>59020900
I can't even draw a line without getting disconnected.
>>
>>59020953
Nah that's fixed
>>
>>59020967
uh

guess it is
>>
File: fuck.jpg (221KB, 1406x608px) Image search: [Google]
fuck.jpg
221KB, 1406x608px
op, the game runs like shit here. the console can be dealt with (console.log = function() {}), but that websocket goes through polling, which nukes performance and puts ton of load on node.js.

you can either

1) pay shekels to CF kikes, so they stop shutting it down
2) connect ws directly, inb4 DDoS
3) use my autismal WS library which bypasses CF faggotry

https://github.com/katlogic/tws

you still need to POST xhr for each client->server message, but server->client will stream through CF

general protip for browser side, avoid socket.io, just use ws api directly. much easier to troubleshoot performance bugs. That polling POST fallback is something you don't generally want for games its for more app-apper stuff.

Other than that, excellent job.
>>
>>59021086
Wasn't aware there was a better way. I'll look into it. Meanwhile, antispam has been implemented.
>>
>>59021349
I'm kind memeing, the demo is self-contained proof of concept to test it, but not terribly useful as a module.

Coffeeshit aside, the problem is it does not dispatch the 'request' upwards if the request is not a ws one, but instead fires its own event which is incompatible with express/whatever you're using. This can be fixed by instead of firing custom event, looking up the next event chain (bleh), the way socket.io does it.

Basically replace https://github.com/katlogic/tws/blob/master/tws.coffee#L131

with code from

https://github.com/socketio/socket.io/blob/master/lib/index.js#L292

With that, whatever else is waiting for 'request' event in line (all these html app frameworks) will work.
>>
>>59021477
For now there hasn't really been that need since the server hasn't been raided yet. As soon as it gets raided by /b/ and i have over 100 users, I'll see if I can implement some changes. Thanks for the advice anon.
>>
>>59021832
>thanks for advice
na, just autism.

>planning to stage samefagged /b/ raid
Didn't actually mean that, but server latency as it is now.

I'm not sure the lack of websocket is the only cause of the jerky movement. The interactive event round-trip now for me is like 200ms (slavlands). Other ws games (agario) were generally far more fluid than that.
>>
>>59022024
Server is hosted somewhere in Europe. Heroku won't tell you where. Transitioning to WebSockets would be slightly too much effort for something developed almost entirely ironically, but I'll see what I can do.
>>
>>59022024
read, faggot:

>Here are some things which should make the server's CPU sweat (this is hosted on a shitty Heroku "Dyno"):

It will be hitting herokus 50 pending req/route limits long before it even touches cpu.
>>
File: file.png (274KB, 1920x1058px) Image search: [Google]
file.png
274KB, 1920x1058px
tried to draw pepe
>>
>>59022306
>>59022286
Oh, didn't know he's on heroku.

>>59022286
Why not just disable cloudflare (simply direct the ws endpoint url directly at heroku?) The CF benefit is dubious here.
>>
>>59020249
what does this do? i tried to run in console but it gave me error
'getImageData' on 'CanvasRenderingContext2D': The source width is 0
>>
>>59006090
CYA NOOB
>>
RIP

a bunch of circles joined and it crashed
>>
>>59006090
RIP cunt.fatde.de
>>
>>59022559
>>59022565
Did not crash, just lagged lmao
>>
this shit is lagging my pc
>>
Killing duplicate IPs
>>
>>59006090
How is this even remotely like Club Penguin?
>>
>>59022704
Click to move, snowballs coming in a future update
>>
>>59022707
Still nothing like Club Penguin.
>>
File: surrounded_cunt.png (196KB, 1291x729px) Image search: [Google]
surrounded_cunt.png
196KB, 1291x729px
>:]
>>
Same IP connections now disabled.
Chat sound can now be disabled.
Secret feature for hackers added.
>>
>>59011601
If you're interested in the web, yes.
Just for fun? Fuck no.
>>
>>59023031
What's there to hack? I see nothing that would be worth hacking.
>>
>>59023149
The feature got discovered pretty quick. Also ur gay
>>
File: 2017-02-19 23_43_44-ClubCunt.png (29KB, 478x479px) Image search: [Google]
2017-02-19 23_43_44-ClubCunt.png
29KB, 478x479px
>>59006090
>>
>>59020711
join chat faget
>>
>>59023447
beautiful
>>
144Hz now supported faggots!
>>
File: tux_cunt.png (50KB, 524x527px) Image search: [Google]
tux_cunt.png
50KB, 524x527px
>>
>>59024476
Will defo be added to gallery
>>
File: Screenshot_20170219_170933.png (4KB, 216x192px) Image search: [Google]
Screenshot_20170219_170933.png
4KB, 216x192px
>>59006090
Why do you do this shit to me, RNG?
>>
>>59024681
The name generation never lies, faggot.
>>
admin is a fag
>>
File: file.png (7KB, 421x267px) Image search: [Google]
file.png
7KB, 421x267px
>>59024681
>>59024728
He's right you know?
>>
Why is a fucking indian man talking out of my fucking speakers??
>>
>>59025605
:^)
>>
>>59025619
Seriously, any video on the internet and you pick that shit?
>>
>>59025629
It was voted on.
>>
>>59025632
Again, why
>>
>>59025637
Democracy
>>
>>59025637
Do you know what site you're on?
>>
File: Dickbutts.png (169KB, 1297x739px) Image search: [Google]
Dickbutts.png
169KB, 1297x739px
>>
>>59025899
Saved
>>
Nobody online?
>>
>>59026803
It's sleepy time, anon. Don't you want to go to bed?
>>
>>59026829
Not in murica
>>
Morning, fags
>>
File: Screenshot_20170220_011506.png (9KB, 308x183px) Image search: [Google]
Screenshot_20170220_011506.png
9KB, 308x183px
>>
File: 2017-02-20_08:20:09.png (142KB, 1920x1080px) Image search: [Google]
2017-02-20_08:20:09.png
142KB, 1920x1080px
noice
>>
File: Screenshot_20170220_012636.png (13KB, 429x182px) Image search: [Google]
Screenshot_20170220_012636.png
13KB, 429x182px
>>
>>59028812
Thanks
>>
File: Screenshot_20170220_013131.png (51KB, 395x460px) Image search: [Google]
Screenshot_20170220_013131.png
51KB, 395x460px
>>
File: Screenshot_20170220_014429.png (31KB, 187x441px) Image search: [Google]
Screenshot_20170220_014429.png
31KB, 187x441px
>>
Not bad
>>
>>59022490
var img = $('<img id="picture" style="display: none" src="{{INSERT BASE64image here}}">')[0]

You have to insert a image converted to base64 and you may have to reload the page if you want to run the script again.
By the way the OP implemented rate limiting because some nigger covered the entire canvas with randomly colored lines. You will get kicked if you use the script.
>>
File: 2017-02-20_12-49-27.png (178KB, 569x470px) Image search: [Google]
2017-02-20_12-49-27.png
178KB, 569x470px
>>59022490
Here is an example.

http://pastebin.com/raw/PMDkFSPW
>>
>>59030990
That's v nice
>>
Bump for more banter
>>
holy fuck is this bad
you bloated this shit so fucking much, holy fuck my browser nearly crashed.

sage
>>
>>59031483
Ur pc bad bro, I'm playing on a shitty chromebook fine
>>
Bompf
>>
File: smuganimeface.png (597KB, 1313x795px) Image search: [Google]
smuganimeface.png
597KB, 1313x795px
>>59030990
works like a charm
>>
Playing racist tunes
>>
I tried to make a lovely house for me and my buddies but the tax man took it all
>>
File: 1483343135844.jpg (6KB, 179x250px) Image search: [Google]
1483343135844.jpg
6KB, 179x250px
>>59030990
>AutisticSlutSJW123
>HomoCuckHater
This is just great
>>
>>59032287
The name generation is the best feature
>>
File: Untitled-1.jpg (491KB, 1051x626px) Image search: [Google]
Untitled-1.jpg
491KB, 1051x626px
120 hours hand drawing
>>
File: 1478963270505.png (81KB, 809x390px) Image search: [Google]
1478963270505.png
81KB, 809x390px
>>
>>59032556
>>59032868
Art
>>
Saving this thread
>>
>>59031749
wo how you do that
>>
File: skull.gif (35KB, 100x75px) Image search: [Google]
skull.gif
35KB, 100x75px
unban pls
>>
>>59035038
I can't without rebooting. Shouldn't have spammed :)
>>
This is good stuff OP
A simple time killer to dick around with
You should be proud
>>
>>59035183
Thank :DDD
>>
feels bad when one guy has to downvote every song, but that's where he gets his satisfaction from
>>
>>59035574
That's democracy for ya
>>
nice songs
>>
>>59035574
Kill yourself, you dumb fucking shit stain.

>>>/reddit/
>>
File: Screenshot_22.png (115KB, 968x695px) Image search: [Google]
Screenshot_22.png
115KB, 968x695px
>>
File: 1471584570298.png (256KB, 574x590px) Image search: [Google]
1471584570298.png
256KB, 574x590px
>obesepussylover
>>
>>59035810
hey pal
>>
File: 6Wf9Aiq.png (52KB, 694x496px) Image search: [Google]
6Wf9Aiq.png
52KB, 694x496px
no mom its just a popup
>>
>>59036367
High quality shitpost bro
>>
>>59032403
completely agree
>>
>>59006090
Isn't Club Penguin more like MS Paint Chat or a graphical 2D MUD client?
This seems more like a canvas.
>>
File: Screenshot_24.png (194KB, 1270x717px) Image search: [Google]
Screenshot_24.png
194KB, 1270x717px
>>
>>59037038
the penguin sprites are in the works senpai
hold ur horses
>>
File: Screenshot_27.png (214KB, 1266x708px) Image search: [Google]
Screenshot_27.png
214KB, 1266x708px
Comfy campfire :) It's 2005 again
>>
File: Screenshot_29.png (233KB, 1259x689px) Image search: [Google]
Screenshot_29.png
233KB, 1259x689px
>>
File: Screenshot_31.png (230KB, 1919x972px) Image search: [Google]
Screenshot_31.png
230KB, 1919x972px
>>
File: ccg.png (408KB, 500x500px) Image search: [Google]
ccg.png
408KB, 500x500px
You heard it here first /g/, there will be a /ccg/ (ClubCuntGeneral) soon. See you there.
>>
!speak: to do tts
!colossal: to do bigtext
!tiny: to do tinytext
>>
File: Capture.png (111KB, 1286x775px) Image search: [Google]
Capture.png
111KB, 1286x775px
This website is unsafe for those easily spooked, be warned. Infested with specters and NodeJS fags.
Thread posts: 217
Thread images: 71


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.