News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

can playbasic make online rpg?

Started by eatfishy, October 11, 2008, 11:36:30 PM

Previous topic - Next topic

eatfishy

Can playbasic create an online rpg with about 6-10 players? Have this been done before?

thaaks

#1
Are you aware what is required to create an online rpg?

Technically there are two approaches:
- a client/server model (like WoW) where each user has a GUI client installed on his PC that connects to a backend server who stores "the world" and handles all player activities
- a peer to peer model (like Starcraft in a LAN) where each GUI client installed on a PC can also host a game.

The peer to peer model is definitely doable in PB without any technical problems (assuming firewalls don't block ports and so on). All players just need to know the IP address of the hosting player.

The client/server model requires that the backend is coded in some language. If you want to code the backend in PB too you definitely need a Windows server to host the PB server code application. And that's rare to find (except you setup one yourself and have some good internet connection).
Another issue is that PB doesn't offer multihreading so your server code has to fulfill one client request before looking at the next client request. So a maximum in users is a must. But 6 to 10 should work.

The client code with all this sexy graphics and sound stuff will be no problem for PB of course  ;)

As you see technically both approaches are doable under certain conditions.

But as a one man show / bedroom coder it's definitely a very long journey if you don't have enough experience. Network code is not easy and then there's all these things like synchronizing many clients, package loss, lagging and more!

You should not start this as your first project...
Maybe try to create a chat program as a first try to discover the network capabilities (and limitations). Then continue with maybe a simple network board game (where time issues are not critical). And then try to create a non network RPG to learn all about RPG coding. And finally target for the online RPG.

Hope that helps,
Tommy

eatfishy

Thanks for the response. I currently have a web hosting plan, but I will need to upgrade it to a dedicated server. I am with familiar with Client/Server model and also have experience with Database. I know this will not be an easy task. So is it possible to created a PB Host (stored on the server) and a PB Client with the available PB Plugins only and they both will exchange data without any server language?

thaaks

You can code a PB host (either using the HTTP lib or the K-Net lib). As I said it requires a Windows host machine (maybe with an IIS installation?). You will pretty surely need some admin/root access to make sure that the port and protocol (tcp/ip or http) are passed through to your running PB host application.
Try to find some person with Windows web server knowledge and ask this person how to setup a windows application as some server process. Haven't done that myself - only coding Java based portal backends  ;)

I'd suggest you start by coding a client and a server app and test them on your local machine first.

Databases are another issue. As far as I know there are currently no DB bindings available for PB! I think the easiest would be to look for some MySQL client lib that you can wrap for PB.
Depending on the amount of clients and data you want to store you could opt for some file based database.

eatfishy

Okay, so far I created a demo, where 2 players can move around and chat with each other. Now, my next question is which coding side should take care of the game logic. Do you this is a good idea?

Character Movement - will be send from all clients to server then server sends data back to all clients
Loading Background and any non-interactive object - will be on client side
Interactive Objects (moving boxes, any items that are movable) - will be done on server side

Playbasic with a Database. Since there are no plugins for playbasic to be used with mySQL, I'll use try to create one (if my knowledge is strong enough to lol) If no, I'll just use an excel spreadsheet to hold it for now.

Thanks for all the good advice.

thaaks

Regarding the movement (of any game element):

- I think it would be the best approach to transmit just key presses for character movement (and any other input) to the server. Anything else (transmitting character coordinates and so on) would be based on client data which might be off or outdated.

- the server should send (minimal) data packages to all clients and tell them what to load and to show and to move.

- Database: Can you read an excel spreadsheet from PB or do you think a CSV file (comma separated values). I would avoid anything ActiveX based on the server side as you don't know if that's allowed on the Windows server host...and you don't want to run Excel on your windows host to store your "database", right?

You could read up a bit on ISAM files as those are pretty fast and "behave" like a database. Would of course imply porting code from C or any other language to PB...

thaaks

Ah, I forgot: what network library are you using now, eatfishy?

eatfishy

