Difference between revisions of "Engine/Structure/ja"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "500px|thumb|right|0.3 data flow diagram - still mostly accurate. == General architecture == Minetest always runs as a server and zero or m...")
 
(rename Minetest to Luanti)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:minetest-0.3-dfd-visio.png|500px|thumb|right|0.3 data flow diagram - still mostly accurate.]]
+
{{Languages}}
== General architecture ==
 
  
Minetest always runs as a server and zero or more clients connected to it.
+
[[File:minetest-0.3-dfd-visio.png|500px|thumb|right|バージョン0.3のデータフロー図 - 現在もほとんどが正確です。]]
 +
== 全体の構造 ==
  
== Functions ==
+
Luantiは常に、サーバーと0個以上の接続されているクライアントとして動作します。
 +
 
 +
== 関数 ==
  
 
=== main() ===
 
=== main() ===
 
main.cpp
 
main.cpp
  
When Minetest starts, main() comes up from main.cpp. It handles all the command-line arguments (server and client) and launches and processes the results of the main menu (client).
+
Luantiが起動すると、まずmain.cpp内のmain()関数が実行されます。これは全てのコマンドライン引数(サーバーとクライアント)、起動、メインメニュー(クライアント)の結果を処理します。
  
 
=== dedicated_server_loop() ===
 
=== dedicated_server_loop() ===
 
server.{h,cpp}
 
server.{h,cpp}
  
When the dedicated server is run, main() ends up running this and when it returns, Minetest quits.
+
When the dedicated server is run, main() ends up running this and when it returns, Luanti quits.
  
 
It basically just feeds time to the server instance created by main() and reacts to SIGKILL etc.
 
It basically just feeds time to the server instance created by main() and reacts to SIGKILL etc.
Line 161: Line 163:
 
map.{h,cpp}, clientmap.{h,cpp}
 
map.{h,cpp}, clientmap.{h,cpp}
  
=== ServerMap (Map) ===
+
=== ServerMap (マップ) ===
  
 
map.{h,cpp}
 
map.{h,cpp}
 
[[Category:Core Engine]]
 
[[Category:Core Engine]]

Latest revision as of 17:53, 28 October 2024

Language: [[::Engine/Structure|English]]  • [[::Engine/Structure/ja|日本語]]
バージョン0.3のデータフロー図 - 現在もほとんどが正確です。

全体の構造

Luantiは常に、サーバーと0個以上の接続されているクライアントとして動作します。

関数

main()

main.cpp

Luantiが起動すると、まずmain.cpp内のmain()関数が実行されます。これは全てのコマンドライン引数(サーバーとクライアント)、起動、メインメニュー(クライアント)の結果を処理します。

dedicated_server_loop()

server.{h,cpp}

When the dedicated server is run, main() ends up running this and when it returns, Luanti quits.

It basically just feeds time to the server instance created by main() and reacts to SIGKILL etc.

the_game()

game.{h,cpp}

Launched when you start the game from the main menu.

This creates the client (and the server, if needed), handles the waiting of loading stuff from the server, and runs the game in a somewhat badly structured main loop (which works well, though).

Threads

Stand-alone server

  • main
  • Doesn't do much
  • ServerThread (Server)
  • Runs the server
  • EmergeThread (Server)
  • Fetches and generates world

Client-only

  • main
  • Runs almost everything in main game loop
  • MeshUpdateThread (Client)
  • Does mesh updates in the background

Singleplayer

  • main
  • Runs almost everything except server in main game loop
  • MeshUpdateThread (Client)
  • Does mesh updates in the background
  • ServerThread (Server)
  • Runs the server
  • EmergeThread (Server)
  • Fetches and generates world

Classes

IGameDef

An interface for fetching pointers to the managers of things. It is passed to almost everything.

It is implemented by Client and Server. Neither implements all interfaces.

Generally these can be accessed by referring to IGameDef:

  • TextureSource
  • ItemDefManager
  • NodeDefManager
  • SoundManager
  • MtEventManager

This is the main difference between 0.3 and 0.4. In 0.3 this does not exist, because all content is defined in static tables in source code.

gamedef.{h,cpp}

TextureSource

Fetches, generates and caches textures.

tile.{h,cpp}

ItemDefManager

Stores the definitions of items, by item name. Content is set up at server startup, and transferred from server to client at beginning of connection.

itemdef.{h,cpp}

NodeDefManager

Stores the definitions of nodes and the mapping between node ids and names. Content is set up at server startup, and transferred from server to client at beginning of connection.

nodedef.{h,cpp}

SoundManager

Stores and plays sounds on the client.

sound.{h,cpp}; sound_openal.{h,cpp}

MtEventManager

A minimal event manager currently only used for triggering sounds on the client.

event.{h,cpp}

Client

Contains a lot of stuff. Most considerable members are listed here.

  • TextureSource
  • ItemDefManager
  • NodeDefManager
  • SoundManager
  • MtEventManager
  • MeshUpdateThread
  • ClientEnvironment
  • ClientMap
  • Players
  • ClientActiveObjects (CAOs)
  • Connection

Implements IGameDef.

client.{h,cpp}

Server

Contains a lot of stuff. Most considerable members are listed here.

  • ServerEnvironment
  • ServerMap
  • Players
  • ServerActiveObjects (SAOs)
  • Connection
  • BanManager
  • Lua State
  • ItemDefManager
  • NodeDefManager
  • CraftDefManager
  • ServerThread
  • EmergeThread

Implements IGameDef.

server.{h,cpp}

Script Engine

script/*

The script engine contains "core to script"- as well as "script to core"-interface implementation.

Connection

Connection (client->server or server->clients)

ClientEnvironment (Environment)

Contains most of the actual game environment (players, objects, map...)

  • ClientMap
  • Players
  • ClientActiveObjects (CAOs)

environment.{h,cpp}

ServerEnvironment (Environment)

Contains the actual game environment (players, objects, map, time of day, ...)

  • ServerMap
  • Players
  • ServerActiveObjects (SAOs)

environment.{h,cpp}

ClientMap (Map)

map.{h,cpp}, clientmap.{h,cpp}

ServerMap (マップ)

map.{h,cpp}