Teach you how to develop a galgame (getting started with galgame engine development)

Source: Internet
Author: User

The first thing we need to explain is: software engineering knowledge, which is to make good use of the existing game engine to save time and effort.
For example, the Geely system is open-source and free, and it is also a good idea to build your own engine, so that you can fully enjoy the fun of DIY!
I recently reviewed man at work at Warcraft College! 2. I think this game is doing well forever, so I want to start a similar program.

Source code: http://download.csdn.net/source/353069

There are many galgame games, such as RPG and adv.
This article is based on the ADV text type. In general, the development of the game with VC ++ and DX (DirectX) is relatively invincible
The master is good at. NET and. netframework programming and development efficiency is high. It may take several months for you to use VC ++ within a few days.

This article uses the language VB.net, which is simple to learn. Compared with VB6, it not only inherits the advantages of VB6, but also can take full advantage of. netframework. Of course, C # can also be used.

Note:
Hands-on, but not anyone who doesn't have any foundation
At least:
VB6, VB.net, or C # programming, allows you to develop a form program.
In addition, Visual Studio 2005 or 2008 must master object-oriented programming.

 

The master knows that it takes time to understand and use object-oriented programming. When beginners are young, they always hope to "advance by leaps and bounds ". In fact, there have not been several years of programming practices,

It is difficult to have a certain level.

 

. Netframework now has two architectures for you to use: Previous winform and later than 3.0 WPF
This article uses winform as the source code, takes care of everyone, and explains more advantages of WPF.

 

Ding Jie Niu, to see how the Masters implement one element

Audio Playback implementation
The only thing you can do is background music. This is simple. The my. Computer. Audio. Play method can complete the task. For the source code, see mainform. VB.
But first, make sure that the file exists. Use the file. exists method.
If file. exists ("music/bgm02b.wav") then
My. Computer. Audio. Play ("music/bgm02b.wav", audioplaymode. backgroundloop)
End if
This can also be used in the music or on-demand music module in the main menu.

 

More powerful WPF:In general, in addition to background music and voice, many do not use WAV format, because this file is very large. In addition to playing sound

The proportion is also growing. For example, SD games have 20 GB, most of which are animations.
WPF provides the mediaelement control, which can be used to complete the above requirements without having to use dx. When playing music, set it to invisible (don't tell me you won't) and play multiple

Multiple mediaelement controls for music and voice
The only drawback is that the mediaelement control does not support resource packaging, which is both an advantage and a disadvantage (??? Why? Please continue)

 

Image Display implementation:
First, we will introduce the concept of image cutting.
We know that photoshop has layers. You can combine the background and characters, and change the background as needed ..
In the weather forecast, the host explained the weather to the big screen behind him. Many people ask the masters where to buy such screens?
In fact, there is only a normal cloth behind the host. It is synthesized in real time using a color pair or a Color Key.

To put it bluntly, you just need to set a color to transparent to display things behind the host. For example, you can use a blue cloth behind the host and use a blue ghost or a large screen animation (for the moment

Let me call this) instant Synthesis
If you have used VC ++ for development, you will know that this technology is implemented: Black is set to transparent, using an exclusive or XOR operation.
In. NET development, this is all very simple. The master uses PNG format images. PNG inherits the transparent images of GIF, as long as the transparent images are produced in Photoshop.

It is easy to implement in the program
There is still a layer problem in VC ++ development, that is, what is first painted and then painted, but also solved by sorting algorithms.

There are still two buffering problems in the image display. You can try to draw one by one on the screen and then clear the screen, and you will find that it is obviously blinking.
Master usage: For the source code, see collage. VB.
Screensurface is the background image.
Dim screensurface as image = choosepicture ()
Surface = graphics. fromimage (screensurface)
Surface. drawimageunscaledandclipped and surface. drawstring
Finally, use the image control screen. Image = screensurface or graphics. drawimageunscaledandclipped to display the surface.
There is no obvious blinking problem.

More powerful WPF:

Generally, 2 dgalgame has low requirements on graphics cards, and many of them depend on CPU processing. The terminology is that they can only be simulated or computed by software and cannot be accelerated by hardware.
Winform uses the GDI + technology to accelerate the graphics card hardware. Development with DX can certainly make full use of the video card hardware acceleration capabilities, but the development is complex
WPF can accelerate the graphics card hardware, and the development is very simple. In particular, some animation effects can be easily produced using Microsoft's Microsoft Expression blend software, just like flash.

 

About text reading and resource Packaging
Used by the master. . Net resource file. To put it bluntly, you need to operate Visual Studio.
Resources in the program can be directly used by my. Resources
We recommend that you use databases such as acess and sqllite to implement text.

 

Source code: Structure of the http://download.csdn.net/source/353069 used:
Use Controls to modularize the program. The music and map modules are developed for the corresponding game menus, as well as specific plots.

More powerful WPF:
As a matter of fact, we know after playing galgame:
Click New Game <-> to enter the Map <-> plot
Click CG browsing <-> to go to CG browsing <-> View CG
Similar to the webpage homepage <-> entering the Category <-> View the article
WPF uses a method called page to completely implement the Web browsing mode. It is simpler and more practical to modularize programs than controls

Some tips for specific modules will not be mentioned. For example, the changing shining points on a map are the use of timer controls and multiple images, which can be viewed in the source code.

 

Invincible in WPF

WPF can achieve network. As mentioned earlier, the mediaelement control does not support resource packaging. In fact, for online games, resources can be placed on servers!
In this way, players only need to be able to access the Internet to play this game.
All those who have worked on project development know that since 1995, software development has been divided into two main camps: B/S and C/S, which are general applications or IE browsers.
Using WPF, the master can develop only one software, and finally only need to write a shell to publish B/S and C/S at the same time. This advantage is easy to publish online games based on IE browsers, this is not implemented by any other development platform

The only drawback is that the client needs to install. netframework3.0, which means only XP or an updated operating system is supported.

 

For details, see master development.English teaching software developed by. Net WPFAs for how to operate the database (read text ),

In short, software development is fun and challenging. I believe everyone can develop their own galgame.

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.