An article will teach you Python game development platform, system architecture design scripts

2.1 Development Platform
2.1.1 System development environment introduced
the current program is the python programming language, main function dependent on the pygame modules, mainly used in position between the target surface, then use the event listener let the program up and running. After the position of the object changes Surface run, the interface refresh, when the user operates the mouse and keyboard, monitor operation is completed the corresponding event.
Software development methods: ① ② system design coding system detailed design ③ ④ test
system operating environment: Windows7 and later;

Introduction 2.1.2 database system
MySQL is an open source relational database management system (RDBMS), which uses Structured Query Language (SQL), a widely used database management.
MySQL is open source, so anyone can download under General Public License, and you can modify the settings to suit your own personal needs.
MySQL has the speed, reliability and adaptability, etc., and it has been a wide range of concerns. Most people think that MySQL is the best choice for managing content without transacting.
Therefore, the use of lower demand for simple cases in the database, I chose MySQL as the database management tool.

2.1.3 development tools introduced
PyCharm is a Python integrated development environment, a set of tools that can help users improve the efficiency of development python language, such as debugging, syntax highlighting, IntelliSense, automatic operation, unit testing, project management, code jump ,version control.
Encoding support: it supports intelligent, configurable editor provides code completion, code snippets, code folding support and a window into the user quick and easy task, saving the user time.
Project Code Navigator: This IDE to help lead the user to quickly switch between files, browse the statement from one way, and the class hierarchy of usage. If you remember to use the shortcuts they provide, their efficiency will be higher.
Code analysis: users can use the encoding rules, error highlighting, intelligent detection and rapid completion of a key code is recommended to optimize the code.
Python Reconstruction: in the process of preparing the program, import domain / variables / constants, rename, extraction / superclass, and move the thrust / reverse remodeling these operations may be used to implement this function, greatly reducing the user's assignments.
Integrated Version Control: If you want to use these features, such as login, enter, view, split and merge, - the user can be found in the VCS user interface, which is its common functionality.
Having a built-in debugger, the debugger functional diversification can provide a variety of functions, user-based debug python and Django projects, the same unit of the test system, it can also be solved by,
the debugger comprising blake point step, the multi-screen view, and the window calculation expression or the like.
Integrated unit test: The user can run the test file, a single test class. One way or all of the test items.
On the other hand, Pycharco Django also provides for the development of a number of good features, and support for Google App Engine, and support for the Pycharm.

2.2 development technologies
python language used to develop the software, key technology is the layout, event monitoring and data storage. The layout of the main game interface is landscaping layout and interface. User interface with layout to achieve, giving users a beautiful, comfortable, straightforward user experience. Therefore, the design interface layout will affect the user experience of the objective to obtain a user operation using the event monitoring technology, and data monitoring technology records all operations, create user data to be extracted.

2.2.1 Python dynamic scripting language Introduction

Python是一种优雅、简单、健壮的开源解释语言。产生于1989年,由Givavo RSM开发和设计,设计Pyhlo的最初目的是为了高效的完成某一项任务而创造的。它从一种为提高研究项目的工作效率而创建的通用编程语言开始。经过多年的发展,python已经逐渐得到改进。由于其强大的可扩展性和广泛的库支持,它已经出现在许多领域,如豆瓣等就是成功的应用python技术的例子。

The main features of Python are:
1
2
L) low entry standard python syntax is quite short, usually short program written, very much like the natural language of everyday use, help developers to use and understand.
2) As an object-oriented language, classes and objects, features reflects the python, object-oriented language features are created at the time that language would be reflected. Python is able to become a favorite of the public programming language lies in its well-designed data and memory management.
3) For memory management, python also has its specific part responsible, for developers, the program becomes necessary, because the developers only to understand the logic of these programs before and after the project to write better, so they do not like C / C ++ programmers that specialize in processing memory transactions. Python programming and the preparation time is shorter, less error is also based on this feature.
4) communicate with host languages can easily be fitted, it can be written in C for some places particular emphasis on the performance of these extensions is invoked to achieve the object of improving performance in python. Instead, Python interpreter may be embedded in C / C ++, which can be substituted by the interface in the form of dynamic link libraries, in this way, whereby it becomes flexible program development.
5) In the python standard library, there are a plurality of modules to implement specific functions, covering the operating system functions and interactive interpreter, these modules can be used directly for function development has been completely tested. These templates have been fully tested has been fully applied in the actual programming development.

2.2.2 scripting system architecture design
in game development, serving as the connection of the script. We need to solve the problem is the script and host the code, that's how high efficient and convenient management and operation of the script code, it is a game of logic developed and carried out to promote the entire game. Scripts need to be addressed and the host code is usually event-centric, and his links between them. The game engine is device that interacts with the game script, so we can get the script language structure, that is, interface, interfaces and other interactive scripting language and is a major part of our design, we will scripting interface integrated into the game engine interface, the purpose is to implement these interfaces. With the combination of engine interface and the interface of the game, to expand python script to bring the convenience, but also to make python richer, providing data exchange between pythlo scripts and game engine to achieve a logical and concrete realization of the purpose of separation.

The overall design 2.2.3 scripting interface module of
its several components of the script wrapper ,, message processor script, script logic, interface to the game world, the script object manager, whose role includes the following aspects.
l) implementation of the game each function interfaces are provided by Python script completed, the interface can be implemented to create a game world game objects, set the timer, modify the properties of the game in game objects, or print debug logs and other functions, but also this interface to achieve the management function.
2) For management script file, we use the engine to achieve this functionality, so the internal logic structure is the key to invoke the script, the script wrapper script calls the function can be achieved, that is invoked by a logical manner. A script to a single control module. Message handler object and two logic script object is an important part of the script wrapper. Action message processor is to process a message from the business logic.
3) Message Processor is stabilized by mapping relational tables and repair, dynamic loading, modify, and delete engine script object is achieved by modifying the kernel to map the message handler object maintenance. This feature also implements the hot update logic. Python scripting engine interact with each other is through a scripting interface module design abstraction layer to achieve, which is a layer of abstraction. With this abstraction layer and Cython Python scripts can interact in Python and C on the basis of between Python and C ++. Wherein exception handling and converts the data format is the main part.

2.2.4 Python function call the engine
engine logic part of the need to use the Python language design and implementation, thus providing access to the internal entity Pythlo language interface is the engine has to offer, here are some steps to provide an interface.
1) engine to create specific extension module code.
2) using the template to package code, where a single C source file is written in a scripting interface system.
a. include all statements we need is python h header file b. In order to convert Python parameters to a C program format type, we have increased Pyobject * Mdolue_func () wrapper function for each function, treatment is completed, Python interpreter You will receive instructions coming from a Python object. Setting exception handling module object is to eliminate errors that occur during. c. Set PyMethodDefMethod [] array is used to implement link nteto function and the function name.
d. initialization function module increases initMethod ().


Author: Ancientear
Source: CSDN
Original: https://blog.csdn.net/ancientear/article/details/91141297
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin blog.csdn.net/PyhtonChen/article/details/94619490