BGE is rather a bad game engine as is, but a lot of things that it lacks (like GUI or network support) can be added using python scripts. Learning to code properly in BGE is suicide, you won't find almost any example of good programming in BGE games or tutorials. Actually, devs that use BGE usually aren't programmers and the only this they touch are logic bricks. In Journey Through Izildia, and actually all games I made using BGE, are coded using with as less logic briks as possible. The reason is simple. To make 200 objects do something with logic bricks you need to add 200 logic bricks, one on each object. If now you want to modify something on that function, you'll need to modify 200 logic bricks. That, with Python, it's done in 2 lines of code.
In the first release all code was inside the .Blend file. And it was a mess. There was almost no OOP and all quests where put in a huge file of spaghetti code called journey.py. The main.py contained all the game logic and interface events (which were handled poorly) only helped by another file called utils.py which contained everything. In the new version only the main and some other files very specific to that .Blend are inside the .Blend file, all the other code is outside on the data folder. Inside that folder there are 3 sub folders containing python scripts, each one with a __init__.py for proper initialization.
Core: A package to extend BGE functionality. Includes functionality to play sound, change textures and handle GUI elements such as buttons, cursors or the game window. It also includes standard classes like quests, dices, players, inventories, etc...
Script: This is were the game resides. The main loop of the game calls the control.py functions in order to do pretty much everything. This file also stores the player and the dice, which are standard objects of the core package. The game_gui.py and map.py files do what its name implies.
No comments:
Post a Comment