xywh Game Engine Project [Ver 1.1 Release, Ver 1.2 Developing]

User projects written in or related to FreeBASIC.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

xywh Game Engine Project [Ver 1.1 Release, Ver 1.2 Developing]

Postby xywhsoft » Dec 28, 2020 9:55

xywh Game Engine

    Open source: The source code is hosted on GitHub, and the project is active. Work with me to improve it.
    Free for commercial use: The engine itself uses public domain authorization, which can be used and modified at will.
    Simple: Very easy to use, with a high degree of packaging, and you can quickly start developing games.
    Complete functions: graphics rendering, text rendering, sound playback, network communication, graphics UI, file package (under development).
    Rich examples: dozens of tutorial examples with a lot of annotations; a complete game source code; still being added.
    Excellent performance: Compared with many similar 2D engines, more tiles can be rendered in the same time (2-50 times), thanks to the performance of FBGFX.
    True 2D: Use pixels as coordinates instead of coordinates converted from 3D, saving the trouble of coordinate calculation.
    Unicode and ANSI: Support ANSI, GB2312, Unicode encoding. This part is still being improved and will be fully supported soon.

    Graphics rendering: points, lines, rectangles, circles, etc.
    Image rendering: Support BMP, PNG, GIF, JPG, TAG, XGI, etc.
    Text rendering: support typesetting, support ttf, xrf, GDI, etc.
    GDI interaction: support the creation of GDI layers, and use GDI and GDIPlus to draw images (low performance).
    Device input: support keyboard, mouse, joystick.
    Network: Based on IOCP technology, it can reach tens of thousands of concurrent, easy-to-use TCP Server, TCP Client, and UDP objects.
    GUI: it has a complete typesetting system. With common controls.
    File package system: Compress multiple files into a file package, support loading files directly from the file package (under development).
    Scene system: greatly reduce the difficulty of game development, specific functions can refer to examples.
    Other functions: coordinate system adjustment, view adjustment, screenshots, file reading and writing, etc.

xywh Game Engine is developed using FreeBasic based on the FBGFX library. The audio function is implemented using the BASS library. I pay much attention to performance and file size. This aspect has been well controlled. It is expected that after all functions are completed, the file size can be controlled before compression. Within 500KB.

Small means less coupling, fewer errors, and faster speed.



Version 1.1 has been released, and my focus will be on version 1.2. The milestones for this version are to implement both ANSI and Unicode APIs, the core part will be encoded in Unicode, and the project will be completely refactored to use more scientific management methods and fix hidden bugs. All in all, 1.2 should be a very stable version, and I expect to work on it for 7 days.



Update:

2021/01/11 (Ver 1.1 Release)
xui add window user interface element.
New xui usage examples.
IME input method mechanism adjustment.
fixel bugs.

2021/01/08 (Ver1.1 Release Candidate)
xui add LineEdit user interface element.
Text module add GetTextWidth, GetTextRect, WidthToPos functions.
add ClipBoard module.
add IME interface.
add xStringBuffer class.
Text module functions add txtlen param.
del lzma sdk (Temporarily not used)

2021/01/05
xui add ListBox user interface element
xui ScrollView event change
xui export function
ScrollView adds constructor
ScrollBar with triangle icon
fixel bugs

2020/12/31
xui add Label user interface element
xui add Image user interface element
xui add Frame user interface element
xui add ScrollBar user interface element
xui add ScrollView user interface element
Image property of element base class renamed to DrawBuffer
x and y parameters passed when creating elements will be used for layout offset
DrawBackStyle and DrawBackStyle added xui_ prefix
xui add OnSize event

2020/12/30 (Ver1.1 developing):
xui naming changes:
Back, which represents the background, is modified to Style
Caption, which represents the title, is modified to Text
new GetFontSize function is added to get the font height
DrawBackStyle and DrawBackStyle_Text are exported to draw the background of the control
Increased responsiveness of game messages, especially in low FPS states

2020/12/29:
Update LZMA SDK to 19.0
Added for all projects Build.bat For people who don't use fbedit to compile
Parameter sequence adjustment of shape and surface Libraries
Xtank add starter, map editor, module editor
Other minor adjustments and bug fixes

2020/12/28:
Fixed a serious bug that caused the loading of xgi format pictures and ttf font files to fail.
Added tank battle game code. This game is currently complete, and more functions will be developed in the future.
Added the xui.FreeChilds function, which can directly release the UI elements of the current scene.
Other BUG fixes and adjustments.

