[XP] RPG Maker XP Online System (RMX-OS)

Started by Blizzard, June 20, 2009, 11:52:23 am

Previous topic - Next topic

RyukLikesApples

April 22, 2012, 05:28:01 pm #1280 Last Edit: April 23, 2012, 01:24:07 am by RyukLikesApples
Hm...I just noticed that if I removed the foreign keys, data isn't saved at all! If I make an account called Test1, the database is unchanged!

I tried dropping the entire database and remaking (0 rows in each table) and when I login there is an error:

Cannot add or update a child row: a foreign key constraint fails (`rmxosdb`.`ips`, CONSTRAINT `ips_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE)
./Data/Action_Handler1.rb:47:in `query'
/srv/rmxos/rmx/Data/Action_Handler1.rb:47:in `try_register'
/srv/rmxos/rmx/Data/Client.rb:135:in `check_connection'
/srv/rmxos/rmx/Data/Client.rb:47:in `handle'
/srv/rmxos/rmx/Data/Server.rb:272:in `block in run'


Edit: Prior to upgrading ruby and it's counterpart mysql.so, this worked fine, as did the database sql commands (wiped it clean a fair amount of times).

Edit 2: The process I use is 1. Stop server. 2. Drop database 3. Use mysql script (RMX-OS SQL Database.sql) 4. Check to see that there are 0 rows in each table 5. start the server (no problems) 5. use client to try and register 6. hit enter key for the register button after I inpout username and password 7."You have been disconnected" and the error in console, no data is written to mysql server.

Edit 2 million: If I comment out this line: #      RMXOS.server.sql.query("REPLACE INTO ips(user_id, ip) VALUES (#{user_id}, '#{ip}')")


the entire thing WORKS, even data saving. So I KNOW it is this line. Yeah, it is this line. But then I get some other errors later about how the IP doesnt exist etc.

MOAL

April 22, 2012, 08:09:13 pm #1281 Last Edit: April 23, 2012, 01:44:30 am by MOAL
I apparently have another problem, I'm using Hamachi for the IP and a MySQL database. I can launch the server successfully ( it even says so ), but when I try to log in, I get an error that says "Server did not respond." My hamachi is working just fine, it's on and everything. My firewall is off and not blocking anything. What could be the problem? Here's what I get on the server log, if it helps any: http://i42.tinypic.com/24cbko2.png Edit: and another error... http://i40.tinypic.com/18p5ab.png they both happen when I try to log in, only the second one that I just added, only says "MySQL server has gone away."

I've tried this with two MySQL providers and both gets only one of these.

RyukLikesApples

MOAL, set the Database Timeout to 0.

In other news, still no worky; I am certain that the line is causing errors. (47)

MOAL

Thanks, this solved my other problems to an extent. But, instead, I now seem to be getting this error along with "Server did not respond.": http://i44.tinypic.com/10onsau.png

Sorry to annoy you all with my problems.  :wacko:

Blizzard

April 23, 2012, 01:05:45 pm #1284 Last Edit: April 23, 2012, 01:07:20 pm by Blizzard
@MOAL: If your machine has not been configured to accept incoming connections, then it won't work regardless of firewall, port forwarding and anything else. You first have to set up your PC to accept incoming connections. Sadly I don't remember anymore how exactly it is done. Try googling that error and see what comes up.
Also, you should upgrade to RMX-OS 1.18. There have been some improvements. Among other things, it may actually help you a bit with your problems.

@RyukLikesApples: You said that you tried using custom Ruby versions and mysql.so files, right? I suggest that you use the versions that I have specified in the manual and that you use the files already contained in RMX-OS. This will have the highest chance of everything working properly.

I have taken a look at the error you are getting and this is the whole method:

	def try_register(username, password)
# try to find user
check = RMXOS.server.sql.query("SELECT COUNT(*) AS count FROM users WHERE username = '#{RMXOS.fix_string(username)}'")
hash = check.fetch_hash
# user already exists
return RMXOS::RESULT_FAIL if hash['count'].to_i > 0
# get user count
check = RMXOS.server.sql.query("SELECT COUNT(*) AS count FROM users")
hash = check.fetch_hash
RMXOS.server.sql.query("START TRANSACTION")
# first registered user becomes admin
group = (hash['count'].to_i == 0 ? RMXOS::GROUP_ADMIN : RMXOS::GROUP_PLAYER)
# register new user
RMXOS.server.sql.query("INSERT INTO users (username, password, usergroup) VALUES ('#{RMXOS.fix_string(username)}', '#{password}', #{group})")
# get new user ID
check = RMXOS.server.sql.query("SELECT user_id FROM users WHERE username = '#{RMXOS.fix_string(username)}'")
hash = check.fetch_hash
user_id = hash['user_id'].to_i
RMXOS.server.sql.query("INSERT INTO user_data (user_id, lastlogin) VALUES (#{user_id}, '#{RMXOS.get_sqltime(Time.now.getutc)}')")
# get client's IP address
ip = @client.socket.peeraddr[3]
# record IP
RMXOS.server.sql.query("REPLACE INTO ips(user_id, ip) VALUES (#{user_id}, '#{ip}')")
RMXOS.server.sql.query("COMMIT")
return RMXOS::RESULT_SUCCESS
end


Notice these lines:

		RMXOS.server.sql.query("INSERT INTO user_data (user_id, lastlogin) VALUES (#{user_id}, '#{RMXOS.get_sqltime(Time.now.getutc)}')")
# get client's IP address
ip = @client.socket.peeraddr[3]
# record IP
RMXOS.server.sql.query("REPLACE INTO ips(user_id, ip) VALUES (#{user_id}, '#{ip}')")
RMXOS.server.sql.query("COMMIT")


This means that there is definitely a user entry in the database before the IP is logged. But I can't remember how well things work when you use transactions and if foreign constraints are disabled during them so everything can work out. The only thing that I can suggest is that you move the COMMIT line further up so the user is definitely already registered in the database when his IP is supposed to be added:

		RMXOS.server.sql.query("COMMIT")
# get client's IP address
ip = @client.socket.peeraddr[3]
# record IP
RMXOS.server.sql.query("REPLACE INTO ips(user_id, ip) VALUES (#{user_id}, '#{ip}')")


If the problem really is the transaction in progress, this change should prevent the foreign key error.
If this doesn't work, then just remove the lines. Technically it's an optional feature so you don't really need it. But you won't be able to IP ban users properly.
Also, if you are still having errors with this one, you should keep in mind that there is a similar line in the try_login method in same file (line 86) so you might wanna remove that one as well.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

MOAL

@Blizzard - I updated to 1.18 of RMX-OS, allowed incoming connections, and rearranged everything accordingly. But the error remains, same old "Server did not respond." and everything. I searched google on these errors but I can't seem to find any working solutions. I've also tried switching out the mySQL databases in hopes that it was the problem, though my provider for mySQL is up and running just fine.

Blizzard

April 23, 2012, 02:44:46 pm #1286 Last Edit: April 23, 2012, 02:46:32 pm by Blizzard
No, the problem is definitely that your machine isn't configured to accept incoming connections. Somebody else had the same problem once. In fact several people had that exact same problem. But I can't remember anymore how it can be fixed. :/ You have mess around with some of Windows' settings and who is allowed to connect to the PC.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RyukLikesApples

The files included gave me elf header errors. Compiling MySQL.so by myself fixed the problem, but global switches and vars script had errors using it. After upgrading to 1.9.1 global switches and vars worked but login started having problems. I will try what you recommended by movin the command up, will update after I do so; thank you very much for your help.

Blizzard

Elf header errors? You are running RMX-OS on a Linux machine, aren't you? If yes, this here might be of interest for you: http://forum.chaos-project.com/index.php/topic,3869.msg146421.html#msg146421
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RyukLikesApples

April 23, 2012, 09:34:34 pm #1289 Last Edit: April 23, 2012, 09:43:09 pm by RyukLikesApples
I tried his file when I first started (~7 days ago) and seeing as it did not work, I had to compile my own :P

Edit:  My god, Blizzard, you are an absolute genius. IT WORKS!

And finally: a game question: is it possible to force parts of the game to be clientside? for instance, cutscenes need to be clientside to display properly, or is there an alternative method to making cutscenes that you would recommend?

Ryuk

Blizzard

I'm glad this worked out. :) You just followed the instructions by Vaelen, right? If this worked for you as well, then I can be sure that this method works and add it to RMX-OS.

As for your question: Technically everything already is client side (except enemies). Using Global Switches and Variables is how you make things be global.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RyukLikesApples

What if the cutscenes use sprites that move around? Since the server controls the npcs wouldn't it look weird? Or by enemies do you mean the ones in battle, not npcs?

Thanks,
Ryuk

Blizzard

No, the server doesn't control map events. It's actually a processing pattern that makes one of the current players on the map the processor and then the positions are propagated to all other clients. If I remember right, events are not global so events moving around on one client will not move around on another one. I can't remember if I mentioned that somewhere and said that events should stay still to avoid problems.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Kiwa

Hey guys!

I haven't been able to get this online system working..tho truthfully i haven't tried so much atm.
I'm still concerned with learning RGSS basics and making the general idea I want to produce.

But my question is:
I know this system is designed for MMORPG play. But what about a more simple system? can you use RMXP-OS to link games together without the Server and SQL?
Basically storage would be local on the PC. you could either enter single player or multiplayer. One person is host the others are client connecting to host's IP.
and then friends can opt in load from the host's file...and choose to play char slot 1,2,3, or 4. (or default them to a slot and re arrange the party to desire)

Ex:
Like loading Zsnes and "Secret of Mana" then connecting to the Hosts IP.
then you can select who is player 1 or 2...so on so forth.

Is this something RMXP-OS can do with little modification...or is it even possible?
Thanks :)

