Switch] experience sharing in Flash online game development
Source: Internet
Author: User
About a year ago (March), I had the urge to use flash for web games. So I studied as2. After understanding it, I feel that as2 is still lacking in web games. At this time, I learned about as3. Experienced in Java Development Program Personnel, especially programmers who have developed Java clients, as3 is really suitable for game development.
Later, the company started the flash MMORPG project, so it began to learn the syntax and library of as3 and learn the flex tool. With the Java experience, these will soon become.
As a flash web game, not only the display of cool effects, but also a lot of user interaction and logic, so a good game must be inseparable from as3 Code . I suggest you read all the documents before you start the development project. By the way, you can write some test code to deepen your understanding. The recommended documents and reasons are as follows:
Adobe Flex help. This is the help provided by Flex. After reading this, we will know how to use as3 to create, compile, compile, debug, and publish applications. When using as3, what can be done and what cannot be done; what can be used directly as ready-made and what needs to be developed by yourself. Some people are used to reading text for help, Google, or asking questions in the Forum. In fact, questions are also learned. The more accurate you can describe the question, the faster you can get an accurate answer.
The basic syntax and common functions of as3 are as follows. After reading these questions, you can leave them alone. When reading a book, those that need to be used immediately should be noted down; those that cannot be used for the time being can find the answer wherever they are used.
The following describes the technologies that I think should be mastered to develop flash online games.
1. Display
A game is inseparable from display. as3 has provided developers with a complete 2D Display Engine. Learn this part, learn the display list, learn the differences between displayobject and displayobjectcontainer, and learn the differences between shape, Sprite, movieclip, and bitmap objects that can be displayed.
2. mouse input
Interaction is inseparable from the processing of user input. The mouse is the most common input device in the game. You must know that only objects inherited from interactiveobject can receive mouse messages. You also need to learn how to drag the mouse, how to determine the target of the mouse message, how to enable and disable the mouse message. Global and local conversion of mouse coordinates.
3. keyboard input
In addition to the standard UI components, the keyboard also needs to be used for functions such as game shortcuts.
4. Bitmap
As game development, not all art materials may be fixed at the development stage, and more or less graphics must be transformed during the game. Therefore, you must be familiar with bitmap and bitmapdata objects.
5. Layer
As an MMORPG game, different visual objects have hierarchical relationships. The relationships between different layers are fixed, such as the ground layer, character layer, and UI Layer. When objects on the same layer overlap, you must modify the relative position in the display list to adjust the upper and lower relations.
6. UI Components
Button, input box, text box, drop-down box, list, table. These are indispensable in the game. In order to make the game picture beautiful and consistent in style, you usually need to modify the skin of the standard component to apply it to the game.
7. Resource Loading
As we all know, the traditional Client MMORPG games are usually several hundred m above g size, most of which are media resources, and we cannot hit these resources into a SWF file, therefore, you need to determine the loading policy based on the importance of the resource. The most commonly used and basic functions are loaded when a program starts. Others can be dynamically loaded during the game.
8. Event Mechanism
The addeventlistener method is more or less used as a newcomer. As a large system developer, you must know the ieventdispatcher interface and eventdipatcher class behind this method. The event mechanism is used for development. On the one hand, to reduce code coupling, it also facilitates collaborative development by multiple users.
9. Remote Communication
As a communication solution of MMORPG, efficiency and security need to be considered. On the server side, we are very familiar with Java Socket development and have seen the socket class of as3, so we did not hesitate to choose a communication method using private protocols. As MMORPG, HTTP-based protocol efficiency is certainly lower than that of TCP-based Binary protocol. In addition, HTTP is not suitable for scenarios where the server pushes messages to the client. I don't know much about other communication methods of as3. I don't know whether it is more flexible, secure, and performance than the socket solution.
10. Performance Optimization
As a commercial game, we need to consider the diversity of the player environment. Therefore, many effects of the system must be controlled by parameters so that the program can run smoothly on the player's machine. As a flash online game, you need to consider the memory usage and CPU usage of the client, and the server traffic and the bandwidth from the client to the server.
11. Multithreading
First, Flash does not have multiple threads. It is a single thread. If you want to implement complex computing that is similar to opening a thread, You can encapsulate the computing into a class and provide a step method, each time a step is used, several steps are executed, and time slices are manually allocated to the code. This method is used to simulate multithreading.
12. Advanced knowledge (JS/jsfl/swf format/disturbing/virtual machine running mechanism)
As a product, there are still many details to consider during the development process.
For example, use externalinterface to communicate with Js. Web games are inseparable from webpages and occasionally interact with webpages.
Use jsfl to generate or process FLA project files in batches. The format of a large number of resources in the game is similar. If it is completely human, a large amount of repetitive work is required. Fortunately, flash provides jsfl extension, which helps us save a lot of manpower.
Understanding of swf format. Some work, because jsfl is poorly programmable and cannot be implemented perfectly, we also write programs to operate SWF files directly. Once there was a requirement that it took four people a week to handle the problem, and it was still very error-prone. Later, I wrote a jsfl script and added programming to process SWF directly, it only takes a few minutes for the program to run for one hour.
When commercial products are released, code must be disturbed. Now the anti-compilation pioneer sothink4/asv6 has been released, but the as3 disturbing work is far behind the pace of decompilation. We Flash developers are in a hurry.
13. Algorithm
Algorithms are useful for game development. Sometimes it is an improvement in efficiency, and sometimes it may be a difference between 01 and 01.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.