2020/12/27:
The scene system BUG is fixed, and the new scene switching logic is used.
The GUI system is bound to the scene. After the scene is switched, the GUI state will be saved, and different scenes have different root elements.
Added two scene-related examples.
Other BUG fixes and adjustments.



Author's words:

A person's energy is limited. At first, I gave up SDL and a lot of 2D engines and decided to develop it myself. I set out a long development plan for myself. Now I have realized most of it.
Although 2D is lagging behind the times, obviously as an independent developer, it is very rare to be able to control 2D. 3D requires a lot of energy for mathematical calculations. I don't have that much energy, so I only do 2D.
The open source code hopes that this library can be passed on, and that some friends can maintain this library together with me. It still has many features to add, and my development plan has not come to an end.
And the experience of game development tells me that the engine can never keep up with the needs of the game, so I developed a lot of extension interfaces to make the engine as customizable as possible, but it still needs to be constantly updated.

Chinese is my native language. If I want to read and write English, I need to rely on a translator. Therefore, I am not sure if anyone can understand the above words. I try to use English as much as possible for the comments. However, it also increased my workload. Some things may require you to use a translator to translate them into English for reading.

If you have any questions, please email me: xywhsoft@qq.com



Source code:
https://github.com/CN-xLeaves/XGE

Stable version Development package download:
https://github.com/CN-xLeaves/XGE/releases/tag/1.1

Development Version:
There is currently no publicly tested development version, You can find the latest source code and development resources here, it may be unstable.
https://github.com/CN-xLeaves/XGE/tree/master/release



Screenshots related to the features of the latest version will be released here, screenshots of earlier versions can be viewed in the third reply.

Image

Image

Image

Image

Image

Image

Image
Last edited by xywhsoft on Jan 11, 2021 8:25, edited 11 times in total.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 28, 2020 10:05

How to start:

https://github.com/CN-xLeaves/XGE/tree/ ... /freebasic
There are many examples, each with complete notes, they will help you get started quickly, it is strongly recommended to read all the examples again.

https://github.com/CN-xLeaves/XGE/tree/ ... ject/xTank
This is a complete game example. It has all the elements that a game should have. By reading this code, you can also accumulate experience, but this code has fewer comments and needs to be studied.

https://github.com/CN-xLeaves/XGE/tree/ ... eBASIC/OOP
Do you want to start developing the game? This is a development template. Use FbEdit to copy a copy and start working immediately.



Compile XGE:

I use FbEdit as my own development tool. There are FbEdit project files in the source code folder, which can be compiled directly. If you don’t use FbEdit, it’s also very simple. I am used to using only one BAS file and only need to compile this file ( xge_oop.bas).



Development Plan:

The file package system is currently under development, and it will meet with you soon.
API standardization is also very important, which means the greatest degree of downward compatibility, I will complete this task in the near future.
The GUI system is the focus of development, especially TextBox, which is significantly more difficult than other interface elements, but I have implemented one before, and I am now looking for a better way to implement it.
In addition, I need more examples, especially for complete games. One tank battle is not enough. For example, a simple online game is a cool idea, but the priority of this task is lower than the above.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 28, 2020 10:08

I will post some examples here for those who don’t know XGE to check how it works:



Hello World:

Code: Select all

' include XGE header file
#LibPath "..\..\..\library"
#Include "..\..\..\include\xge.bi"



' Init xywh Game Engine
xge.Init(800, 600, XGE_INIT_WINDOW Or XGE_INIT_ALPHA, XGE_INIT_ALL, "XGE - Hello World")

' load font
xge.Text.LoadFont("..\..\..\res\font\xrf\simsun_16px_ucs2.xrf", 0)
xge.Text.LoadFont("c:\windows\fonts\simsun.ttc", 0)

' change font size
xge.Text.SetFontSize(2, 32)

' draw text
xge.Text.DrawRectA(NULL, 0, 100, 800, 200, !"Hello World\n你好,世界\n\nxywh Game Engine\nUse freebasic to develop", &HFF00, 1, 0, XGE_ALIGN_CENTER Or XGE_ALIGN_MIDDLE, 1, 6)
xge.Text.DrawRectA(NULL, 0, 300, 800, 200, !"Hello World\n你好,世界\n\nxywh Game Engine\nUse freebasic to develop", &HFF00, 2, 0, XGE_ALIGN_CENTER Or XGE_ALIGN_MIDDLE, 1, 6)

' wait 5s
Sleep 5000

' release menory by XGE
xge.Unit()




Draw Image:

Code: Select all

' include XGE header file
#LibPath "..\..\..\library"
#Include "..\..\..\include\xge.bi"



' Init xywh Game Engine
xge.Init(640, 480, XGE_INIT_WINDOW Or XGE_INIT_ALPHA, XGE_INIT_ALL, "XGE - Draw Image")

' load image
' XGE supports loading common file formats
' PNG, JPG, GIF, BMP, TGA and XGI
' XGI format is a compressed image format dedicated to XGE
' It has extremely fast loading speed and reasonable compression ratio (LZ4 compression)
Dim img As xge.Surface Ptr = New xge.Surface("..\..\..\res\back.xgi", 0)

' draw image
img->Draw(0,0)

' free memory it's a good habit
Delete img

' wait 5s
Sleep 5000

' release menory by XGE
xge.Unit()




Play Sound:

Code: Select all

' include XGE header file
#LibPath "..\..\..\library"
#Include "..\..\..\include\xge.bi"



' Init xywh Game Engine
xge.Init(640, 480, XGE_INIT_WINDOW, XGE_INIT_ALL, "XGE - Play Sound")

' load font
xge.Text.LoadFont("..\..\..\res\font\xrf\simsun_16px_ucs2.xrf", 0)

' draw text
xge.Text.DrawRectA(NULL, 0, 0, 640, 480, "Press ESC to exit", &HFF00)

' load music
Dim bgm As xge.Sound Ptr = New xge.Sound(XGE_SOUND_STREAM, 0, "..\..\..\res\bgm.mp3")

' play music
bgm->Play()

' Wait, press ESC to exit
Do
   Sleep(15)
Loop Until xge.xInput.KeyStatus(SC_ESCAPE)

' free memory it's a good habit
Delete bgm

' release menory by XGE
xge.Unit()




Scene:

Code: Select all

' include XGE header file
#LibPath "..\..\..\library"
#Include "..\..\..\include\xge.bi"



' Scene is an important function of XGE
' With it, you can deal with different scenes in the game more easily
' You don't have to write all the code together or deal with them extra
' The following function is the standard scene processing template
' It only does one thing, that is, it exits the game when the close button in the window is pressed
' So you'll see a black window, but you don't have to exit regularly, or write code and press the key to exit



' Scene function
Function MainScene(msg As Integer, param As Integer, eve As XGE_EVENT Ptr) As Integer
   Select Case msg
      Case XGE_MSG_FRAME            ' frame Logic processing
         
      Case XGE_MSG_DRAW            ' draw
         
      Case XGE_MSG_MOUSE_MOVE         ' mouse move
         
      Case XGE_MSG_MOUSE_DOWN         ' mouse down
         
      Case XGE_MSG_MOUSE_UP         ' mouse up
         
      Case XGE_MSG_MOUSE_CLICK      ' mouse click
         
      Case XGE_MSG_MOUSE_DCLICK      ' mouse double click
         
      Case XGE_MSG_MOUSE_WHELL      ' mouse whell
         
      Case XGE_MSG_KEY_DOWN         ' keyboard down
         
      Case XGE_MSG_KEY_UP            ' keyboard up
         
      Case XGE_MSG_KEY_REPEAT         ' keyboard hold
         
      Case XGE_MSG_GOTFOCUS         ' got focus
         
      Case XGE_MSG_LOSTFOCUS         ' lost focus
         
      Case XGE_MSG_MOUSE_ENTER      ' mouse enter
         
      Case XGE_MSG_MOUSE_EXIT         ' mouse leave
         
      Case XGE_MSG_LOADRES         ' load resources
         
      Case XGE_MSG_FREERES         ' unload resources
         
      Case XGE_MSG_CLOSE            ' window closing
         Return -1
   End Select
End Function



' Init xywh Game Engine
xge.Init(800, 600, XGE_INIT_WINDOW Or XGE_INIT_ALPHA, XGE_INIT_ALL, "XGE - Scene")

' Start a scene (40fps)
xge.Scene.Start(@MainScene, 40)

' release menory by XGE
xge.Unit()




XUI Layout:

Code: Select all

' include XGE header file
#LibPath "..\..\..\library"
#Include "..\..\..\include\xge.bi"



' Scene function
Function MainScene(msg As Integer, param As Integer, eve As XGE_EVENT Ptr) As Integer
   Static As xui.Element Ptr ui
   Static As xui.Element Ptr LeftLayout, CenterLayout, RightLayout
   Static As xui.Element Ptr TopLayout, MiddleLayout, BottomLayout
   Static As xui.Button Ptr Btn1, Btn2, Btn3
   Static As xge.Surface Ptr backimg
   Select Case msg
      Case XGE_MSG_FRAME            ' frame Logic processing
         
      Case XGE_MSG_DRAW            ' draw
         xge.Clear()
         backimg->Draw(0,0)
         ui->Draw(NULL)
      Case XGE_MSG_MOUSE_MOVE         ' mouse move
         
      Case XGE_MSG_MOUSE_DOWN         ' mouse down
         
      Case XGE_MSG_MOUSE_UP         ' mouse up
         
      Case XGE_MSG_MOUSE_CLICK      ' mouse click
         
      Case XGE_MSG_MOUSE_DCLICK      ' mouse double click
         
      Case XGE_MSG_MOUSE_WHELL      ' mouse whell
         
      Case XGE_MSG_KEY_DOWN         ' keyboard down
         
      Case XGE_MSG_KEY_UP            ' keyboard up
         
      Case XGE_MSG_KEY_REPEAT         ' keyboard hold
         
      Case XGE_MSG_GOTFOCUS         ' got focus
         
      Case XGE_MSG_LOSTFOCUS         ' lost focus
         
      Case XGE_MSG_MOUSE_ENTER      ' mouse enter
         
      Case XGE_MSG_MOUSE_EXIT         ' mouse leave
         
      Case XGE_MSG_LOADRES         ' load resources
         xge.Text.LoadFont("..\..\..\res\font\xrf\simsun_16px_ucs2.xrf", 0)
         
         ' through the study of the first two examples, we know that it is easy to make a layout by using horizontal and vertical matching
         ui = xui.GetRootElement()
         ui->LayoutMode = XUI_LAYOUT_L2R
         LeftLayout = xui.CreateElement(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 1, XUI_LAYOUT_COORD, "LeftLayout")
         CenterLayout = xui.CreateElement(XUI_LAYOUT_RULER_PIXEL, 0, 0, 160, 480, XUI_LAYOUT_T2B, "CenterLayout")
         RightLayout = xui.CreateElement(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 1, XUI_LAYOUT_COORD, "RightLayout")
         TopLayout = xui.CreateElement(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 7, XUI_LAYOUT_COORD, "TopLayout")
         MiddleLayout = xui.CreateElement(XUI_LAYOUT_RULER_PIXEL, 0, 0, 160, 160, XUI_LAYOUT_T2B, "MiddleLayout")
         BottomLayout = xui.CreateElement(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 2, XUI_LAYOUT_COORD, "BottomLayout")
         ui->Childs.AddElement(LeftLayout)
         ui->Childs.AddElement(CenterLayout)
         ui->Childs.AddElement(RightLayout)
         CenterLayout->Childs.AddElement(TopLayout)
         CenterLayout->Childs.AddElement(MiddleLayout)
         CenterLayout->Childs.AddElement(BottomLayout)
         
         ' fill other elements into these layouts, and we can form our user interface
         Btn1   = xui.CreateButton(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 1, !"开始游戏\n(New Game)")
         Btn2   = xui.CreateButton(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 1, !"载入存档\n(Load)")
         Btn3   = xui.CreateButton(XUI_LAYOUT_RULER_RATIO, 0, 0, 1, 1, !"退出游戏\n(Exit)")
         
         ' add some spaceing to the buttons
         Btn2->Layout.RectBox.TopOffset = 20
         Btn3->Layout.RectBox.TopOffset = 20
         
         ' add three buttons to the middle layout
         MiddleLayout->Childs.AddElement(Btn1)
         MiddleLayout->Childs.AddElement(Btn2)
         MiddleLayout->Childs.AddElement(Btn3)
         
         ' apply layout
         xui.LayoutApply()
         
         ' we can also load a background image to make the image less empty
         backimg = New xge.Surface("..\..\..\res\back.bmp", 0)
         
      Case XGE_MSG_FREERES         ' unload resources
         xge.Text.RemoveFont(1)
      Case XGE_MSG_CLOSE            ' window closing
         Return -1
   End Select
