Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by aclee · Apr 05, 2014 at 08:29 AM · javascriptnetworkingmultiplayer

setup a php master server

i know this is a weird question, but can someone explain to me how to set up a php master server using this thread - http://forum.unity3d.com/threads/65551-PHP-Master-Server

i tried to contact the person that made it but he is not answering and i don't know php so could someone give me detailed instructions on how to do this?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kiloblargh · Apr 05, 2014 at 09:37 AM 0
Share

I tried that; it doesn't work. Ended up making my own system with PHP and SQL; neither of which I knew anything about to start. The how-to is way beyond what someone could post as an answer here; and it will probably take you months to get working right. If that's something you need to do, there's no shortcut; read lots of already-answered questions on Stack Overflow.

avatar image aclee · Apr 05, 2014 at 10:11 AM 0
Share

and does your server work?

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Apr 05, 2014 at 11:56 AM

Just a rough checklist:

  • First you have to make sure your server does actually run and supports PHP and mysql. How to setup and configure a server depends on the used server technology and is not related to Unity or this masterserver solution. If you don't know how, search elsewhere (google, stackoverflow, PHP forum, Apache forum, whatever-server-you-have-forum)

  • You need to edit all PHP files and insert your mysql server credentials in the first mysql_connect line. (This is a horrible design. Usually you should have a single, seperate file to setup the database connection)

  • You need to create a database on your mysql server (or if you only have a predifined database you can of course only use this one and skip this) and insert the database name in the second line where it reads "mysql_select_db".

  • In your database you have to create a table named "MasterServer" with those columns: - "useNat" - "gameType" - "gameName" - "connectedPlayers" - "playerLimit" - internalIp" - internalPort" - "externalIp" - "externalPort" - "guid" - "passwordProtected" - "comment" - "updated" (should be of type "DateTime")

  • In Unity you have to attach the "PHPMasterServerConnect" script to a gameobject and setup your domain name / server ip in "masterServerURL", as well as choosing a gameType and gameName. (keep in mind that in the current setup the gameName has to be unique. Also the masterServerURL need to start with http:// and end with a slash /)

  • Now it works almost the same way the built-in masterserver stuff works. You use the QueryPHPMasterServer method to request a server list for a specific gameType and then you can use PollHostList to retrieve the server list

Note: the table column types aren't really enforced here. You could use "Text" for most of them. However to prevent exploits some columns should be restricted in length since nobody has an IP address with 200 characters or a playercount number with more than 5 characters ;)

This is basically what you have to do. However as i just posted on the forum this implementation has some **serious security issues** and if you plan to use this in a real game those issues should be addressed.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Cynikal · Apr 05, 2014 at 09:30 AM

Without actually looking through the PHP source code and whatnot,

You would need a web hosting account. You can pick them up for like $3/mo.

Then you'd upload the files, and in your scripts, call the public location of that script.

http://YourSite.com/TheFile.php

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

Unity networking tutorial? 6 Answers

BCE0049 error with network script 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges