Skip to content

A Brief Diablo World Server Building Tutorial

9miao Mobile Game edited this page Aug 22, 2014 · 1 revision

A Brief Diablo World Server-Building Tutorial

Server

Install Linuxdeepin in virtual machine
Python 2.7 is also required
Then we install mysql memcached git
sudo apt-get install mysql-server libmysqlclient-dev memcached git

Configure mysql

vi /etc/mysql/my.cnf
Add # bind-address=127.0.0.1 in front of vi /etc/mysql/my.cnf
PS: vim, you can find the vim commands on the internet

mysql -uroot –p: password that is needed to input during installation of mysql (no password, blank)
PS: enter and you will see ‘mysql > ’
mysql > use mysql;
mysql > update set host='%' where user='root' and host='127.0.0.1';

Change password
mysql> UPDATE mysql.user SET password=PASSWORD (‘new password’)
WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

/etc/init.d/mysql restart;

Su input system password

cd /home
mkdir ahsj
chmod 777 /home/ahsj// -R

cd ahsj

Download setuptools, this example’s version is setuptools-1.1.6

cd setuptools-1.1.6

python ez_setup.py

easy_install twisted
easy_install python-memcached
easy_install DBUtils
easy_install zope.interface
easy_install affinity
easy_install MySQL-python

git clone h| separate|ttps://github.com/9miao/firefly.git

cd /home/ahsj/firefly/firefly/
python setup.py build
python setup.py install

Unzip the downloaded server to /home/ahsj
cd /home/ahsj/DiabloWorld-V1.6/

mysql -uroot -p password < DiabloWorld-V1.6.sql

cd DiabloWorld-V1.6

vi config.json: modify some messages in database

python startmaster.py

This example runs the server in virtual machine, so it needs to use port mapping, here we use PortMap

Client

Download androidsdk Eclipse Ndk mingw

Set environment variables

Create ndk.bat

SET ANDROID_HOME=D:\android-sdk-windows
SET PATH=%PATH%;%ANDROID_HOME%\dex2jar;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;D:\Program Files\Ant\bin;
SET NDK_ROOT=%ANDROID_HOME%\android-ndk-r9
SET ANDROID_NDK_ROOT=%ANDROID_HOME%\android-ndk-r9
_@echo off _
D:\MinGW\msys\1.0\msys.bat

Download cocos2d-x-2.1.5

Create projects in the same folder tree of samples and unzip client source code into it
D:\Ltmp\cocos2d-x-2.1.5\projects\tsDemo\proj.android

Open ndk.bat

cd /d/Ltmp/cocos2d-x-2.1.5/projects/tsDemo/proj.android
sh build_native.sh

Make sure generate libs\armeabi\libcocos2dcpp.so

Open Eclipse and import it, and then select project libcocos2dx tsDemo

Connect to mobile phone

Then run mode -> android application select ‘phone’

Note: modified part

SocketManager.cpp
__socket = new SocketClient("172.23.23.12",31009,1,1,NULL);_

config.json
"net":{"netport":11009,

User list: open tb_register you can see user name, password etc.

Look at this error:

[2013-09-25 14:13:03 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/cocos2dx/lib/Cocos2dxAccelerometer;

Screenshot of successful running:

There might be a caution that could lead a failure of compiling in cocos2d-x-2.1.5

Modify: tsDemo\proj.android\jni\Application.mk

Add in the end: APP_CFLAGS += -Wno-error=format-security

The complete version:
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1
APP_CFLAGS += -Wno-error=format-security

Clone this wiki locally