End Function



xge.Init(640, 480, XGE_INIT_WINDOW Or XGE_INIT_ALPHA, XGE_INIT_ALL, "XGE - XUI Layout")
xge.Scene.Start(@MainScene, 40)
xge.Unit()
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 28, 2020 10:10

I need to reserve some places to put pictures, but I haven't found a good picture upload server. If anyone knows, you can tell me, thank you friends.

Image

Image

Image

Image

Image

Image

Image

Image
jj2007
Posts: 1792
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: xywh Game Engine Project

Postby jj2007 » Dec 28, 2020 11:22

xywhsoft wrote:Bin, resources and examples: https://github.com/CN-xLeaves/XGE/tree/master/release
There are many folders with Chinese names, but no indication where the binaries are.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 28, 2020 11:27

jj2007 wrote:
xywhsoft wrote:Bin, resources and examples: https://github.com/CN-xLeaves/XGE/tree/master/release
There are many folders with Chinese names, but no indication where the binaries are.


release/examples/freebasic/bin
examples bin

release/library
engine dll

release/include
engine sdk

release/project/xTank/release
tank game bin

release/tools
tools bin
jj2007
Posts: 1792
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: xywh Game Engine Project

Postby jj2007 » Dec 28, 2020 13:21

Thanks. Can you explain how the folder structure should look like, assuming that fbc.exe sits at C:\Programming\FreeBasic\fbc.exe? Where should HelloWorld.bas be located to make this compile?

Code: Select all

#Include "..\..\..\include\xge.bi"
' load font
xge.Text.LoadFont("..\..\..\res\font\xrf\simsun_16px_ucs2.xrf", 0)
IMHO an installer would be a good idea. Or at least a zip file with a clear structure and all the necessary stuff but not more.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 28, 2020 13:40

jj2007 wrote:Thanks. Can you explain how the folder structure should look like, assuming that fbc.exe sits at C:\Programming\FreeBasic\fbc.exe? Where should HelloWorld.bas be located to make this compile?

Code: Select all

#Include "..\..\..\include\xge.bi"
' load font
xge.Text.LoadFont("..\..\..\res\font\xrf\simsun_16px_ucs2.xrf", 0)
IMHO an installer would be a good idea. Or at least a zip file with a clear structure and all the necessary stuff but not more.


so easy.

Code: Select all

"c:\Program Files\freebasic\fbc.exe" -s gui helloworld.bas helloworld.rc


Just like ordinary programs, because there is only one bas file and one rc file, if you don't need the program icon and version information, you can not compile the rc file.



Actually, the engine itself is very small, with only two DLLs and a header file, and most of the contents are various examples, resources and tools. XGE is a relatively complete engine, and these resources are indispensable. in order to reduce the difficulty, I actually prepared a template, which is placed in the folder of release/template/freebasic/OOP. you can compile it like this, assuming that the location of fbc is clear.

Code: Select all

fbc.exe -s gui game.bas game.rc


Then copy the file to the release folder to work.



Game development has high requirements on the organization ability of the project, so I must arrange the structure of the folder as reasonably as possible. You can see this in the templet directory, which will enable you to make a game soon after you are familiar with it.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 28, 2020 13:55

Just remember that the XGE development package, including the XGE source code itself, is all configured. You only need [fbc.exe -s gui *. bas *. rc] to compile any code in the XGE development package. If you adjust the directory structure by yourself, you only need to modify the corresponding #include code.



In the case of directory structure, release always means that the compiled binary files and all dependent files are stored here, which is equivalent to packaging this directory separately and sending it to others, and it can work independently. Res directory always stores resources related to programs, pictures, sounds, fonts, etc.



In the source code, the sdk folder always stores modules that can work independently and codes that are not affected by other modules, while the APP folder represents your code and the specific implementation code of the application you developed. Under it, class represents the classes and objects in the game; Scene stands for independent scenes, while global stands for global definition and codes except scenes and game objects.



In fact, the classification of most games during development is more complicated than this, and this classification is the simplest classification method on the premise of ensuring clear game structure.



By understanding this structure, reading the code and compiling examples until you develop your own game, it will be easy.
jj2007
Posts: 1792
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: xywh Game Engine Project

Postby jj2007 » Dec 29, 2020 10:59

