Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
Hello everyone! A week or so ago I posted a thread on the Community Board asking for some suggestions on an application for my CS senior project. After going over all the suggestions and the ones that I came up with, I scrapped all of them. They were all great ideas, don't get me wrong. It was just that none of them jumped out at me as, "the one." So today I was thinking, and I believe I came up with my senior project; however, I need some input on it.

My idea was to write a generic program that will handle p2p connections over a secure(ish) line for any kind of application that you can dream of. For example, if you want to write an online game, in your code all you'd have to do is add a few lines of code to your game, and viola you have an online game. Or a collaboration text editor, or just about anything that you can imagine!

Now, my goal is to write this in C# for Windows and then port it to Objective-C for OS X and iPhone/iPod Touch. That way, it will be super easy to create online, collaborative apps between all 3 platforms.

My three main questions are:

1. Is this feasible to do in 1 year with only 1 programmer?

2. NAT issues, obviously this will have to work through NAT; otherwise it will only work if both computers have outside accessible IP addresses or if both computers are within the same router/DHCP server. I have never programmed something that had to work through NAT, so how involved is this or should I just stick to basic connections for now?

3. Security issues. For security, I was thinking along the lines of using some sort of hash on all the data. Anyone have possibly a better solution, or should this suffice?

Now, I have about 1 year until the final presentation on it is due. To demonstrate it then, I was hoping to write a Tic Tac Toe game (on all 3 platforms) and a simple collaborative text editor (again, on all 3 platforms).

So how about it, is this a good project to attempt? I am running out of time, as our final submissions are due soon...
 

tutubibi

macrumors 6502a
Sep 18, 2003
577
81
localhost
I am not sure about idea, sounds too generic to be effectively implemented. And whenever you have to write something that depends on external factors it is riskier. But, if you feel it is the right project go for it. There is almost nothing that can not be written in a year :)

I would suggest limiting your coding to a single language and framework that is portable across platforms. Writing in C# and porting to Obj-C is kind of duplicate effort.
There are number of available options that will enable "write-once" approach. Java or some C++/Python framework like QT or wxWidgets.
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
NAT traversal is responsible for endless amounts of pain to programmers of network apps. I would definitely recommend finding libraries to do some of the dirty work for you if possible.

<edit>
You might consider looking into implementing http://www.xmpp.org/extensions/xep-0166.html, since it is both a generic p2p data transport like you describe, and has a defined way of doing NAT traversal.
</edit>
 

admanimal

macrumors 68040
Apr 22, 2005
3,531
2
Your description is way too general to know how difficult or interesting of a task it will be. What do you mean by generic p2p connections? Any kind of direct connection from one computer to another without a server in between is a peer-to-peer connection. So that encompasses everything from simply having a connection from my PC to yours in order to send a file, or something much more complicated like bit torrent. The problem with a generic p2p system is that it might work OK for everything, but work well for nothing.

I think a much more interesting and feasible project is to pick a particular app and then add a "collaboration" feature to it that involves some peer to peer networking. You could focus on optimizing something like your Tic-Tac-Toe example, and show how using some clever p2p tricks makes your system more efficient than doing it in a naive way.

Whenever I see "I want to make a generic XYZ..." in a project proposal, an alarm goes off in my head. You will almost always be better off attacking a more specific problem.
 

ScoobyMcDoo

macrumors 65816
Nov 26, 2007
1,188
37
Austin, TX
So, it sounds like you want to build a new CORBA/ICE/RPC/DCOM? Kind of a rhetorical question to point out the complexity you are getting yourself into.
 

Sean7512

macrumors 6502a
Original poster
Jun 8, 2005
856
41
Your description is way too general to know how difficult or interesting of a task it will be. What do you mean by generic p2p connections? Any kind of direct connection from one computer to another without a server in between is a peer-to-peer connection. So that encompasses everything from simply having a connection from my PC to yours in order to send a file, or something much more complicated like bit torrent. The problem with a generic p2p system is that it might work OK for everything, but work well for nothing.

I think a much more interesting and feasible project is to pick a particular app and then add a "collaboration" feature to it that involves some peer to peer networking. You could focus on optimizing something like your Tic-Tac-Toe example, and show how using some clever p2p tricks makes your system more efficient than doing it in a naive way.

Whenever I see "I want to make a generic XYZ..." in a project proposal, an alarm goes off in my head. You will almost always be better off attacking a more specific problem.

