online text based rpg

I am making a text based rpg and would like to connect it online so two layers could battle each other. problem is i have no idea how to code that. getting servers and making a website will be easy if i need to. please any information on this topic will help. thank you in advance,
you don't need to make a website, though you can if you want to and it does have some advantages such as a static IP address. Now i'm told posting full solutions isn't the way to go so i'll say this: use winsock.h
look it up, it's part of windows.h and includes all the socket programming stuff. with it you can connect computers using ports and IPs. It's fairly easy to learn (provided you read the tuts) and will solve all your problems.
one thing though... why and how text-based?
thank you, yeah i need to learn not be given the answers. why: because me and my friends in computer class need something to do when we finish our work 2 weeks early. how: text based using the console.
ok sounds good, do you have your program code? I would like to see it to help you.
Talk about learning how to run before you learn how to crawl.

http://cplusplus.com/forum/articles/28558/ <- Obligatory link

One additional perk to such libs described in that article is networking.
People ask me why I seem hostile on these forums, it's because of comments like this --^
toxcity said he wanted a multiplayer console game. so why tell him the console sucks? granted, it may not be ask good visually as graphics but it's easier to write and run! besides, it sounds like massive fun! a multiplayer console game? im totally into that idea!
@toxcity: If you post your game code i'll teach you winsock and show you how to intergrate it into your game
closed account (3TkL1hU5)
@Sargon
I don't understand how Disch's comment was at all negative or bad?
There is no reason to get "hostile" over it. Did you even read the article he linked to? It has a ton of useful information and clearly outlines why the console is a poor choice for creating a game.
Unless someone is directly attacking you I don't really think there is reason at all to be "hostile" on forums about computer programming. Or any forums for that matter.


EDITED: For you Sargon...

@OP:
With that out of the way I would have to agree with Disch. I assume that you're in a C++ class and I can see why you would want to stick with the console. Even after reading that article I still feel a little intimidated by graphics. But I would recommend you check into Python if you're wanting to stick with a console based game. After all it isn't too terrible to learn considering you have experience with C++, it would be more than manageable as a side project, and it will be a lot easier to achieve the goals you want to. Just a thought.
Last edited on
I'm not entirely sure who the last paragraph was aimed at but im going to guess me. actually I know WinAPI and a fair amount of SDL, graphics don't faze me in the least. what I was saying was that making a console game IS easier than making a full on 2d game (or 3d game) the OP seemes to want to make a simple multiplayer for him and his buddy. makes sense to me. so, instead of posting to a link which says console games suck, i posted the name of the networking library and offered to help him intergrate it into his game. and thanks for asking but no i am not in a C++ class. And Python is too slow for my tastes.
toxcity said he wanted a multiplayer console game. so why tell him the console sucks?


I didn't say the console sucks, I said it's a poor medium for games.

And I told him that to make his life easier. He's asking questions about how to do things the hard way. Why not tell him the easy way instead?

It's like if someone was asking you how to drive a nail with a pencil. IMO the appropriate response to that question would not be to answer the question. Instead it would be to say "don't use a pencil, use a hammer".

easier to write


If you have any kind of realtime action or faux-graphical display, I strongly disagree.

what I was saying was that making a console game IS easier than making a full on 2d game


your definition of a "full on 2D game" is probably more complicated than a console game. Obviously a more complicated game will be harder to write, but that says nothing about the medium on which you're making the game.

If you make the same style of game with a game lib instead of through the console without adding any more complexities, it's often just as easy or easier to use the game lib.


As for the OP's question, if he were using said lib, it could be as easy as this:

(from the tutorial on SFML website)
1
2
3
4
5
6
7
8
9
10
11
12
//=== To Send data to another computer  ===//
// Create the UDP socket
sf::SocketUDP Socket;

// Create bytes to send
char Buffer[] = "Hi guys !";

