Un projet pour tester et apprivoiser godot. Ce n'est pas un client officiel. Utile également pour se balader dans les décors et voir les objets nouvellement créés dans un client godot.
Find a file
2020-05-09 22:17:45 +02:00
addons create module 2020-01-24 19:56:51 +01:00
assets store pharse and show phrase send by server (on console) 2020-05-04 18:56:26 +02:00
background_loader_scene typos 2018-09-30 16:22:07 +02:00
dispensaire_gridmap typo 2018-09-22 10:45:39 +02:00
dispensaire_scenes typo 2018-09-22 10:45:39 +02:00
game_scene create module 2020-01-24 19:56:51 +01:00
gdnative update network part 2020-04-10 18:09:06 +02:00
gui_scene/GUI update network part 2020-05-02 20:52:28 +02:00
login_scene update network part 2020-05-09 22:17:45 +02:00
modules update network part 2020-05-09 22:17:45 +02:00
scenes update network part 2020-05-02 20:52:28 +02:00
test_grid_map Correction des parametre des materiaux du dispensaire. 2018-09-04 15:05:41 +02:00
test_scene réorganisation des fichiers et correction de l'ecran de chargement qui ne s'adaptai pas a la taille du viewport. 2018-08-25 10:05:54 +02:00
.gitignore adding loader msg.xml and correct message when login/register error are detected 2020-01-05 16:16:07 +01:00
.gitlab-ci.yml update network class 2020-03-30 22:20:59 +02:00
.gitmodules remove gdscript and update modules 2020-02-09 16:13:30 +01:00
ca-certificates.crt Add openssl certificate 2018-10-04 17:26:38 +02:00
default_env.tres create module 2020-01-24 19:56:51 +01:00
export_presets.cfg adding loader msg.xml and correct message when login/register error are detected 2020-01-05 16:16:07 +01:00
global.gd create module 2020-01-24 19:56:51 +01:00
global.tscn adding low level communication with server khaganat (UDP) 2019-12-10 21:40:32 +01:00
icon.png initialisation 2018-07-25 09:36:19 +02:00
icon.png.import Portage Godot 3.1beta + bypass login 2019-03-05 20:20:05 +01:00
JukeboxPannel.gd create module 2020-01-24 19:56:51 +01:00
portail.gd wip: ajout du choix de la position d'arriver du portail. 2018-08-21 11:40:29 +02:00
project.godot update network part 2020-05-02 20:52:28 +02:00
README.md update network 2020-04-19 14:37:04 +02:00
TODO update network class 2020-03-30 22:20:59 +02:00

Build

Before build and launch client, build module (before, we need include modules on godot source)

Build module

