I would like to ask the experts who are proficient in the design mode and questions about the basic mode of webgame.

Source: Internet
Author: User
Ask the experts who are proficient in the design mode and the basic mode of webgame. Develop a simple web game. All the requirements for programs and functions can be fulfilled. The problem is the selection and handling of the design model. Below are my initial settings: basic analysis: a virtual player. My system must provide the UI and operation buttons. Provides player attributes and methods. A virtual world. My system must be able to build a more sophisticated virtual world. There are maps, cities, buildings, experts who are proficient in design patterns, and basic webgame models.
Develop a simple web game. All the requirements for programs and functions can be fulfilled. The problem is the selection and handling of the design model.

The following are my initial settings:

Basic analysis:

A virtual player. My system must provide the UI and operation buttons. Provides player attributes and methods.

A virtual world. My system must be able to build a more sophisticated virtual world. Map, city, building, store, home, item, value (capital, experience, voice, skill points)
, Backpacks, equipment, etc. All these are implemented based on php + mysql + javascript.

Player interaction. My system requires players to interact with each other. You can perform various interactive operations. Send short messages to invite battles, control battles, and fight by multiple people to complete tasks. And so on.

Players interact with the virtual world. My system requires players to be able to perform operations. You can perform various function operations.
Birth, learning, mobile, work, business (sales, exchange (including items and funds, items), custom tasks .), Communication and Combat (a series of functions ),
Perform tasks (a set of functions plus time and rewards ). Item Processing. Fund processing.

Definition:

I personally define the above content:
User (player operation part) Trigger (triggered first when executing an event, virtual class) Action (such as moving, work, etc. are all events, virtual class) abstractItem (maps, cities, items, etc., all belong to virtual items and virtual items)

Method:
User: display () doAction ()
Only real-User operations are performed.

Trigger: display () doAction () needTime () beginTime () endTime ()
Trigger provides time control. Trigger's derived classes include instant execution, Countdown execution, and interactive player execution.

Action: display () doAction () begin () Process () end ()
Action provides the start, process, end, and derived class of the Action, including moving, working, and fighting of the event.

Export actitem: display () get () lose () use ()
AbstractItem constructs all the virtual items in the game. The derived class of AbstractItem, such as map and city, includes the role itself.


Mode:
My personal idea is that User is only used as the driver. Trigger provides a User-driven event and controls the execution time of the Action. AbstractItem provides objects related to all actions.

At this time, the User and Trigger are like the bridge mode, and the Action and semantic actitem are also like the brideg mode. Trigger and Action are in Abstractfactory mode.

In addition, the task function is required. I personally think that a task is a combination of triggers. Including pre-renewal and follow-up. I personally think that a Task class is required, but I don't know whether to put it in Action, or put it in Trigger, or independently.

At the same time, because it is a webgame, real-time or semi-real-time interaction, it is simulated through ajax. There is a dedicated timer (it is considered that the program running environment has this function.
The display part is the web page, that is, the UI package. A language pack may be required. The images used in the image package also need to be made into an image package. of course, the image package may belong to the UI package.

Problem:

1. what is the top mode or which mode is appropriate?
2. do I think the current model is reasonable or there are better optimization methods?
3. how to add tasks?
4. how can ajax be better combined with Trigger and timer? (Because ajax is a pure function, it is used by the Trigger again. The most important thing is js and php ...)
5. how can I reasonably add the UI package (multiple UIs may exist), language packs (multilingual), and conversation packages to the game? (Database? Fill in the table? Ini ?)

Please kindly advise! No code, just give your thoughts. Of course, examples and code are better.


------ Solution --------------------
No, ajax cannot do it.
Ajax is a single communication with a large number of consecutive requests.



As for others, you should design them based on object-oriented thinking.

Object event attribute method

------ Solution --------------------
To be honest, I didn't understand your content.
Different from my thoughts on WEBGAME

Also, why must we use the design model?
I just quote one sentence. when you hold a hammer in your hand, everything looks like a nail.
------ Solution --------------------
I do not deny the role of the model.
However, I think it is only necessary to use it in an understanding mode, rather than just using it ..
------ Solution --------------------
I personally think it is better to use the conversation package as an action and as an attribute or method of atcion.
Action, as an action, provides or outputs relevant conversation information when triggered. this is a system level
User-level direct output is enough.
------ Solution --------------------
Follow up...
------ Solution --------------------
Learning, follow
------ Solution --------------------
The server only needs to save various object statuses.


Others are about the JS architecture.
Don't use the MVC framework. The most important thing about webgame is execution efficiency, not development efficiency ....
------ Solution --------------------
MVC is just an example.

For webgame

JS is the memory.
PHP is a hard disk.

AJAX is a data storage operation.

Continue to discuss design patterns.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.