Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it,
follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given
their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'
Posts
It'll be worth that extra 5 minutes if you do, trust me.
Worth the markup, if there is one. I had a bag of apples last me almost 2 months. I have no idea how that worked.
Well clearly you bought too many apples
Granny smith apples last forever apparently though. Well... non-wallyworld ones.
If your boss tries to bite you, bite him back.
I once bought ground beef from wal-mart that went green within 3 days. Their groceries really are the worst.
Cub isn't that much different in price where I live, but I consider it the Wal-Mart of grocery stores anyway. The lighting is bad, the crunched-together aisle make me uneasy, and no one - employee or customer - looks happy to be there.
Invite me: XBox Live | PS3 | Steam
Link to me: Number Sorter | Achievement Generator
green?!
what the fuck
I bought ground beef and it went gray in 1, and green in 4.
I did used to go to walmart when I was in college, but I didn't buy much raw meat then.
I mean, I could drive back for the farmers' market, but on the other hand Soul Calibur isn't going to play itself.
Invite me: XBox Live | PS3 | Steam
Link to me: Number Sorter | Achievement Generator
Can anyone comment on using Node.js as a (simple) server for a typical client/server multiplayer game? The ability to use javascript on both client and server makes node.js pretty tempting, at least for quick prototyping, and I felt like trying a simple game to see how well (or badly) it works out. I'll probably just try to make a simple DOTA-style game to try it out. I did something similar in C# and having the same language in both client and server saved a lot of headaches IMHO.
I would like to try making the client in-browser using an HTML5 canvas but from a practical POV I'm probably better off using Unity for the client. My main concerns at the moment are:
1. What protocol should I use to send data around? For near-real-time gaming you typically use TCP or UDP sockets but doing that here sounds a little TOO low-level. Should I just use socket.io and call it a day?
2. If server-side computation starts to get complex, then the node server will probably get cranky since it' all single threaded. At that point I should dump some work into another thread process, right? It seems like deferring computation to the next tick in Node.js is possible but not usually recommended.
This is probably the ideal use case for Node.js.
1. Yup.
2. Yup. I think that's why many Node.js servers run on top of Nginx.
re: #2
This isn't a problem, you'll want to wrap anything CPU-bound into a worker thread, which isn't all that bad and still gives you better performance (particularly in memory) than multi-threaded request handlers.
See this and this.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
I mean, it looks like it's really just a model...couldn't you make it gobs more efficient with C++, or even a JIT'ed language like C#? Following the same basic model I mean.
As for why write it in node.js... why not? If it's just an experimental/for fun project, he can get experience in a new language and different style of programming while walking familiar ground.
I'm not a performance guy, though, so it's not in me to worry about that. I just like trying new technologies, especially lightweight frameworks and dynamic languages.
Basically this is the problem:
We want to create a new Builder, NumBuilder, that converts digits to words, i.e. the string "1, 2, and 3." becomes "One, Two and Three." The string "10" becomes "OneZero". Most of the method is given to you, just fill in the append method. You may not use a loop construct ("for" or "while").
NumBuilder.java
1 public class NumBuilder extends Builder {
2 StringBuffer sb = new StringBuffer();
3 public void append(char c) {
4 // What goes here?
5 }
6 public String toString() {
7 return sb.toString();
8 }
9 public static void main(String[] args) {
10 NumBuilder nb = new NumBuilder();
11 nb.append("1, 2, and 3.");
12 System.out.println(nb);
13 nb.append("4 and 5");
14 }
15 }
And the main thing I don't understand is what happens when you pass a string into a char, as with the append class there along with the main class that tests it.
EDIT: To clarify something, this isn't the problem I am working on, but the one I am working on uses the code from this problem.
This is the actual problem:
NumStream.java
1 import java.io.*;
2 public class NumStream extends OutputStream {
3 public void write(int c) throws IOException {
4 // What goes here?
5 }
6
7 public static void main(String[] args) {
8 NumStream ns = new NumStream();
9 PrintWriter pw = new PrintWriter(new OutputStreamWriter(ns));
10 pw.println("123456789 and ! and # ");
11 pw.flush(); // needed for anything to happen, try taking it out
12 }
13 }
EDIT: Oh crap wait a sec. I just realized that the append method being called must be from the builder class:
2 // Appends just one character
3 public abstract void append(char c);
4
5 // Force implementer to create a toString method.
6 public abstract String toString();
7
8 // Makes use of the append(char) method
9 // to append a whole string.
10 public void append(String s) {
11 for(int i=0;i<s.length();i++) {
12 append(s.charAt(i));
13 }
14 }
15
16 // Makes use of the fact that all Objects
17 // have a toString() method to format all
18 // other objects.
19 public void append(Object o) {
20 if(o == null)
21 append("null");
22 else
23 append(o.toString());
24 }
25 }
This makes much more sense i think?
(Psuedo-code)
function NumToString(char c) { switch(c) { case '1': return "One"; case '2': return "Two"; // Rest of case } }But the fact that you can't use looping constructs is stupid, because how else are you supposed to get the characters out of the string and pass them to the function one by one? There is nothing like LINQ's Select() or Aggregate() in Java that I am aware of, so I am completely unsure as to how they expect you to take an arbitrary string and parse it character by character without a loop.
I think it's a bad, fun idea that you should try. I'm still not sold on node as an actual server, but it's a fun platform.
Socket.io will be fine.
You will probably want to scale with cluster, but I have a mini headache in the back of my head just thinking of the possible socket.io/cluster issues.
There is no reason not to go ahead with your project - it sounds fun and you will be learning a new platform, just don't go with an expectation of "Hey, this will all totally work as documented!". Simply not the case in node world from my limited experience so far;o)
Yes, that makes more sense. So above for my pseudo-implementation of the abstract append function for NumBuilder.
NumStream.java
1 import java.io.*;
2 public class NumStream extends OutputStream {
3 public void write(int c) throws IOException {
4 // What goes here?
5 }
6
7 public static void main(String[] args) {
8 NumStream ns = new NumStream();
9 PrintWriter pw = new PrintWriter(new OutputStreamWriter(ns));
10 pw.println("123456789 and ! and # ");
11 pw.flush(); // needed for anything to happen, try taking it out
12 }
13 }
Does the pw.println somehow pass the input through the write method or something? Other wise I do not get how the write method applies to that main, given that the main our teacher has usually tests what we do...
I worked at the Wal-Mart home offices in Bentonville two summers in a row as a temp. I never saw signs about what to do in a hostage situation or vendor samples for furniture, and there's definitely no "fairly mandatory church services." Not that they aren't all super conservative. I literally never saw anything on the TVs in break rooms and lobbies but Fox News.
But the rest is true. Their corporate culture is just...weird. Kind of soul-crushing. Like every day I worked, I maybe died a little inside. And on days we did the cheer, it was way more than just a little.
When I was looking for computer science-y internships, I didn't even bother looking there despite having previous work experience and good references from Wal-Mart employees/managers. Luckily there's plenty of demand for IT in northwest Arkansas aside from Wal-Mart.