Ok, point taken guys. If I focused on just one area, say that Tic Tac Toe game, I have a feeling that the idea will get rejected as not "complex" enough. Tic Tac Toe is a very basic game, and really, the only data (for the most part) that would need transfered is an int from 0-8 indicating the player's choice. Anyone have an expansion of this possibly?
 

sord

macrumors 6502
Jun 16, 2004
352
0
...that would need transfered is an int from 0-8 indicating the player's choice. Anyone have an expansion of this possibly?
Don't use an int where a char would work just fine (int is 4 bytes, char is 1)

If you need something a little more complicated, and want to stick with the game/networking route, you could always do something like create a Chess game (maybe with AI), or the game of Hearts (maybe with AI) or something along those lines. Back when I was in highschool I took computer science classes as a Junior and Senior (they changed the language and let me take it again) and I did Hearts w/AI the first year, and Chess w/AI the second year without a problem.

...Unless I misread and you really meant Senior at uni, in which case your professors should be helping you out on picking a topic.
 

iSee

macrumors 68040
Oct 25, 2004
3,540
272
Well, here's an idea I've had in my head for a while:

The idea is that there is a shared "game state" (It doesn't have to be for a game, but you get the idea). Abstractly, the game state is a hierarchy of key-value pairs: each node contains a list of key-value pairs, where values can be simple types (integer, string, etc) or complex (another list of key-value pairs). There's probably a root node.

An application would be able to access the game state in a straightforward way (Using Javascript-like notation, something like gamestate.gameboard.cellList[0] to get and gamestate.gameboard.cellList[0] = "X" to set; or using a syntax similar to Objective-C's key-value-coding, [gamestate valueForKey: @"gameboard.cellList.0" to get and [gamestate setValue: @"X" forKeyPath: @"gameboard.cellList.0"] to set).

That's just background. The interesting part is that you will transparently and efficiently synchronize a game state between two peers. The applications just set and get values. Your layer will take care of the details of sending updates back and forth behind the scenes. The updates should be efficient (i.e., you should generally only be sending the changed nodes from one peer to the other).

There's a lot just going this far. Even without synching, you need to define and implement your game state interface. I think it's clear that each Then you need to work out the gritty details of sending and receiving updates.

There are a bunch of aspects to this problem depending on how far you want to take it, though. Do you want to create a way for an application to register for to be notified when a node is updated by another peer? (otherwise an app will have to traverse the entire game state to find updates).

You could define a more sophisticated game state model, too.
Maybe you want to allow an app to designate certain nodes as being writable for one peer but read-only to others. Maybe it makes sense to allow an app to designate certain nodes as high-priority or low-priority. Maybe you want to support transactions which would allow for more sophisticated game state models.

It's an interesting project in itself to harden such a system against various kinds of security problems.

The kinds of features you'd want to add to the system depend on the kinds of applications you'd want to support. You probably won't be able to support the game state of a large-scale commercial, high-stakes MMORPG. You could go as far as you can with the implementation, but it might be a worthwhile part of your project to classify different types of applications and list what kinds of features you'd need to add to support each type of application.

Steps:

1. Come up with a mechanism for an application to define a game state. Maybe it's a class representing a game state node and, at least to start, an application would have to form the game state by building the hierarchy in code (you could use some more sophisticated data-drive method, but only bother with that if you want to make it a focus of your project.

2. Design and implement your game state node class so that info is only stored locally in memory.

3. Implement synching a game state between peers that works on a sub-tree basis. There's also some setup/startup stuff involving how two applications find each other and become peers, but I'd avoid getting sucked in to that too much unless you want to spend a lot of time on it.

4. Implement Tic-tac-toe and at least one other simple, but very different looking app on top of your general framework. Note that you don't need to build the other app entirely yourself. If you can find a simple open source spread-sheet program, for example, and extend it to use your general gamestate, that would probably be quite impressive. To my mind, it isn't even a problem if it is a partial port, or has problems that expose limitations of the game state model you support. As long as you can explain how your game state model would need to be enhanced to better support the app, you're in good shape.

5. If you have more time, there are a lot of directions this could go in.

So, I'm saying pursue the peer-to-peer tic-tac-toe idea, but make the game state syncing generic so that that layer can be used by a wider variety of games and other apps. I think this is all consistent with your original idea. By building it as a general system, is complex enough for a senior project. In fact, you need to be careful to focus your efforts or you'll take on too much.

Anyway, just another idea for you to chew on... :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.