multiplayer_template.adoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. = multiplayer_template
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  6. This page is to make your own multiplayer game, mainly by using a template and understanding how it works.
  7. The template for a multiplayer project can be found here:
  8. link:https://hub.jmonkeyengine.org/t/multiplayer-game-template/29904[https://hub.jmonkeyengine.org/t/multiplayer-game-template/29904]
  9. Additional information e.g. links to jars can be found here:
  10. link:https://hub.jmonkeyengine.org/t/need-help-need-jar-files-for-a-project/30065[https://hub.jmonkeyengine.org/t/need-help-need-jar-files-for-a-project/30065]
  11. //Class diagram (template only):
  12. //link:http://puu.sh/a4azI/8c37cd8cf4.png[http://puu.sh/a4azI/8c37cd8cf4.png]
  13. A lot of work has to be done, but the best thing to start with, is summing up the classes, with the variables and explaining what the use is of those.
  14. Classes (by package):
  15. NetworkRpg:
  16. . GameClient (Interface)
  17. . GameConstants
  18. . GameGuiController
  19. . Main
  20. ....
  21. private AppSettings settings; sets the resolution
  22. private boolean isFullScreen = false; obvious: fullscreen
  23. ....
  24. . MenuInputMapping (No variables)
  25. . RemoteGameClient
  26. . ServerMain
  27. . ThirdPersonCamera
  28. . TimeProvider (Interface)
  29. NetworkRpg.AppStates:
  30. . BaseAppState
  31. . ConnectionState
  32. . EntityDataState
  33. . ErrorState
  34. . GamePlayState
  35. . MainMenuState
  36. . ModelState
  37. . WorldState
  38. NetworkRpg.Components:
  39. . ModelType
  40. . Position
  41. . walkDirection (No variables)
  42. NetworkRpg.Factories:
  43. . EntityFactories
  44. . GameModelFactory
  45. . ModelFactory
  46. NetworkRpgt.Handlers:
  47. . GameMessageHandler
  48. NetworkRpg.Networking:
  49. . Util
  50. ....
  51. public static final int tcpPort = 1337; portnumber used for tcp connections
  52. public static final int udpPort = 1337; portnumber used for udp connections (http://www.diffen.com/difference/TCP_vs_UDP)
  53. public static final String GAME_NAME ="Network RPG"; name of the game
  54. public static final int PROTOCOL_VERSION = 1; version of the udp/tcp protocol being used
  55. ....
  56. NetworkRpg.Networking.Msg:
  57. . ChatMessage
  58. . CommandSet
  59. . GameTimeMessage
  60. . PlayerInfoMessage
  61. . ViewDirection
  62. NetworkRpg.Objects:
  63. . Avatar
  64. ....
  65. public Spatial avatarSpatial; holds information about the character
  66. private Node avatarNode; a node which contains the modelnode
  67. private Node model; a node which contains your character (the green thing on the map)
  68. public BetterCharacterControl avatarControl; this is used to set the gravity
  69. private SimpleApplication App; we need this to get the rootnode
  70. private BulletAppState bulletAppState; allows using bullet physics in an Application.
  71. private Node rootNode; the node which gets all the nodes (add to this one, and it'll be visible)
  72. private AnimChannel animChannel; used to change the current anitmation
  73. private AnimControl animControl; this is needed to create an animchannel
  74. private BitmapText label; label where we add a the textnode to
  75. private Node textNode; name above the head of the player
  76. private String idleAnim = "IdleBase"; name of the animation (not 100% sure)
  77. private String walkAnim = "RunBase";
  78. private String attackAnim = "SliceHorizontal";
  79. private String jumpAnim = "JumpLoop";
  80. private BitmapFont guiFont; the font
  81. private String playerName; name above the avatar
  82. ....
  83. NetworkRpg.Services:
  84. . EntityDataService
  85. . GameSystems
  86. . MovementService
  87. . Service (Interface)
  88. This is a total of 35 classes.