Skip to content

Assambra/Free-MMORPG

Repository files navigation

Contributors Forks Stargazers Issues MIT License

Free-MMORPG

Logo

Our Demo Scene

Table of Contents

Foreword

This project utilizes free resources for both server and client technology. Without these, the project likely wouldn't have been possible, so I extend my special thanks to the team at Young Monkeys for their excellent foundational work, particularly for the EzyFox Server framework, and for sharing it with the community. Also, special thanks to all the contributors to the UMA project and their outstanding Unity Multipurpose Avatar System. For the ocean, we use the Crest Ocean System, which, in my personal opinion, is the best available ocean system for Unity. Please check out our Resources Section to see what technologies we use and consider supporting their projects in some way, such as through donations or code contributions, to help these talented individuals continue doing what they love: writing great code and developing fantastic frameworks.

For the game client we are using Unity as game engine.

(back to top)

Key Features

  • Account Management
    • Create a new account
    • Account activation, sending activation code via email, login checks if account activated if not needed to insert the code, resend code possible.
    • Login
    • Forgot password function, sending new password to a given username / e-mail address
    • Forgot username function, sending the username to a given e-mail address
    • SSL encryption for creating accounts this is feature from the EzyFox Server framework EzyFox Server SSL
  • Email
    • Sending e-mails via smtp, with different authentication protocols SSL, TLS or no authentication
    • Easy to create a new custom mails with our interface MailBody
    • HTML based email templates, you can also use your own variables
  • Character Creation
    • Creating a new character
    • Modifiable character model thanks to UMA, modifying the look of the character with sliders
    • Colorize character, skin, hairs underwear.
    • Change Hair, Beard Eyebrows, Underwear
    • Save the character server/database
  • Character Selection
    • Character selection with all available characters
    • (Todo) Delete a Character
  • Character Movement
    • Server Authoritative, movement (no client side prediction, server reconciliation or entity interpolation, simple send input compute position on the server send back to client)
    • Simple but working animation based by the position the player getting from the server
    • Server: Read from unity exported heightmaps format: .raw file, 16-bit, byte order: windows to compute the players Y position
  • Scene and UI Management, from our Module-GameManager
    • We use one persistent Scene all other scene will be load additive/async the last one will unloaded async.
    • For each scene we can create a scene asset (ScriptableObject) that holds a List of SceneUISet also a asset (ScriptableObject)
    • A SceneUISet (ScriptableObject) containing all the UIElement prefabs as a Set in an Array that we want to instantiate in the Scene. You can also add multiple sets per scene.
    • All Scene UIs will automatically be instantiated for the Scene and last Scene UIs will be destroyed. A check if the next scene have the same SceneUISets, then it don't have to be destroyed or instantiated the UI`s.
  • Mouse Handler, from our Module-MouseHandler
    • Gives the user a visual feedback what is currently under the mouse cursor and changes the cursor look (2D UI) with Graphic Raycaster
    • Enhanced IsOverUIElement - This stores when you press the left mouse button whether you was over a UI element or not and saves the state until you release the mouse button.
  • CameraController, from our Module-CameraController
    • The camera can orbit around the character on LMB, same on RMB but turn the target object.
    • A lot of options to fine tune the camera behaviour
    • Planed: Camera collision, more smoothing of the camera motions, distance and orbit
  • Popup System
    • Create your own popups for different use-cases
  • World Scene
    • Nice looking Island surrounded by an ocean

(back to top)

Playable Demo

We provide a playable Demo there you can play the latest release, and check first what Free-MMORPG can do, or to test and send bug reports. You can find it here: Get Latest. Only the latest release have a playable demo, provided as rar file. This client will connect to our game server.

Client

Clone from GitHub

Clone the repo:

git clone git@github.com:Assambra/Free-MMORPG.git

Get submodules:

cd Free-MMORPG

git submodule update --init --recursive

(back to top)

Needed Unity packages

To add this two packages (Newtonsoft Json and HSV-Color-Picker-Unity) manually is only required if you create a new Unity project, as example you create a Unity package from Free-MMORPG and insert it into brand-new empty Unity project. Because they are already added in this project.

Burst Compiler

Install the Burst compiler via the Unity Package Manager. Windows -> Package Manager. Select Packages: Unity Registery from the dropdown menu. Use the search field and insert Burst. Click the Install button to install the package.

Newtonsoft Json

The EzyFox Client SDK need Newtonsoft Json package to work.

Edit File: Free-MMORPG\Free-Client\Packages\manifest.json

Add a new dependency "com.unity.nuget.newtonsoft-json": "3.2.1". Please read the hint below.

Color Picker

To get the HSV-Color-Picker-Unity Edit File: Free-MMORPG\Free-Client\Packages\manifest.json

Add a new dependency "com.judahperez.hsvcolorpicker": "3.3.0" and additionally add to the file.

"scopedRegistries": [
    {
      "name": "package.openupm.com",
      "url": "https://package.openupm.com",
      "scopes": [
        "com.judahperez.hsvcolorpicker",
        "com.openupm"
      ]
    }
  ]

Hint: Don't forget commas after "dependencies" and before "scopedRegistries" -> '},' and line before the new dependency ends with also with comma too.

(back to top)

Needed projects from GitHub

UMA

Get UMA

Download our modified latest UMA version UMA 2.13 Beta 1-modified.rar with all needed modifications.

or

Download the latest UMA Unity Asset Pack UMA 2.13 Beta 1 from the UMA GitHub repository. And do all changes manually, please visit our wiki page UMA for more information.

Install UMA Package

Open with Unity the Free-MMORPG Unity project. Simple drag and drop the downloaded UMA213b.unitypackage from your download folder into the opened Unity project. Let all selected and click import.

Crest Ocean System

Get Crest Ocean System

Download the latest source code with tag 4.19 as zip file 4.19

Install Crest Ocean System

Unzip and drag the second crest folder into unity ./crest-4.19/crest-4.19/crest/Assets/Crest/Crest

(back to top)

Needed Unity packages from the Unity Asset Store

MapMagic 2

Go to the Unity asset store and buy the free asset MapMagic2 after that in the Unity Editor open the Package Manager Window -> PackageManager (Select Packages: My Assets) download and import MapMagic2 to the project.

(back to top)

Play the client

In your Unity project (FREE-Client) double-click the Persistent scene in the folder location Assets/Free-Client/Scenes/. This is our persistent scene with all Manager/Handlers ... all other scenes will automatically load additive async if needed and also the User Interfaces for the actual scene. More about the Module-GameManager please visit our wiki page Module-GameManager. Now you are ready to play the game from the Unity Editor, press play, if the server setup steps done see below.

(back to top)

Server

We use two servers free account server and free game server. You only can start and test one of it from your IDE at same time since they both use the same port. To test both at the same time, you need to deploy the server. More information can be found in the section deploy the server.

Setup Database

  1. install mongoDB
  2. open your mongosh
  3. Create your Database

use free

  1. Create a new user and password and give it access to the created database

db.createUser({user: "root", pwd: "123456",roles: [{role: "readWrite", db:"free" }] })

  1. Create two new collections:
db.createCollection("account", { collation: { locale: 'en_US', strength: 2 } } ) 
db.account.createIndex( { username: 1 } )
db.createCollection("character", { collation: { locale: 'en_US', strength: 2 } } )
db.character.createIndex( { name: 1 } )
  1. Add/Create this files to both of your Server projects:

Location: Free-Account-Server/free-account-server-common/src/main/resources/free-account-server-common-config.properties

Free-Game-Server/free-game-server-common/src/main/resources/free-game-server-common-config.properties

  1. Insert the following values for your database and change it to your needs.
database.mongo.uri=mongodb://root:123456@127.0.0.1:27017/free
database.mongo.database=free
database.mongo.collection.naming.case=UNDERSCORE
database.mongo.collection.naming.ignored_suffix=Entity

In this example file we use:

user: root

password 123456

database: free

(back to top)

Setup Mail

Enable or disable server sending mail via SMTP.

Basic Configuration

If you don't have a mail server or a mail provider that supports sending emails via SMTP, or if you do not wish to send emails (e.g., for local development), locate the following file:

Location: Free-MMORPG\Free-Server\free-server-app-api\src\main\java\com\assambra\app\constant\ServerVariables

Change the value to false: SERVER_CAN_SEND_MAIL = true.

Important: When SERVER_CAN_SEND_MAIL = false is set, only a log message in your IDE is generated on the server side. This setting is mainly intended for local development. However, it is strongly recommended to complete the email setup for production environments to ensure full functionality. Without email setup, clients will not be able to use features like "Forgot Password", "Forgot Username", and "Account Activation".

Setup Mail Values

For configuring the email functionality, use the same file you employed for your database settings in the Free-Account-Server. Add or modify the following values as required:

Location: Free-Account-Server/free-account-server-common/src/main/resources/free-account-server-common-config.properties

mail.host=mail.example.com
mail.port.tls=587
mail.port.ssl=465
mail.authentication=true
mail.username=account@example.com
mail.password=123456
mail.tls=true
mail.ssl=false
mail.mail.address=account@example.com
mail.mail.sender.name=YourCompany Account Management
mail.use.reply.address=false
mail.mail.reply.address=account@example.com
mail.charset=UTF-8
mail.content.type.primary=text/HTML
mail.content.type.sub=charset=UTF-8
mail.format=flowed
mail.content.transfer.encoding=8bit

Hint: Do not use SSL and TLS simultaneously with both set to true. There is no check in place, and only one should be set to true.

Most settings should be self-explanatory. If not, refer to the SMTP_EMail class and review the comments for each variable.

(back to top)

Deploy Server

Download Server

(back to top)

Server preparations

In this example we use the location D:\ezyfox-server

  • extract ezyfox-server-full-1.2.8.1.zip and copy the extracted files in the location.
  • open the file D:\ezyfox-server\settings\ezy-settings.xml in the editor and add between <zones></zones> two new zones.
<zone>
    <name>free-account-server</name>
    <config-file>free-account-server-zone-settings.xml</config-file>
    <active>true</active>
</zone>
<zone>
    <name>free-game-server</name>
    <config-file>free-game-server-zone-settings.xml</config-file>
    <active>true</active>
</zone>

(back to top)

Export external Libraries

Steps for Account Server

  • Open gitbash and go to the folder free-account-server-startup
  • Insert: mvn clean install -Denv.EZYFOX_SERVER_HOME=deploy -Pezyfox-deploy
  • Run: ExternalLibrariesExporter in free-account-server-startup/src/test/java/com.assambra.account/tools your IDE
  • Insert: D:/ezyfox-server hit enter

Repeat the steps for the Game Server

  • Open gitbash and go to the folder free-game-server-startup
  • Insert: mvn clean install -Denv.EZYFOX_SERVER_HOME=deploy -Pezyfox-deploy
  • Run: ExternalLibrariesExporter in free-game-server-startup/src/test/java/com.assambra.game/tools in your IDE
  • Insert: D:/ezyfox-server hit enter

(back to top)

Build the Server

find line "#export EZYFOX_SERVER_HOME=" remove # and insert after = D:/ezyfox-server in the two following files (please read the hint below)

  • Free-MMORPG\Free-Account-Server\build.sh
  • Free-MMORPG\Free-Game-Server\build.sh

In this example i use windows and Git Bash command client go to the project root of:

  • Free-MMORPG\Free-Account-Server\
  • Free-MMORPG\Free-Game-Server\
  • and run command bash build.sh for both of the project.

Hint: If is there some error:

cp: cannot create regular file 'D:ezyfox-server/settings/zones/': No such file or directory

there is some problem with forward slash and backslash depends on your operating system or command client try to use instead of D:\ezyfox-server this D:/ezyfox-server.

(back to top)

Run the server

Go to your server location D:\ezyfox-server

Windows: execute console.bat

Linux: sh ./console.sh for console server.

Linux as Service: sh ./start-service.sh. Stop the service: sh ./stop-service.sh. Restart the service: sh ./restart-service.sh

(back to top)

Contributing

Thank you for your interest in our project! We welcome contributions in various forms, whether it's through code contributions, reporting bugs, submitting feature requests, or spreading the word to your friends and colleagues. Your contribution is invaluable and helps us continuously improve our project.

Code Contributions

If you have experience in programming and would like to contribute to the development of our project, pull requests are always welcome! Please follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch for your changes.
  3. Implement your changes and thoroughly test them.
  4. Submit a pull request to our repository.

We will review your pull request and collaborate with you to ensure your changes are properly integrated.

Reporting Bugs

If you come across a bug in our project, please don't hesitate to report it. Use our GitHub issue tracking system for this purpose. Be sure to provide as many details as possible to assist us in troubleshooting.

Feature Requests

Do you have a great idea for a new feature? Share it with us! Simply create an issue on GitHub and describe your idea in detail. We'll review and discuss your request.

Try the Playable Demo

Try out our playable demo to experience our project in action. We appreciate your feedback and impressions.

Spread the Word

An easy yet effective way to support us is by sharing our project with your friends, colleagues, and on social media. The more people learn about our work, the better!

Wiki and Documentation

Our Wiki page and documentation are places where you can share your knowledge and expertise. If you'd like to make improvements, please feel free to do so. Your contributions are valuable to the entire community.

Thank you for your support and interest in our project! Together, we can make it even better.

(back to top)

Resources Section

(back to top)

Credits

(back to top)

Thank you

  • A special thanks to tvd12 for fixing a variety of bugs and providing great help with other issues.

(back to top)

Contact

Join us on Discord

(back to top)