mkdir build
cd build
# Disable build directory on godot editor
touch .gdignore
# clone godot
git clone https://github.com/godotengine/godot.git
cd godot
# switch on release
#git checkout 3.1.2-stable
git checkout 3.2
# Create link with our module (or copy file to godot/modules - as you like)
cd modules
for file in ../../../modules/*
do
   if [ -d $file ]
   then
      if [ -L $file ]
      then
         echo "Create link $(basename $file)"
         ln -s $file .
      else
         echo "Link $(basename $file) exist"
      fi
   fi
done
cd ..
# Copy modules doc to godot
cp modules/*/doc_classes/* doc/classes/.
# Clean project (if you build before)
scons -j$(nproc) -c
# Build a debug version
scons -j$(nproc) platform=x11 target=debug
# or build release_debug
scons -j$(nproc) platform=x11 target=release_debug
# or build release -> becarefull, this version works on root project and impossible to launch editor
scons -j$(nproc) platform=x11 target=release tools=no

# Build optimized with GCC
scons -j$(nproc) platform=x11 target=release_debug use_lto=yes
# Build optimized with CLang
scons -j$(nproc) platform=x11 target=release_debug use_llvm=yes use_lld=yes
cd ../..

Generate doc

If you want, you can regenerate doc. (Normally it's generated)

cd build/godot
./bin/godot.x11.tools.64 --doctool .
cp modules/*/doc_classes/* doc/classes/.

Launch godot with module

cd build/godot
bin/godot.x11.tools.64
cd ../..

Package client khaganat

Configure export

Configure on project export (or edit file export_presets.cfg)

Ex.: export_presets.cfg

[preset.0]

name="khaganat.linux.64"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
patch_list=PoolStringArray(  )
script_export_mode=1
script_encryption_key=""

[preset.0.options]

texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
custom_template/release=""
custom_template/debug=""

Generate package

godot --path . --export khaganat.linux.64 khaganat.linux64.bin

Launch client khaganat

With godot

godot login_scene/login_scene.tsc

Library

NetworkConnection

NetworkConnection -> class to manage/use NetworkConnectionCore All times, connect on NetworkConnectionCore (to get singleton) and launch function The goal is to don't managed Singleton, this class manage At end of program, you need execute function "terminate_network_connection" to remove singleton.

NetworkConnectionCore -> class Singleton (uniq object) [contains network connexion, state connexion] _state_connexion[StateConnectionBase] : Object change class with state connexion [StateConnectionNotInitialized, StateConnectionLogin, StateConnectionSynchronize, StateConnectionConnected, StateConnectionQuit] _network_data [NetworkData] : Object state connexion (Tick receive, send, bit acknowledge) _queue [BitStreamQueue] : queue to store message UDP (just simple method to try re-order message receive by UDP) _socketUDP [Ref] : network connexion

  NetworkConnection(object A)             NetworkConnection(object B)     ...
         |                                       |

+-------+----+---------------------------------------+-----------------------------------------+ | NetworkConnectionCore * _network_data * _queue * _socketUDP * _state_connexion if StateConnectionConnected

ReferentialMessage

ReferentialMessage -> class to manage/use ReferentialMessageCore

ReferentialMessageCore -> class singleton (uniq object) [Manage data provide by msg.xml], we can encode/decode khaganat's message

ViewMessage

Message UDP : +-------------------+------------+--- | CurrentSendNumber | SystemMode | . . . | 32 bits | 1 bit | +-+-+-+-+-+-+-+-+-+-+------------+--- 1 -> system mode 0 -> normal mode

+---------+ | | +----------------+ | | -> | System Message | | Message | +----------------+ | | | UDP | +----------------+ +---------------+ +---------+ +---------+ +---------+ | | -> | Normal Message | -> |LastReceivedAck|-| Level A +-+ Level B +-+ Level C + | | +----------------+ +---------------+ +---------+ +---------+ +---------+ +---------+

System mode : +---------+-- | Message | see system message | 8 bits | +---------+--

System Message: SYSTEM_LOGIN_CODE = 0 : [client] ... SYSTEM_SYNC_CODE = 1 : [server] +---- | Synchronize (32 bits - unsigned) +------ | stime (64 bits - signed) +------ | LatestSync ( 32 bits - unsigned ) +------ | MsgData ( 16 * 8bits : Array - md5sum of msg.xml) +------ | DatabaseData ( 16 * 8 bits : Array - md5sum database.xml) +------

SYSTEM_ACK_SYNC_CODE = 2 : [client] +---- | frontack ( 32 bits - unsigned) +---- | backack ( 32 bits - unsigned) +---- | longackbitfield ( 1024 ) +---- | syncCode ( 32 bits unsigned) +---- SYSTEM_PROBE_CODE = 3 : [server] +---- | LatestProbe ( 32 bits - signed) +---- SYSTEM_ACK_PROBE_CODE = 4 : [client] ... SYSTEM_DISCONNECTION_CODE = 5 : [client] ... SYSTEM_STALLED_CODE = 6 : [server] No more data SYSTEM_SERVER_DOWN_CODE = 7 : [server] No more data SYSTEM_QUIT_CODE = 8 : [client] ... SYSTEM_ACK_QUIT_CODE = 9 : [server] No more data

Normal mode: :

PacketServer +---------+ +---------+ +---------+ | Level A | | Level B | | Level C | | (0) | | (0) | | (0) | +---------+ +---------+ +---------+ +---------+ +---------+ | Level B | | Level C | | (1) | | (1) | +---------+ +---------+ +---------+ | Level C | | (2) | +---------+ +---------+ | Level C | | (3) | +---------+

+---------------+ |LastReceivedAck| | 32 bits | +---------------+

+---------+ +-----+-+-----------+ +-------------+ | Level X | -> | next | shortcode | -> 1 (true) | Action code | +----------- +---------+ | 1 bit | 1 bit | | 2 bit | | Action +-------+-----------+ +-------------+ -> | (X bits) +-------------+ +----------- -> 0 (false) | Action code | | 8 bits | +-------------+

Action code : ACTION_POSITION_CODE = 0: khanat-opennel-code/code/ryzom/common/src/game_share/action_position.cpp:34 void CActionPosition::unpack (NLMISC::CBitMemStream &message) px ( 16 bit unsigned ) py ( 16 bit unsigned ) pz ( 16 bit unsigned ) : low bit have other signification 0x01 : IsRelative 0x02 : Interior ACTION_GENERIC_CODE = 1: khanat-opennel-code/code/ryzom/common/src/game_share/action_generic.cpp void CActionGeneric::unpack (NLMISC::CBitMemStream &message) size ( 32 bits unsigned ) : if size > 512 we have an error (normally reject by server) StreamByte ( Array : size * 8 bits unsigned ) ACTION_GENERIC_MULTI_PART_CODE = 2 : khanat-opennel-code/code/ryzom/common/src/game_share/action_generic_multi_part.h:46 virtual void unpack (NLMISC::CBitMemStream &message) Number ( 8 bits unsigned ) Part ( 16 bits unsigned ) NbBlock ( 16 bits unsigned ) size ( 32 bits unsigned ) PartCont ( Array : size * 8 bits unsigned ) ACTION_SINT64 = 3 : khanat-opennel-code/code/ryzom/common/src/game_share/action_sint64.cpp:86 void CActionSint64::unpack (NLMISC::CBitMemStream &message) value ( 64 bits unsigned ) ACTION_SYNC_CODE = 10 : khanat-opennel-code/code/ryzom/common/src/game_share/action_sync.h:44 virtual void unpack (NLMISC::CBitMemStream &message) Sync ( 32 bits unsigned ) BKEntityId ( 64 bits unsigned ) [see definition : khanat-opennel-code/code/nel/include/nel/misc/entity_id.h:64] ACTION_DISCONNECTION_CODE = 11 : khanat-opennel-code/code/ryzom/common/src/game_share/action_disconnection.h No data ACTION_ASSOCIATION_CODE = 12 : khanat-opennel-code/code/ryzom/common/src/game_share/action_association.h virtual void unpack (NLMISC::CBitMemStream &message) IsNewAssociation ( bool / 1 bit ) if IsNewAssociation is true: SheetId ( 32 bits unsigned ) Replace ( bool / 1 bit ) ACTION_LOGIN_CODE = 13 : khanat-opennel-code/code/ryzom/common/src/game_share/action_login.h virtual void unpack (NLMISC::CBitMemStream &message) ua ( 32 bits unsigned ) uk ( 32 bits unsigned ) ui ( 32 bits unsigned ) ACTION_TARGET_SLOT_CODE = 40 : khanat-opennel-code/code/ryzom/common/src/game_share/action_target_slot.h virtual void unpack (NLMISC::CBitMemStream &message) Slot ( 8 bits unsigned ) TargetOrPickup (2 bits unsigned) ACTION_DUMMY_CODE = 99 : khanat-opennel-code/code/ryzom/common/src/game_share/action_dummy.h virtual void unpack (NLMISC::CBitMemStream &message) Dummy1 ( 32 bits unsigned ) Dummy2 ( 32 bits unsigned )

Impulse : (include on ACTION_GENERIC_CODE or ACTION_GENERIC_MULTI_PART_CODE)