// Send data to "192.168.0.2" on port 4567
if (Socket.Send(Buffer, sizeof(Buffer), "192.168.0.2", 4567) != sf::Socket::Done)
{
    // Error...
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//=== To Receive data from another computer ===//
// Create the UDP socket
sf::SocketUDP Socket;

// Bind it (listen) to the port 4567
if (!Socket.Bind(4567))
{
    // Error...
}

char Buffer[128];
std::size_t Received;
sf::IPAddress Sender;
unsigned short Port;
if (Socket.Receive(Buffer, sizeof(Buffer), Received, Sender, Port) != sf::Socket::Done)
{
    // Error...
}

// Show the address / port of the sender
std::cout << Sender << ":" << Port << std::endl;

// Show the message
std::cout << Buffer << std::endl; // "Hi guys !" 
Last edited on
First, thanks for answering his question. that's all that was required.
Second, i've found that console games are a good way to start. with SDL, WinAPI and OpenGL you use a lot of code and functions that aren't your own. that's always bothered me. now i'm not saying all of console programming is "your own" since you use iostream, but it's more you and that's what I believe counts
Second, i've found that console games are a good way to start


I disagree. It's starting down the wrong road.

As I explain in the previously linked article, techniques used in console programming largely are not applicable to the world of game programming.

It's like learning C before C++. It sounds like a good idea in theory, but in practice is just makes the process take longer because you build bad/inapplicable habits and spend time learning things you won't use later.

with SDL, WinAPI and OpenGL you use a lot of code and functions that aren't your own. that's always bothered me


That's an arbitrary and unfair double standard. And it doesn't really make any sense.

iostream and all other standard library classes/functions are all just as complicated as any of those libs you mentioned. The only difference is they come bundled with the compiler.

Have you ever looked at the code for iostream? It's crazy complicated, but it's right there for you to see. It's not like it's built into the language or anything... it's a library, just like all the others.


In C++ you're always using code other people wrote. Writing code that uses SFML is no less "your own" than writing code that uses iostream.

Besides -- why is using a "black box" a bad thing? Not having to understand the underlying details just makes learning how to do what you want to do faster and easier. Spending time reinventing the wheel and learning all the nitty gritty details just makes the process take longer.
Last edited on
closed account (3hM2Nwbp)
The only difference between console / non console is how you use the result of the business logic in order to display it to the players in a way they can understand. Learning graphics is a tough enough topic in itself...and IMO it shouldn't be bundled in an all-in-one shot with all of the other factors that go into making a multiplayer online game.


@toxicity

What you're looking at here is a client-server setup - where you aren't going to be coding a graphical client (yet?). Do you plan on having the players have individual profiles that can be saved after logging out, or create anonymous profiles as they connect? In any case, here are some compartmentalized areas that you can focus on creating solutions to:

1
2
3
4
5
6
7
8
9
10
11
* Finding the IDE to start coding in
* Setting up a high level networking library such as boost asio
* Packet structure & communication protocol
* External data storage & access (If your players are saved)
* Entity models (a class hierarchy that represents the business logic of your server portion)
* What kind of client interface do you want to make?
  > Note:  Even the client will have a business logic part
    >The I/O processing that happens with the server
    >The client-side entity registration
    > Collision detection
    >etc.


So in conclusion, take it one step at a time (and don't expect to see it sprout into something amazing overnight). There's no reason to rush into learning graphics, networking, database management (if your idea so requires), all at once.

*Let me know if you need any specific help - I've been making an extremely generic system like this for roughly the past 9 months. My goal is to be able to plug in whatever client interface is desired with minimal server/loginserver changes.

**Seeing as you are a student, I'd suggest taking a graphics or modeling course if they are offered if you want to get started with serious graphics programming. The powerful graphics libraries that are available, while being seemingly easy to use, do require knowledge understanding of quite a few graphics specific concepts.
Last edited on
if anyone still cares or is curious. give me your email and i will give you source code.
Topic archived. No new replies allowed.