Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Multiplayer question

Author
Message
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 29th Jul 2015 16:22
regarding this locked post:

http://forum.thegamecreators.com/?m=forum_view&t=212881&b=1


That means that you can setup a multiplayer without having at all any kind of code on the server?
Host ftp a file to the server and client retrieve it? that's all? what about if a host is disconnected?
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 29th Jul 2015 19:59
that discussion was about getting a list of active hosts from an external server, like a web site. and yes, you do not need code running there to distribute such a list, just file transfers.

you still need someone to host a game running code on thier local machine or other server then upload thier connection info to this server for others to retrieve.

the idea is anyone can host a game and everyone looks to a single common address to find active games.

this isn't really ideal, handling disconnects is a case in point. without any server code running the options to detect and handle errors / disconnected are limited and clunky at best.

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 30th Jul 2015 01:48
Do you know by chance some cheap providers that allow .exe to be run in the server so I can handle the list with server code made in dbpro? or any suggestion you have about this? maybe even some server side languages easy and fast to learn (just Handling the list of the active server it's easy I think, I don't need any huge database or accounts with password etc, just keep the list to be retrieved by the clients)
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 30th Jul 2015 05:14
to run dbpro application, you will need a windows server, these will be more expensive than a typical *nix based server. to run arbitrary .exe you will probably need a virtual private server which is a bit more complicated to run and maintain than a general web host, but you get more control and access. amazon web services is probably your best bet.

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 30th Jul 2015 06:04
I have found in the 1st results of the search this one:

https://www.ovh.it/vps/vps-classic.xml

it costs only 2€ per month which is very affordable.


Using this one I could upload a dbpro .exe on the server so that it can handle the "active games list"? Will I need to communicate with http or still ftp?

They say I can chose the OS and have DDOS protection (which I am really worried about because my knowledge to server side code is close to zero)

Another problem that I may have is, dbpro apps needs direct x 9.0c to run, probably on the vps servers this can't be installed?
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 30th Jul 2015 06:33 Edited at: 30th Jul 2015 07:10
Another solution which is completely free (i think it is) is by using altervista.org, I was using this years and years ago for a website, but you can also manage files, have php script, msql database an use ftp.

How I am supposed to move using this one? maybe is usefull only for the basic ftp thing which cannot delete the files of the disconnected hosts?

Edit:

Nevermind about altervista, I have discovered it doesn't have a static IP, but the IP is referred to the server where your website is hosted, ftp is done by account name, password and personal link
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 30th Jul 2015 21:01
I remember some time ago a provider was offering 1 server to be used by everyeone for testing, now I can't remember who it was and I can't find any service like that, is there a way to test multiplayer somewhere?
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 31st Jul 2015 19:49
Ok maybe this is getting confusing, and that could be the reason why nobody is replying, I will make my request more specific:


All what I need to do is have a "lobby multiplayer server" so that people could find other people to play with (like it happens in most games).
For this purpose I will rent a Virtual Private Server, probably with unix.
I have found these 2 examples made in python (1 uses php and sql as well).

https://gist.github.com/madssj/5704525

http://blenderartists.org/forum/showthread.php?242160-Multiplayer-Server-Lobbying

Are these 2 examples usefull for my purpose? If yes, how can I communicate between that script and my dbpro game? (I have multisync)
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 1st Aug 2015 18:03
There are examples in the dbpro projects directory on using http requests.

These can be used to request data from the server

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 01:57 Edited at: 4th Aug 2015 02:44
Ok, here's the updates:

I have studied a bit of php, downloaded xampp to emulate a server where to run php, installed an editor as well. I ve also rented a OVH server (the cheapest, 2€ and something per month), but I am not ready to put the php file there yet because I still need to test it in local (also setting up things on the server it's a bit complex for who is new to vps renting so I will test this later).

When I try to use the http request used on the dbpro example, edited like this:



it returns me an error saying: "Your Browser (or proxy) sent a request that this server could not understand...etc etc)

On the php file I have opened a socket_listen programmed so that when the server gets a message starting with "xxxx" will return a string that says for example "hosting accepted" (which would handle the hosting players storing, adding the IP into an array).
(in this example I have wrote "MessageToSend" just as example)

I' ve also tested a small php file with just an echo command to test if the server emulator (or whatever it is, xampp), works, and it works, so that is not the problem.

What is causing this problem? I have tried using port 80, 443, and another number above 5000, no changes.

Edit:

Even trying with Multisync, the connection is not estabilished, testing with "If NET CONNECTED()=1"
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 03:48 Edited at: 4th Aug 2015 09:23
Maybe someone knows how to communicate properly between dbpro and php passing strings via http?

I ve looked at the Matrix1Utils plugins and there are some "socket" commands which could be how php send and receive messages, but looking at the examples it requires an IP instead of the Whole php file call (such as localhost/server.php).
If you try to change localhost with that you get an IP error.

Someone knows how to communicate properly between dbpro and a php script? (passing strings)

EDIT: Testing the php server side code with a php client side code it works perfectly, so the problem MUST be dbpro, I need to find a way to let communicate dbpro with the php sockets.

EDIT 2: Ok I don't know how but I got them to communicate, now I need to fix something because I am getting some weird values when getting back some data

EDIT 3: Ok I think I got everything to work now, now the hardest part, letting it to work on the server and refine a few things

EDIT 4: The php script is now perfect testing it on local, it stores the IP of the hosting players and remove them if they don't update after 70 seconds. The only problem is now the server on OVH, I have tried to put there my php script but if I try to connect using port 80 I get an error saying "method not implemented", maybe something to setup on the server, but OVH is an unmanaged service so I don't know if they will be able to help me, VPS servers are very Tricky to setup
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 4th Aug 2015 18:13
yeah, vps you do pretty much everything yourself.

sounds liked you are on a good track, for the method not implemented error, it may be that the server has php sockets disabled.

check the php.ini file, this is the main configuration file where you can set php to run as you want.

xampp is a package with an actual server (Apache) not just an emulator.

is the vps also running xampp/Apache or is it running IIS? in either case you may need to do some configuration in the server as well as in php.

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 18:52
I have chosen the distribution "OVH release 3" which include Apache 2, PHP 5 e MySQL 5.

https://www.ovh.it/server_dedicati/distribuzioni/release_3.xml


The operators are not willing to help much because they say "It's a non managed hosting" so you have to do all by yourself.
The only advice they gave me is to use FileZilla to move files on my server, I have moved my "server.php" in the main root but I get the "not implemented method" error.

Now I have to look where this php.ini file is and find a way to open it.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 19:32
the error I am getting is this one:

"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>Mymessage to /index.html not supported.<br />
</p>
</body></html>"


Mymessage is the message I am sending from the dbpro client, but I actually want to send it to server.php and not to index.html
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 4th Aug 2015 20:02
ensure Apache is running, ensure sockets are enabled in php.ini, ensure the php file is located in Apache's public root directory, verify that the script is publicly accessible with a browser

HTTP://mysite.com/server.php?printme=test

in the script add

echo $_GET['printme'];

and comment out the rest for now. do you get 'test' on the screen?

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 20:26
I have tried to upload the echo test php script in the same folder as index.html.

If I try to call from my browser http://serverIp/index.html it loads the page correctly, if i try using /test.php instead of index.html it doesn't find the file.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 20:30
if I try to remove the script I got a http 404 error, if I upload the script I got a http 500 error
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 22:28
Ok, 1 step forward, the error 500 was caused by the owner of the php file dropped into the server to be "owner= root" and "Group= root" while it has to be "owner= ovh" "Group= users".
With a proper chown command used on the shell of the server I have been able to change the owner and Group.

So, the echo test file now works calling it from a browser.

The only thing that needs to be fixed is how to let start the server.php and keep it running
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 4th Aug 2015 23:44
Ok, I think I got everything to work

All what I need to do to start the server.php is calling it from a browser and it will stay online until the server restarts (so who knows when).

Maybe to make sure that the server is open I could call a http to the php file so that it starts the server if is not open yet.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 6th Aug 2015 23:11
you should also be able to run in from console

navigate to directory

php server.php

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 6th Aug 2015 23:17
if you mean the shell command then it is useless as I have to do it manually while calling a http link could be done even with a dbpro call for example
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 9th Aug 2015 20:35
I have been able to add a call to the script in the cron of the server, so when it boots it starts my script automatically

Login to post a reply

Server time is: 2024-03-28 19:32:16
Your offset time is: 2024-03-28 19:32:16