A failure summary, HGE engine how to use? _ Engine

Source: Internet
Author: User

About three months ago, I was trying to use a few 2D game engines.

The first is SDL, a cross-platform 2D game engine recommended to me by my colleagues. This engine is highly rated, in general because it is the bottom of the system, the functionality is very basic, and provides a platform-independent interface. So developers on this can be unrestrained development. But I'm not so keen on the bottom. So I gave him up after writing a few experimental programs. Oh, the study of it was mainly because they are doing embedded, is interested in cross-platform. But at that time to see a foreigner, seems to be called Lazyfoo, wrote the development tutorial let me learn a lot of game development basic knowledge.

Then the second is Hge, which is based on the driectx of an open source 2D game engine, but also provides a lower level of functionality. At its core, presumably, it provides frame-based logic and rendering callbacks that developers can implement for each frame. HGE also provides a tutorial that I find very bad, for beginners is absolutely misleading-the code in its tutorial is messy, feel like a new C + + handwritten code, a variety of global variables, all kinds of magic numbers, all kinds of random naming, readability and frame are poor. (probably also Hge's developer to ask for Jane, but I think this tutorial can do better.) )

At this time, I do a simple set of games, has simply designed the UI interface. So I use HGE to implement this set of interfaces.

I think Hge is disgusting. It's based on a per-frame callback (you can certainly modify the Hge kernel to get rid of this, but it will cause more trouble, because hge many functions are based on the frame callback mechanism.) So you can't draw in real time like you would with a canvas. So I realized in the game a set of message mechanism, the entire HGE framework running in another thread, the game data core thread through the message to notify the interface update, or get player action.

This is the design of their own, DirectX or DDraw changed to Hge, and later realized.

At the beginning of the time feel good, and then the code slightly on the scale, I feel very laborious. Because I am based on specific game features to encapsulate the Hge interface. After a few refactoring, the overall architecture is clear, but the coupling between the interface and the code is too great. Finally can achieve a certain interface function, but still too uncomfortable, so decided to give up the use of HGE. In this summary of their own ideas, if you want to use hge really develop a slightly on the scale of the game, what should be done, may also have a lot of incorrect places, welcome to correct.

1. Implementation page stack, control tree

I do not know how to define this name, let's call it the page stack and the control tree bar, in fact, similar to the Windows window System, the establishment of a tree-like structure of the control system. For each page, record a variety of states such as focus controls. And through the stack to maintain the hierarchical relationship between the pages. You can load a page from a configuration file or from a page script. For example, the protagonist in the Game property page, equipment page, etc., the framework is certain, the use of some of the picture resources and what is certain, should be written as a configuration file, read directly from the file.

2. Implement message routing on the basis of the page tree

The routing mechanism for messages must be implemented.

3. Create a resource manager and Configuration Manager

Specialized resource managers are used to load and unload various pictures, special effects, music resources. Similarly, the Configuration Manager manages the configuration of the entire hge.

4. Define the interface file format and use the interface file to generate specific images, while supporting the development of Interface Editor

If you use XML to define a specific interface, the Interface Editor generates XML.

In the case of 1,2,3,4, the specific game functional interface development. You should even 1,2,3,4 this part of the engine-independent, platform-independent middle tier, down to provide porting interface, with HGE to port. -then the entire game interface section above should be highly portable.

HGE GUI tool is a good thing, especially the hgeguiobject inside, want to use more. Say a point to pay attention to, the official online appearance did not give detailed description ...

The RECT member of the Hgeguiobject is the action-response scope of the control-not displayed. Let a control disable as long as the rect. Set (0,0,0,0) on the line. Note that sometimes the control does not respond to mouse actions inexplicably, or it may be caused by this conflict. This problem has let me break down for half a day ...

Sum up.

Hge completely open source, based on DirectX, features more basic. I think it's perfect for individuals to learn and develop small games, but if you want to do a little bit of the game, you have to design and encapsulate the entire UI scheduling mechanism (which I think is a lot of work) and then complete the relevant development tools.

The Ok,hge is over.

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.