I went to https://github.com/CN-xLeaves/XGE/releases/tag/1.0, downloaded release_1.0_20201229.7z and extracted all files to FreeBasic\XGE (where FreeBasic is the folder where fbc.exe is located).

FreeBasic\XGE\examples\freebasic\000.Hello World\Game.bas looks fine, so I launched FreeBasic\XGE\examples\freebasic\000.Hello World\Build.bat: error because fbc.exe was not found (not everybody uses the PATH variable...)

So I corrected build.bat and inserted FreeBasic\fbc.exe -s gui "Game.bas" "Game.rc" -x "Hello World.exe" and guess what? It compiles without errors!

However, if I move the whole folder e.g. to FreeBasic\000.Hello World, I get Game.bas(3) error 23: File not found, "..\..\..\include\xge.bi" in '#Include "..\..\..\include\xge.bi"'

Which is not surprising, of course. Users should be told that project folders must be at the level FreeBasic\XGE\examples\freebasic\MyProject, otherwise it will not work.

However, the exe complains that xge.dll is "not present in the computer". The exe will work only from the folder FreeBasic\XGE\examples\freebasic\bin\

This setup is rather idiosyncratic. You should explain it with simple and clear words in a prominent place, i.e. on the download page, otherwise potential users will run away.
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 29, 2020 12:07

jj2007 wrote:I went to https://github.com/CN-xLeaves/XGE/releases/tag/1.0, downloaded release_1.0_20201229.7z and extracted all files to FreeBasic\XGE (where FreeBasic is the folder where fbc.exe is located).

FreeBasic\XGE\examples\freebasic\000.Hello World\Game.bas looks fine, so I launched FreeBasic\XGE\examples\freebasic\000.Hello World\Build.bat: error because fbc.exe was not found (not everybody uses the PATH variable...)

So I corrected build.bat and inserted FreeBasic\fbc.exe -s gui "Game.bas" "Game.rc" -x "Hello World.exe" and guess what? It compiles without errors!

However, if I move the whole folder e.g. to FreeBasic\000.Hello World, I get Game.bas(3) error 23: File not found, "..\..\..\include\xge.bi" in '#Include "..\..\..\include\xge.bi"'

Which is not surprising, of course. Users should be told that project folders must be at the level FreeBasic\XGE\examples\freebasic\MyProject, otherwise it will not work.

However, the exe complains that xge.dll is "not present in the computer". The exe will work only from the folder FreeBasic\XGE\examples\freebasic\bin\

This setup is rather idiosyncratic. You should explain it with simple and clear words in a prominent place, i.e. on the download page, otherwise potential users will run away.


Thank you for your suggestion. I'll add instructions. Tomorrow I'll fill in the instructions of readme and release on github.

I have to set the directory like this, because there are more than 40 examples, and there are also C++ contents in previous versions. I need to match C++ with examples, which have been temporarily removed, but will be improved soon.

Only the engineering environment under the templet directory is completely independent. I said in my post that when you want to start developing, you should copy this, and you can compile and run it successfully anywhere without worrying about the relative path depending on the content.

A huge problem is language. It is difficult to express some words by relying on translators, and it is also a huge workload to compile guidance documents, especially for me.
jj2007
Posts: 1792
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: xywh Game Engine Project

Postby jj2007 » Dec 29, 2020 12:24

xywhsoft wrote:Only the engineering environment under the templet directory is completely independent. I said in my post that when you want to start developing, you should copy this, and you can compile and run it successfully anywhere without worrying about the relative path depending on the content.
Try to be precise: neither "engineering environment" nor "my post" are defined. Any compiler would bark at you.

I doubt that an exe will work from any folder if the two DLLs are not present in the folder itself.
One old fashioned way to achieve "it works anywhere" is to have a hardcoded path from the root, such as \XGE\bin\Bass.dll
Another option is to store the path in the registry.
A huge problem is language. It is difficult to express some words by relying on translators, and it is also a huge workload to compile guidance documents, especially for me.
You have a nice project here, but translation is obviously a big issue. Try DeepL, it is often much better than G translate. A little test:
只要记住,XGE开发包,包括XGE源代码本身,都已经配置好了。你只需要[fbc.exe -s gui *. bas *. rc]就可以编译XGE开发包中的任何代码。如果自己调整目录结构,只需要修改相应的#include代码即可。

在目录结构上,release目录总是指将编译后的二进制文件和所有的依赖文件存放在这里,相当于将这个目录单独打包发给别人,可以独立工作。Res目录总是存储与程序、图片、声音、字体等相关的资源。

在源代码中,sdk文件夹下总是存放着可以独立工作的模块和不受其他模块影响的代码,而APP文件夹下则代表着你的代码和你开发的应用程序的具体实现代码。在它下面,class代表游戏中的类和对象,Scene代表独立的场景,而global则代表除场景和游戏对象外的全局定义和代码。

其实,大多数游戏在开发过程中的分类都比这个复杂,在保证游戏结构清晰的前提下,这种分类是最简单的分类方法。

通过了解这种结构,阅读代码和编译实例,直到开发出自己的游戏,就会很容易。
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project

Postby xywhsoft » Dec 30, 2020 0:02

jj2007 wrote:
xywhsoft wrote:Only the engineering environment under the templet directory is completely independent. I said in my post that when you want to start developing, you should copy this, and you can compile and run it successfully anywhere without worrying about the relative path depending on the content.
Try to be precise: neither "engineering environment" nor "my post" are defined. Any compiler would bark at you.

I doubt that an exe will work from any folder if the two DLLs are not present in the folder itself.
One old fashioned way to achieve "it works anywhere" is to have a hardcoded path from the root, such as \XGE\bin\Bass.dll
Another option is to store the path in the registry.
A huge problem is language. It is difficult to express some words by relying on translators, and it is also a huge workload to compile guidance documents, especially for me.
You have a nice project here, but translation is obviously a big issue. Try DeepL, it is often much better than G translate. A little test:
只要记住,XGE开发包,包括XGE源代码本身,都已经配置好了。你只需要[fbc.exe -s gui *. bas *. rc]就可以编译XGE开发包中的任何代码。如果自己调整目录结构,只需要修改相应的#include代码即可。

在目录结构上,release目录总是指将编译后的二进制文件和所有的依赖文件存放在这里,相当于将这个目录单独打包发给别人,可以独立工作。Res目录总是存储与程序、图片、声音、字体等相关的资源。

在源代码中,sdk文件夹下总是存放着可以独立工作的模块和不受其他模块影响的代码,而APP文件夹下则代表着你的代码和你开发的应用程序的具体实现代码。在它下面,class代表游戏中的类和对象,Scene代表独立的场景,而global则代表除场景和游戏对象外的全局定义和代码。

其实,大多数游戏在开发过程中的分类都比这个复杂,在保证游戏结构清晰的前提下,这种分类是最简单的分类方法。

通过了解这种结构,阅读代码和编译实例,直到开发出自己的游戏,就会很容易。


This translator has a very accurate understanding of the meaning and I will use it in my subsequent communications.

thankyou
xywhsoft
Posts: 68
Joined: Aug 28, 2009 6:28
Contact:

Re: xywh Game Engine Project [Ver 1.1 Release, Ver 1.2 Developing]

Postby xywhsoft » Jan 11, 2021 8:44

Version 1.1 has been released, so let's talk about XGE's future development plan. I have mentioned some milestones in the xRpgMaker development log.

The next version 1.2, I hope XGE can be more internationalized, so unicode support is a priority. Currently XGE can support unicode very well, but some interfaces are only ANSI versions, and the core is based on ANSI, while version 1.2 will build the kernel in unicode encoding.

On top of that, I need to fully review my code from time to time to make sure no hidden fatal bugs are created, so every few versions, the project must be refactored and I will rewrite the code boringly, checking where the code can be optimized and, most importantly, for logic errors.

Such versions will exist as long-term maintenance releases, such as the upcoming 1.2 release, and the future planned 1.6 release.

Besides continuing to enrich XGE, I have some other goals. xRpgMaker is one, and I think a game engine similar to Love2D would be very interesting, and I would like to make such an attempt, which would be a completely new product, but it is still in the planning stage.

Right now XGE can only run in Win32 environment, support for x64 is also eager, as well as support for Linux systems, and even Android (yes, support for Android is my key strategic goal), but that means I have to remove some modules that can't cross platforms, and many features will have to be rewritten, the time needed may be measured in years, I think, that's the most important task for me in 2021.

fbgfx is simple, but getting less and less applicable, and I will be forced to use OpelGL or vulkan, but that might not be a bad thing, except that the engine might get heavier as a result, but I always tend to use simple and efficient methods to solve problems, and hopefully when XGE version 3.0 is released, the DLL size will still be under 1MB.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 18 guests