I'm currently using Multisync for the network part. Hm...okay I will read up on ISAM (which i'm not even sure what it is lol). I'm assuming that if I run the Host Application on the server, it have to be a window server (not linux) correct? Do you have aim or some type of instant messenger? I would like to chat to you about game development sometimes...

thaaks

Quote from: eatfishy on October 14, 2008, 09:23:28 PM
okay I will read up on ISAM (which i'm not even sure what it is lol).
ISAM is some index sequential access into a file simulating some kind of database.
That was just an example. There are many file based "database like" approaches. You can of course even code your own as PB allows positioning in a file and reading and writing binary data.
Quote
I'm assuming that if I run the Host Application on the server, it have to be a window server (not linux) correct?
Correct. That's what I tried to explain in one of my first posts.
The only other way to stay completely in PlayBasic would be the peer to peer communication where your distributed PB game can be a host or a client. Simplifies distribution (just one executable, no server to setup) but makes setting up a game a little bit more complicated (players need to pass their IP addresses somehow).
Quote
Do you have aim or some type of instant messenger? I would like to chat to you about game development sometimes...
Theoretically I do have ICQ but practically it's never on. I'm just not the IM type of guy  ::)
But you can PM me or preferably just use the forum. I think some technical discussions regarding multiplayer games is always well accepted in the forums.

Cheers,
Tommy

Makeii Runoru

I am also interested making an ORPG project. Currently I'm learning more about Play Basic and separating my learning into small tests that can further help me design one. We are also using Multisync, but there are some aspects about it that may seem a little limiting.

Of course there is still a lot to learn. We (The Zynk Corporation) are a bunch of creative idiots. We have ideas, but so far we are still getting our feet wet. I am still trying to get the hang of Play Basic, and it seems that I am doing okay so far. I am also having a little problem with detecnig clients on the Internet, but LAN connections work just fine.
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.

eatfishy

QuoteI am also having a little problem with detecnig clients on the Internet, but LAN connections work just fine.

Try these steps:
1) Is your client connecting to the correct Server IP address correctly (Make sure the client is connecting to external IP of the server router, which is not the same as the one you use for LAN)

2)After when Client is connected to your Server IP address, it may not know which port to go (especially when you have a Router setup with multiple PC, it doesn't know which PC to send the data to unless if you setup a PORT FORWARD on your router)

eatfishy

Quote- I think it would be the best approach to transmit just key presses for character movement (and any other input) to the server. Anything else (transmitting character coordinates and so on) would be based on client data which might be off or outdated.

Can you explain why this technique is better than just sending client's player position? What if the game lags and the server didn't read all the client key press. For example:

Client Side View: Pressed down 50 times. Character may be at the bottom of the screen
Server Side View: Pressed down 48 times. Character will be 1/4 away from the bottom of the screen

I need a better understanding of this.

thaaks

Assume the other way around: you transfer player positions to the server. The positions are posted to all other players through the server. Now you press keys several times on your client to move the player. If there is some lag the player positions are not properly transferred to the server (and also not to the other clients). So your client world differs from the server world. Very bad. Your client might show you in front of an enemy and you attack but the server thinks you're still a bit away from the enemy so your attacks just hit the air. Although your client would show you different stuff.

Clean approach: Have only one instance (the server program) update the world. Whatever the server knows is the reality. If lagging occurs the server might not receive your key presses but still the world is consistent or "in sync" for the server and all other clients.

Of course lagging is always bad but lagging plus getting out of sync is much worse for a multiplayer game.

So if we agree that the server is the single instance who rules the world (and he does for all NPCs, the map, the daytime, the weather and so on) then the only way your clients talk to the server is by sending requests (to move the player in a given direction, to attack, to rest, to heal, to leave the game).
So a key press is nothing but a request to go north or forward with the current angle. Or to quaff a potion.

Does this help?

Cheers,
Tommy

eatfishy

Yes very helpful explanation. Thanks again.  :)

eatfishy

Question about the maximum size of a message send when using Multisync. The documentation says 2048 bytes is the max, so does this means that I can only send 2,048 characters in a string?