Netplay3 | Feature Drive

I have had a eureka moment and have created an infallible and very secure system to replace Netplay+. It works, but I am at a loss as to what features I need to now code for the system. I am talking the absolute basics, anything such as a battle system is up to whoever uses it to create themselves. I need a list of the basic background operations that an MMORPG needs. This thread is to brainstorm what it needs and to check them off as and when they're done.

Be brutally obvious here so that nothing is missed. I'll tell you what I have programmed so far and check them off on a list, assume that anything else HAS NOT BEEN DONE, however obvious it may seem.

This is not made using Netplay+ and is not an extension of it, it is a new system from scratch. I am using one script by another person which I hope to replace with my own, however if not I shall credit them accordingly when it's actually released. I don't want to give away my working as it were yet.
_________________________________________________________

Feature List | Red: Not yet added, but planned | Green: Added and working

Basic IO
Server online test
Version check
Username and password based login
Online Player List
Server-side movement authentication (collision checking)

Register; login and register scenes
Other players visible on the map | will require a pathfinding script
World chat
Map chat
Private chat w/ friends
Kill game if server becomes unavailable
Player variables and switches
World variables and switches
_______________________________________

I also need a name for this new system, that is not "Netplay".

The current name for the project is RmA, which is an abbreviation of what is basically happening behind the scenes, which I'm not going to divulge until it's released and working so that I'm the first person to do this. Because I am an egotistical maniac and this is my baby. Sue me.

I'm calling it Netplay3 here merely because that'll draw people into the thread, as it's what the previous two online RPG Maker systems have been called. I was given permission to carry on Netplay but never did due to problems that my new system has now overcome.
_______________________________________

Once good progress is made I shall be launching a Beta test which will be open to all hopefully, and should give some indication as to whether this is going to work out.
This is good soo far, Perhaps you should add a "Friends" system?
As for the basic chat, is it a "World" chat? If so, add a PM/whisper system so that you can speak to indevidual people.
Unless these are things that will be added speratly to the MMO...
Cool cool.

So we'll split it into:

World Chat
Map Chat
Private Chat

With a friends system tied onto private chat.
Yeh, that sounds cool.
With the Friends system I was thinking you could also tie it in with the "online players" feature too so you can see what friends are online too. Perhaps you could also see what friends are in the same map as you too, as in, if they walk past their names are a different color or something.
New feature coded: login :smoke:

Logs the player in with a username and password, and then sends the game a session ID to verify future commands. Stored in a MYSQL database.

At current this is not encrypted, I need to find some way of encryption within RPG Maker. SHA-256 is unfortunately a .so so I can't use it in RPG Maker, unless anyone knows a form of it written purely in Ruby.

Also there is no way of setting the username and password that you log in with yet. :specs:
Don't you feel this is treading trodden ground?
What do you mean?

