This is the continue of the previous blog fast prototyping of a new game project. With the ET game framework(refer to https://github.com/egametang/Egametang), and lack of server support, I decide to continue my attempt to develop our a game all in C#. The progress become very fast, due to following factors.
1. A fast UI making approach.
UI has been one of most time consuming work during game development. Managing buttons/labels is extremely tedious when there are lots of UI pages.
There is a simple way to handle UI. Take NGUI for example, we assemble the UI widget in a prefab, and drag a list of widgets(example, buttons, labels) in a script, click a button to auto-generate all the boilerplate code. The auto-generated code could be just two files, one view script one control script. For example, Login UI panel, three scripts would be generated, Login_C, Login_V, Login_M. In Login_V, all the widget assignment related code is generated, in Login_C, the value of widget is assigned. All model related info is stored in Login_M. This way is kind of MVC.
The UI system has been made to be extremely user friendly. After assembling the UI panel, with one button click and two line of code change(to register the panel in the UI system, and define the layer of UI), a UI is considering visually done. The rest of the work is just linking up with the game model.
Also, WrapContent Grid List is implementeded into the UI system. So HorizontalWrapContent, VerticalWrapContent and SlopyVerticalWrapContent are all included. This make the knowledge of making UI available as a tool to everyone.
2. Powerful design of ET game framework
ET game framework is designed extremely modular. It is powerful enough to handle all the server related functions. You just need to fill in the gameplay related code. Everything else, let the actor-component-based game server do for you.
3 NoSQL
I have experience in using mssql, and dynamodb(amazon's nosql db service) in two projects. My general feeling is that NoSQL is easier to develop. With C# define the schema, json is stored and retrieved and can convert to C# directly.
MongoDB is directly supported in the ET framework. Within one day, I installed the Mongodb and store the player data as document in mongodb and link it with ET game server.
4. Property System
Managing game state manually is tedious. As there are so many game state related logic, each time, a state related value is modified, you need to decide whether the data should be synchronized to client.
Property system is a good helper to handle all the tedious work. Each player in the client/server share a list of properties, for example, health property, position property. When a property is modified, for example health property, the health property would be marked with modified frame-count, then the property system could decide whether the health property(and all other properties) should be synchronized to client by checking the modified frame-count and other factors in the update-checking frame.
One layer property system has some limitation. For each example, BagItemProperty is used to store all the items in the bag. In one layer property system, a single item change would cause the whole BagItemProperty to resend to client which is a waste of bandwidth. Now I add two layer property system, the BagItemProperty could consist of a list of ItemCountProperty, and I only send the ItemCountProperty which is modified to client.
Overall, with property system, a delta-game-state is auto-generated. and with a self-defined network serialization/de-serialization protocol, the delta-game-state would be auto updated to game client.
5. Sharing of Code between Server/Client
As all the code is done in C#, code could just be shared.
For example, in the resource level, in the front, all the game setting files(in json format) is loaded in the client side. Without modify a line of code, just by sharing the folder between the server and client project, the server side would have all the game related setting.
In the gameplay level, all the property system related code is shared between server and client. so that there is no way that property list could be mis-matched.
6. Behavior tree style buff system
Buff plays an important role in turn based games. Behavior tree is widely used for AI in games. Each buff is very much a mini-behavior tree. There are preconditions, and effects for each buff. Very much like the condition node and action node in behavior tree.
Behavior tree can easily turn buff design documents into a graph of tree node structure. After drawing the tree, the rest of the work is implement the logic of each tree node(condition node, action node).
Final words
C# has becoming a good language for game development. Less room to make mistake, coding is much simpler with the available of async, await after C# 4.0. With all the above listed adoption/approaches, in one week, from my previous prototype, I have managed to have a simple database which could store player's information(including items, quests), and front end could show items, bags, players moving around with the help of one colleague.
With the game making processing more like a machine assembly pipeline, I plan to dive back into C++ for a breath of fresh air.
1. A fast UI making approach.
UI has been one of most time consuming work during game development. Managing buttons/labels is extremely tedious when there are lots of UI pages.
There is a simple way to handle UI. Take NGUI for example, we assemble the UI widget in a prefab, and drag a list of widgets(example, buttons, labels) in a script, click a button to auto-generate all the boilerplate code. The auto-generated code could be just two files, one view script one control script. For example, Login UI panel, three scripts would be generated, Login_C, Login_V, Login_M. In Login_V, all the widget assignment related code is generated, in Login_C, the value of widget is assigned. All model related info is stored in Login_M. This way is kind of MVC.
The UI system has been made to be extremely user friendly. After assembling the UI panel, with one button click and two line of code change(to register the panel in the UI system, and define the layer of UI), a UI is considering visually done. The rest of the work is just linking up with the game model.
Also, WrapContent Grid List is implementeded into the UI system. So HorizontalWrapContent, VerticalWrapContent and SlopyVerticalWrapContent are all included. This make the knowledge of making UI available as a tool to everyone.
2. Powerful design of ET game framework
ET game framework is designed extremely modular. It is powerful enough to handle all the server related functions. You just need to fill in the gameplay related code. Everything else, let the actor-component-based game server do for you.
3 NoSQL
I have experience in using mssql, and dynamodb(amazon's nosql db service) in two projects. My general feeling is that NoSQL is easier to develop. With C# define the schema, json is stored and retrieved and can convert to C# directly.
MongoDB is directly supported in the ET framework. Within one day, I installed the Mongodb and store the player data as document in mongodb and link it with ET game server.
4. Property System
Managing game state manually is tedious. As there are so many game state related logic, each time, a state related value is modified, you need to decide whether the data should be synchronized to client.
Property system is a good helper to handle all the tedious work. Each player in the client/server share a list of properties, for example, health property, position property. When a property is modified, for example health property, the health property would be marked with modified frame-count, then the property system could decide whether the health property(and all other properties) should be synchronized to client by checking the modified frame-count and other factors in the update-checking frame.
One layer property system has some limitation. For each example, BagItemProperty is used to store all the items in the bag. In one layer property system, a single item change would cause the whole BagItemProperty to resend to client which is a waste of bandwidth. Now I add two layer property system, the BagItemProperty could consist of a list of ItemCountProperty, and I only send the ItemCountProperty which is modified to client.
Overall, with property system, a delta-game-state is auto-generated. and with a self-defined network serialization/de-serialization protocol, the delta-game-state would be auto updated to game client.
5. Sharing of Code between Server/Client
As all the code is done in C#, code could just be shared.
For example, in the resource level, in the front, all the game setting files(in json format) is loaded in the client side. Without modify a line of code, just by sharing the folder between the server and client project, the server side would have all the game related setting.
In the gameplay level, all the property system related code is shared between server and client. so that there is no way that property list could be mis-matched.
6. Behavior tree style buff system
Buff plays an important role in turn based games. Behavior tree is widely used for AI in games. Each buff is very much a mini-behavior tree. There are preconditions, and effects for each buff. Very much like the condition node and action node in behavior tree.
Behavior tree can easily turn buff design documents into a graph of tree node structure. After drawing the tree, the rest of the work is implement the logic of each tree node(condition node, action node).
Final words
C# has becoming a good language for game development. Less room to make mistake, coding is much simpler with the available of async, await after C# 4.0. With all the above listed adoption/approaches, in one week, from my previous prototype, I have managed to have a simple database which could store player's information(including items, quests), and front end could show items, bags, players moving around with the help of one colleague.
With the game making processing more like a machine assembly pipeline, I plan to dive back into C++ for a breath of fresh air.
Extraordinary post! I am impressed by your writing skill, I wants to praise your efforts that you put in this post. Thank you so much dear. I also wants to suggest the best Unity 3D Game Development Services
ReplyDeleteI am really happy to say it’s an amazing post to read. I learn new information from your article, you are doing a great job. Keep it u
ReplyDeletePoker Game Development Company