Andreavnn

RMX-OS is based on my SQL, you will have to use SQL to make it work.

Blizzard

The SQL database handles your save data and all user data. Making this work with files on the server is very bothersome. SQL databases are intended for this very purpose so it was a natural choice. Setting up MySQL is fairly simple so I highly recommend you do so. Otherwise you would have to get somebody to rewrite how saving works in RMX-OS.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Kiwa

OHHH!! I got a reply from the Blizz man himself.  >:3
(Really tho..your the reason I'm back into programming at all..even with just RPG Maker. your ABS and OS system were BIG influence and the deciding factor to buy XP over the others.)
ok enough fanboy-ing.

I'm getting to the point where my "system" is where I want it.. only looking for minor things to update it with.
Its not a huge deal..server data based or not.. Its a compromise I can make for even having the option.

Since I haven't been able to get my SQL and the server functioning right (tho i probably messed it up hard by recoding things)
I haven't been able to see the answer to these questions.

The casting system is pretty awesome as is from BABS..but online..you cant pause the ENTIRE game to select targets in an MMO.. so is it real time while you select?
and if I in fact wanted to make this  in  an MMO style. Id like to limit areas to a party such as an "instanced" area (as so many games do atm..but with my own spin on it). limiting interruption from outsiders of the party.
I cant imagine you didn't think thru a process like that so I'm sure it exists.
how is that handled?

Once again.. sorry for my book posts and litter of questions.
in all honesty I'm really just becoming passionate about this stuff again...and loading on knowledge asap..while probably annoying the forum as I do so lol.

much respect for you all,

Thanks :D

Blizzard

Try following the guide in the manual for the SQL server. If you still can't get it running, try googling for a tutorial.

Yeah, I know that it's not good to freeze the game when selecting targets. You should post in the Blizz-ABS topic and suggest to winkio that he implements an option to not freeze the game in Blizz-ABS 3.x.

Instanced areas have been discussed several times. While it's possible to make a script to allow that, there are several complications. I know you don't feel like reading 60+ pages of this topic, but if you want more detailed information on why it should or should not be done (which I honestly can't remember anymore what I said), you will have to read it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Kiwa

Originally I thought "oh I don't need to save data on a server so I don't need SQL".
and I tried to make the server while my PC was offline and using the defaulting IP..

and god knows what I did after that...
I later discovered I need the SQL for the connection to work...and I tried to remove SQL from the .ini
then i realized I was ruining everything..so I'll have to start fresh and uninstall my SQL and such.
and properly follow the directions this time.

As for reading 65 pages or so for the Blizz OS... I'll take taht over reading the 250 page monster the ABS thread is. lol.
Thanks for the help :P

I'll be gone for a few days so I wont be able to do much..
don't think you got rid of me so easily :o

Thanks :P


Blizzard

June 23, 2012, 08:47:18 am #1299 Last Edit: June 23, 2012, 08:48:50 am by Blizzard
I have uploaded v1.2. I mostly just added stuff in the manual, but there are a few small fixes in the script and server as well. I have also added the Linux binaries. If somebody has the time, it would be good if they could check if running RMX-OS on Linux works as I described it in the manual. >.<
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.