Anyway, had a slight snag and have had to rewrite everything (there wasn't much), but a bit of progress, register now works and then login after it. The next step is to code a scene to register and a scene to login; I think for now I will use the default Window_Name and let people use their own input systems if they want to.
wyatt, what script are you trying to replace?

out of curiosity

maybe I can help
This is the script I am using:

viewtopic.php?f=11&t=63165

It is by Berka. It's probably silly of me to make my own but I feel bad using other people's stuff. It's not really a problem or anything.
amy wrote:
What do you mean?

You're falling into your RPG maker security blanket, I don't think net play needs changing as it's already at a state where to make anything good you need to script the crap out of everything.

In my opinion, you should focus on the server and make net play into a client server api with server software and then write an RGSS binding for it, the original net play DEFINITELY tried to do too much for the developer. A client server api would be much healthier with all the mysql connections being carried out server-side
Ah, that's why I'm creating this system as a replacement for Netplay+. Netplay+ is incredibly insecure, especially when using mysql. My system is all done server side, with RPG Maker merely being used as the graphical and input side of things.

Right now for example I am replacing the default player movement with simply requests to the server to move the player. Then, once the player is moved, the state of the game will be updated server side, shown to the game, and then the game will move the player (and all other players).

I hope it will work. Not sure any of it makes any sort of sense, but we'll try.

In essence what I am creating is what Netplay+ should have been, that is, a server side game engine with a graphical client.
I don't think you should go for building a full MMORPG framework, get an API down with a binding system that corrects the state of RPG maker, rather than have RPG maker itself tell the server where it's at.

In my client server tech I have a system where the client and server are just systems designed to chuck packets at each other, behind the server is correction intelligence and the behind the client is an API that binds the packet data to the effect it has on their game state.

I have found the fastest way to do a network of 100+ players is to have the client send packets at a fixed rate and have the server deal with and send out packets as they arrive, the client must also send as little data as possible to keep the server bandwidth down.

For NetPlay I'd layer the system like so:

Server_Logic
Server
|
Network
/|\
Client
Client Binding
RPG Maker

If the client was to move a character up from Y 242 the client would send the data as:
"Player #70 has moved to Y position 243 and the last tick you sent me was 6789123"
When it sends this data, the client moves themself within RPG maker too, it does not wait for approval on their side as the server might be laggy and approval may take time.
The lag of the server is eventually compensated by telling the server the tick of the packet they last sent, the server can go "hang on, this tick is 6789123, but i'm on tick 6799923 and you haven't yet sent a later packet, so I'm presuming you're still moving so will wait until your next packet before correcting you".

When the server gets this packet, it checks if the client table already has a later tick, if it does then it discards this, otherwise it checks to see if the client has moved too fast by checking the previous tick to this tick and if it's a sensible movement (based on the client tick rate) then it will leave things be, otherwise if it's not a sensible movement then it prepares a correction packet by moving the player towards the direction they intended but reduced to the correct speed (based on the client tick rate). It also checks against a collision map that is stored server side.

The server packet already knows the player it's talking about (As it just got the packet) so it doesn't need to send that ID number, it just chucks the packet to the address as:
"Your Y position is actually 244"

When the client receives this, the client binding tells RPG maker that the player is actually at Y 244 and moves them there with a smooth transition, this make RPG maker a dumb client, it still uses the game's logic to show the player that they are moving, but it obeys the server so if the server says different then RPG maker will read the binding and reposition.


It's also good to have some TCP emulation for data types that aren't variable (Movement is variable) (Never use TCP for game networking, always use UDP, if you're on TCP then give up trying to fix latency).
So if the client wants to know what items are in the shop, they will send a packet like:
"Player 45 wants to know what items are in shop 23, this is a guarded packet and MY CLIENT'S tick upon sending this is 7889986"
The client would send out this packet, keeping the same tick number as the first one sent out, over and over until they receive the server's acknowledge.

The server might receive this packet, once they do they prepare the packet:
"Shop 23 has items X, Y, Z, P, J on sale for prices 4, 5, 6 and your tick was 7889986"
The server marks the tick ID as received so from now on, if they get a TCP style packet from Player 45 with tick 7889986 it will ignore it, the client will stop sending the requests when they receive the shop details.

TLDR:
Dumb clients are best, but make an abstraction layer so you don't have to recode the RPG maker scripts, just make an API for sending commands to the server and updating the RPG Maker variables as the packets come through.
Xilef wrote:
Don't you feel this is treading trodden ground?


Says the guy making another game engine? :thumb:
Following Xilef's advice (which has come true) about character movement - that it would be too laggy not do do it on the client side and then check, rather than send every movement, I have come up with a new way of doing it. Good news: the player now walks while the server in the background checks whether they could have walked there. The bad news: the lag is horrendous.

The lag isn't caused by actual lag (the game is running at 40fps) but by adding a method call after move_down, move_up, etc, I think. For some reason this breaks up the movement, as if all the move_downs would otherwise chain together. Does anybody know what to do here?

Quote:
case Input.dir4
when 2
move_down
$rma.send_move("2")
when 4
move_left
$rma.send_move("4")
when 6
move_right
$rma.send_move("6")
when 8
move_up
$rma.send_move("8")
end


If I do something like:

when 2
move_down
$scene.help_window.set_text("move")


It lags just the same as the move_down is broken up. I think.
I was wrong, it is laggy because of the network connection. I'm going to have to try and find a new way of going about this.
I have just found that scripter Blizzard successfully used Winsock from the windows dlls in RPG Maker, and am playing around with that now, rendering everything I did yesterday worthless and shite. I'll carry on making this (starting again). Sorry if I sound like an over-excited puppy in this thread.

So, back to square one, feature list destroyed.
So, progress on the new, TCP client->server (scrapped the other AJAX-like idea).

Image

Client can send the following requests:

"LO`username`password"
Is returned: "LOF" or "LOS`1" (Login failed; login successful player id = 1)

"PL"
Is returned: "PL`1`3`5`7" (a list of players in the map) if logged in

Maps are now populated by players but they are not currently shown graphically. So the player can obtain a list of any players currently in their map, after logging in. There is not currently a login scene.
I hope you're not sending those commands down as raw text
Edit: or as single packets, do you compress and pack them into the packets?
I'm afraid I don't know much about these things, given the small amount of data I am sending, is there a problem with using raw text? This is how netplay+ worked.
Yes raw text is incredibly costly with the bandwidth and can quickly grind the server to a halt with just a few players.
You must use enums and transfer command codes as numbers, what I do is use a byte to hold 256 commands and send that, a byte is a single character, whereas strings are not just lots of characters but also the operating system could pack in line endings that can corrupt the packet.

Even in commercial games strings like player names are separated into multiple packets with chunks of the string to stop the server from losing all bandwidth each time someone requests a player name.
Alright. This is something I'm going to have to learn from scratch so for now I'll continue as I am, as I'm on a roll (and running the server off localhost), but will look into this for if I release anything.
- Player moves around the game
- Client sends move to the server
- Server moves the player in the database to new coordinates and sends back to the client it's correct position
- Client receives the position and, if the player is sitting in the wrong spot, moves it to the correct position

- Server checks passability against it's own copy of the map to make sure a player can move there
- If not, the player is moved to a passable spot within the server
- If the player hasn't hacked the game, they are moved to this spot in the client
- Otherwise, well screw them

Image
ive enjoyed reading this thus far
Now that's how a dumb client works.

Have you sorted out the problem with packet ordering or are you using...[gasp]...TCP?
Ok... progress...

The player can now see other players in their map.
But, these players only move when update_players is forced, and they only move by disappearing and reappearing in their new position.
And, they do not disappear until they're flagged as off the map on the server, so, they don't disappear on disconnect.

Things to program short term:

- A time out which removes players that have no activity
- Player movement
- Automatically call update_players
because i had similar issues when i made my game ill give you a heads up, all players keeping track of all other players in movement will cause issues. what i did, and from what i understand most big games do is wrote a player movement smoothing algorithm, meaning if the server is too busy or your internet sucks and you are losing packets, the game can still guess where the player was going.

let me know if that doesnt make sense, or im a idiot lol
Vergessen wrote:
because i had similar issues when i made my game ill give you a heads up, all players keeping track of all other players in movement will cause issues. what i did, and from what i understand most big games do is wrote a player movement smoothing algorithm, meaning if the server is too busy or your internet sucks and you are losing packets, the game can still guess where the player was going.

let me know if that doesnt make sense, or im a idiot lol

You're talking about client prediction, which isn't the problem, I think the issue here is removing the players rather than moving them and they don't yet send a map leave message to the server, client side prediction isn't needed for other players as it's not an active real time fps game that would require constant motion.

Also, calling update all players is costly on the server, you should send specific player updates to all clients when they have updated, so client A tells server they have moved, as soon as the server finds that out it broadcasts the new position of client A to all clients.
This should go with packet compression to cope with volumes, but as your packets are raw text any packing would make it worse, you really shouldn't use text packets...
Progress...

Disconnect players
Players are now marked as offline if they fail to respond to a ping quick enough. This time is variable, not sure what it should be.

Player movement
Other players now move, with a walking animation, using replicated events and Near Fantastica's path finding script. The only "lag" is in the time interval between coordinate updates.

Chat
Chat now works although there is no way to actually type in a chat message, I just have some events with different script calls. This chat is sent to all connected clients currently. The next thing to do will be to make it only send this chat to players in the same map.

So, we currently have a room, which players can connect to, which shows their avatar walking around it loosely replicating their moves (but exactly replicating their coordinates), and in which chat can be sent and received.
Having done more research I'm seeing what Xilef means about treating trodden ground. I haven't used RPG Maker properly in a long while and haven't really paid attention to the RM community for years. The days of a few of us following around the Netplay+ creators revering them as gods have long since passed; people are generally much more knowledgable about these things and it's all been done far better than Netplay+ many times since then.

With that in mind I'm beginning to think creating "the next Netplay+" is a pointless exercise, and the need for an off the shelf online kit has already been fed; therefore I am thinking of focusing all efforts of this onto my own personal project instead, tailoring it to my needs rather than the needs of the whole.

I will keep a project thread. Unless, of course, anybody thinks a new Netplay+ would be a good idea. I'm not sure I'm the person to deliver it though while there are so many better scripters out there now.
That's a shame amy` I thought you was making real progress with this! You also seemed to be having lot's of fun doing it. Just because the ground has already been trodden, doesn't mean you can't tread it again.
Either way, you made it this far with it in a short time so well done with that.
I look forward to keeping up with all your other projects.
:)

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=77088