Multiplayer batch game (on multiple computers)

September 24, 2012 at 22:20:32
Specs: Windows Vista
ermm so i was at school and me and my friends decided to make a batch text based adventure infact it was so much fun that we wanted to make it multiplayer
(on multiple computers ) anyone know how?
please help and ty for any responses

(the game has dungeons, and dragons, we called it potatoes and pies!)
( T_T) < ?!

Domo!


See More: Multiplayer batch game (on multiple computers)

Report •


#1
September 25, 2012 at 19:16:49
Lol! well, that's kind of like asking "any idea how to build a space-shuttle from scratch? OH, I do have a tire, and some zip-ties and duck tape...
(just kidding, but...) You'll need a "server" to run the game, of course, and a tcp link (basic network connection, at least for lan purposes), from all the clients to the server. Each player needs to run a "client" program which will query for, then copy or otherwise transmit the data over the net to the server. The client pgm would would prepend an IP to the file content (as line one) or preferably as the filename, The server would constantly sort and process the incoming files based on timestamp and broadcast to all clients what has just transpired ("morgan laFey has just killed a Troll in Sewer-drain caverns") (again, via file-copy with IP-address or "name" of the server in the filename). Client-progs might also need to look for "private messages" from other players (again, always sorted by timestamp) f/e: "trade 40 candles for an axe?" You get the idea... not real complicated, but needs a lot of detail-work. client-side example:
set my-ip=192-168-0-88
set server=192.168.0.2
...set /p x=what to do? & >>resp echo %x%
... maybe do some testing / validation etc. here...
... everything is cool, so:
move /y resp \\%server%\c\game\%my-ip%

Report •

#2
September 26, 2012 at 20:39:02
sorry i havent been responding (holidays -.-, you'd think i'd be happy about it LOL) any way that looks confusing but would
putting the info into files then putting the files into a folder that both computers (or more) can access work?
would it work?

Edit:
also how do i get the actual batch file to find out the ip?
(ps. please help me come up with a better name, i was originally thinking dragonage but thats taken, i want an original name my friend suggested DragonDawn 3 but it sounds to much like Dragonball Z lol)

Domo!


Report •

#3
September 26, 2012 at 21:01:42
well, yes. that's what I just described. The server ("dungeon-master") sits in a "game" directory (or folder, if you prefer - i'm old-school...) and continually scans for new arrivals in order of time-stamp, from OLDEST to newest (first-come first served basis). Process the oldest item, delete it, and respond to all players (IPs or computer-names) with update, rinse, repeat, indefinitely. Clients are similar: sitting in their own local "game" directory, scan for incoming updates (files) based, again, on timestamp, oldest first. Read the file, present the data to the player, and wait for his response, then build a response file (after validation etc.) and send response back to the server's IP. This is all just logistics, and very simple. The game itself is the gnarley part (parsing, validating, handling errors and exceptions, logic, story-line development and presentation...) and the last thing I would worry about is the name, Lol! first get the gnarley parts untangled, then worry about the minor stuff. If you don't have one, you will probably need a "dedicated geek" to help you build it from ground up, and I'm not qualified. Good luck.

Report •

Related Solutions

#4
September 26, 2012 at 21:10:56
haha lol,
does this make it realtime?
also is there a way to make the batchfile automatically find out the ip and set it as a variable?

Domo!


Report •

#5
September 26, 2012 at 22:03:27
the ip, of each client, is available through various means, most of which I am ignorant. One is to use ipconfig:
for /f "tokens=2 delims=:" %%a in ('ipconfig ^|find /i "ip add"') do set my_ip=%%a
echo my ip is: %my_ip%
(this is run by each client, at beginning of session, or stored in a specific file after
running only once.) The server doesn't need to figure out each client's ip if the client programs send the files with their ip (plus time) as the filename.
::... first build the response based on game, when ready, validated etc, then:
set timetag=%time:~3,2%%time:~6,2%%time:~9,2%
copy resp \\server\c\game\%my_ip%%timetag%
but that is only a crude attempt. I think it might fail with more sophisticated configurations. The client only needs to establish the ip once, at beginning of a session, since it doesn't change.

Report •

#6
September 26, 2012 at 22:08:29
thanks for the reply i havent tried it yet but when i do i'll tell you if it worked!

Domo!


Report •

Ask Question