Showing posts with label overview engine. Show all posts
Showing posts with label overview engine. Show all posts

Friday, 21 June 2013

Completed Tower Defense Game Source code (GDX Engine ver 1.2.6)

Our new games on Play Store:
https://play.google.com/store/apps/developer?id=Best+free+games

please support us for download and give our games rating.

GDX document using ver 1.2.2 Engine à  1.2.5

Update: 1.2.6

Some of the features added in this version are:
• Integrate the A * algorithm
• Add InputEvent for game components
• Completed Tower Defense Game

View Game: 
Download:
Game made from ​​libgdx so i can play on PC! Jar file you can download here: https://docs.google.com/file/d/0B9TsWVI1UbkKMGlmRTBOcXdyT3c/edit?usp=sharing 
Then install the JRE and always play jar files (double-click)

This document overview of the main features of GDX Engine
Update: 1.2.4 
Create the ability to automatically load resource by class
AssetLoader.setAssetClass(Texture.class);
           Texture Texture1 = AssetLoader.load("data/1.png");
           Texture Texture2 = AssetLoader.load("data/2.png");
           Texture Texture3 = AssetLoader.load("data/3.png");
           // ...
For above example, you set the class of asset will load (Texture). Then you call the load method and pass the path to the asset. That's it, that engine will load up and asset returns true class for loading your textures. method setAssetClass should be called to determine the type of asset that you want to load first. After all textures loaded, you might want to load BitmapFont, you must set the BitmapFont class in setAssetClass method.

AssetLoader.setAssetClass(BitmapFont.class);
           BitmapFont font1 = AssetLoader.load("data/font1.fnt"); // ...
And the load is similar to the texture.

Additional features of the scene created using UIManager ui

Illustrations by Video i posted in gdengine.blogspot.com. UIManager will have a Main Menu for Scene and other ui components (Button, checkbox...) . If Main Menu ‘s visible, it will block another update of the scene and Gameplay go normal if you turn off the main menu.
Recommendation you should start creating UIManager by override the method setupUIManager (String) of Scene the class you are taking:
@ Override
          public void setupUIManager (String skinPath)
              {// create newuiManager and
              superskin.setupUIManager(skinPath);
             
/ / Next, create the UI component and add it to uiManager
              / / ...

The following example creates a button (Image and toggle button):

ImageButton iconButton = new ImageButton (style);

              Button buttonMulti = new TextButton("Hello!" skin, "toggle");

The ui component as Button, CheckBox ... is from the libgdx framework. You go to libgdx documentation to know how to create them. After ui already have, you can add it directly to uiManager:

uiManager.AddActor (iconButton);
/ / you're done, iconButton will
uiManager update and drawdone automatically

if you create the main menu of scene. For example, when you play Starcraft II, you press F10, it will drop the main menu and pause the game so that players can use the menu, adjust settings or restart the game ... you need a method getWindows () to get the main menu. After that, you can call add () of window to add the UI on the main menu of the scene
uiManager.getWindows().defaults().spaceBottom(10);
              uiManager.getWindows().row().fill().expandX();
              uiManager.getWindows().add(iconButton);
              uiManager.getWindows().add(buttonMulti);
              uiManager.getWindows().add(btnCloseMenu);
              uiManager.getWindows().add(imgToggleButton);
              uiManager.getWindows().row();

Menu of Libgdx using TableLayout, you read the libgdx documentation to learn more about TableLayout. I explain some method in above code:

defaults () indicates the default setting for a menu cell in theTableLayout
row() Creates a new line on the TableLayout
add () Add a ui the current cell in the current row of TableLayout. Then if you call add () again, the next ui will add to the next cell in the row.
At above example, I call the add () four times, so   
             
             
                  

TableLayout is currently with four column and then row () method is called, it cause a new table row is created. This row will of course also have four columns as the row above (Table layout)
Row second you can still call the add () to add ui normally. You do not need to worry about the size of the table, as long as you remember to call the method pack () it will automatically resize to fit your design.

                   UiManager.GetWindows (). Pack ();

You can use ChangeListener to control the behavior of the UI, for example:

btnShowMenu.
addListener(new ChangeListener ()

                     {@Override
                     public void changed (ChangeEvent event, Actor actor) {
                           uiManager.setMenuVisible(true);}
                     });
             
Button above, when clicked on will be referred to the changed method () of ChangeListener. It will be called the method setMenuVisible. of uiManager. Read the method name to make you guess how it works, right? It will show the Main Menu of the scene I mentioned above.


Create Tab Panel

If you used to create java swing app, you will see a menu tab. However GDX Engine is to make the game, not the app, so the original will not be any UI Tab Menu as such, i have coded the tab pane for the engine: 3
To use the tabbed panel, you need to declare it:

TabPane pane = new TabPane (2)

Parameter 2 is the number of tabs will be, here are 2 tab panels.
, then add ui to uiManager:

uiManager.addActor (pane);

Then you add tabs for TabPanel , and set the default active tab:

pane.addTab("Tab1",tab1, skin);
              pane.addTab("Tab2",tab2, skin);
              pane.setActiveTab (0)
In setActiveTab (int), index is 0 is the first tab, 1 is the second tab ...
And tab1, tab2 is TabContent, which is a interface ITabContent that you can use to create anonymous class instance:
ITabContent tab1 = new ITabContent()

                     {@Override
                     public void setContent (Table content)
                           {content.clear();
                           content.row (.) expand ();
                           content.add (label1);
                           content.pack
                     ();}

                     @ Override
                     public float getHeight ()
                           {return label1.getHeight
                     ();}

                     @ Override
                     public float getWidth ()
                           {return label1.getWidth
                     ();}};
             

Above code has two methods of taking the tab content size. Method setContent () to set the tabContent content. On his first try add label to TabContent. Of course how much you want to add UI to be as well. tabContent also use TableLayout.

Additional Action ActionManager management.

Action is an action of a game object after a certain time. Illustrations used in demo Action and ActionManager CatchDrop, automatically create new drop after 5 seconds.

Firstly, you need to have ActionManager, create it in your Scene classes:
ActionManager am = new ActionManager();
              services.AddService (am),

you add it to GameService, then update it in the update method of the scene:
                   am.Updates (gametime)

If you use the action, you get ActionManager from GameService, then add your Action:
@ Override
       public void initialize ()

              {ActionManager am = getGameServices (). getService(ActionManager.classes);
              / / create a sẽ Perform action after each 5 seconds
              BaseSimpleAction action = new BaseSimpleAction(false, 5f)
                    
                     {@Override
                     public void onActionPerformance()
                           {addItem(new Drop
                     ());}};
             
              am.addActionToDefault
       (action);}
It is recommended from the getService method initialize  method ()to avoid bug GameComponent. Action on using BaseSimpleAction It is extremely easy to use, as you can see, false passed to pause, pause that is false, action will be executed as soon as add on after 5s (2nd parameter in the constructor). If Pause is true, then there is no action after 100s happen ;)

After 5s,event onActionPerformance will be known when it will drop to add new one for DropCollection (above code is in class DropCollection):
                             @ Override
                     public void onActionPerformance(){
                           addItem(new Drop
                     ());}

Update: 1.2.3

 Supports automatic camera zoom and locate the tiled scene, watch video below illustrates this feature in the demo "Angry bird" Fix not display properly in game screen resolution different. Additional constants for some TiledScene, to set the parameters of the scene as the targeted size, world size, scale values ​​...
Using not be easier! You call the method setupCamera (); Scene Of class you are taking and that's it, the engine will do everything for you.
Sometimes the frame rate of the device (Width / Height) will be different than if you design the game, This common ratio is now 4:3 and 16:9. Default Engine will stretch to fit the screen. If you do not want that, you can use the method  keepGameAspectRatio () of the scene to keep the frame rate as you have designed. (When the engine will crop away some parts to fit on the screen)

Update: 1.2.2

 Additional PhysicsManager initialize and update all physical objects in your game, so you do not have to use that PhysicsScene can use any one scene, then create PhysicsManager and add PhysicsManager as a game component for that scene. A new interface is IPhysicsObject to identify a physical object in the game, so you are not forced to use PhysicsObject class that means it can use any class game component to implement IPhysicsObject interface, then it is possible to add to PhysicsManager or PhysicsScene.
demo source code "Angry Birds" has been revised to illustrate the use and PhysicsManager IPhysicsObject.
PhysicsManager Usage of similar PhysicsScene. You only need to change the method of PhysicsScene by method PhysicsManager object is
ok, For example, you add an object to physicsScene as follows:
Body body = addDynamicBoxObject (brick, object.width, object.height)
Similarly, now you add in PhysicsManager as follows:
Body body = physicManager.addDynamicBoxObject (brick, object.width, object.height);

(a brick
is physicsSprite or IPhysicsObject interface)
physic manager automatically update and render all your physicsObject, you just add the manager to the Scene of the physic engine, and the engine will take care of all of physicsObject update and draw for you!

For more details, the source code Demo "Angry Birds "I did and I got some comments there.

Thursday, 4 April 2013

Overview the website and where to start.


Welcome you to GdxEngine.blogspot.com, I hope you will receive many interests here.

About Libgdx framework

When i need a way to Develop games in mobile platforms like Android or iOS, i have seen the libgdx framework and i quickly find acquaintance with how it works. I think it similar to XNA Framework that i have enjoyed for a long time.

Libgdx framework is really useful because it is based on the study of game development cross-platform. That is your game when writing by Libgdx framework, it will be played on Desktop, Web, Android, iOS, and in the future can add other platform! When you code the game use Libgdx framework, you can develop game and debug code on the desktop, after the game completed, you can completely take the game to run on different platforms without or very least the need for modifing source. Libgdx framework optimize your game by design essential elements such as resource management is written in native code. Libgdx framework ’s documentation is great and their support forum quickly and enthusiastically. Libgdx framework has many game example, source code, and there are many commercial and non-commercial game has used Libgdx framework.

About Gdx Engine and website

This website contains  everything i Developed on libgdx. There is something i call it 'Gdx Engine': D. I have Developed the engine's structure nicely from it could be used in many game projects, varying in Genres and game logics. You can rest assured that the entire Gdx Engine are based on Libgdx framework completely, meaning that every features in Libgdx framework you can apply in Gdx Engine and even more easily.

Gdx Engine was born with the purpose of to help you manage your game source code as you write game use Libgdx framework. Of course you might not need to Gdx Engine but I believe the process of developing your game development process will be a lot easier if you use GDX Engine. Because [The Engine Architecture] of Gdx Engine is very flexible and efficient, and is suitable for both the project scale from small, medium to large commercial projects. Gdx Engine is really just born, so it was pretty much limited in terms of features: as the lack of nice effects, camera smoother or more unique shader. So Gdx Engine still is a long way to grow, so I would need more support from you! Any contribution of you are warmly welcome! Please see the [contribution].

This website will inform you about the GDX Engine, how it works and how to use the engine in your game projects. I tried to do the documentation in detail and easy to understand as possible. Including the architecture of the engine, the articles explains the essential components and step-by-step tutorials, tutorials about the features that Gdx Engine support through the game example which I have prepared. All source code for the GDX Engine, documents, and of the example games are free and you can download easily in the [Download and setup]. You're welcome to mail me on MrThanhVinh168@gmail.com or you can read the [online documents].

If you publish your game using my engine code, all you need to receive the usage’s rights is display the logo of engine, It can be laid on your splash screen. Your support will help me by promoting the engine very well.

Contribution

Because GDX Engine is developed in time is not long, so it's still a lot of shortcomings, your support will be an important source of motivation for the development of GDX Engine! I am currently looking for members to continue with me to develop this engine. If you have the following conditions, please do not hesitate to email me on the address MrThanhVinh168@gmail.com I always look forward to the contribution from the you!
+ General Requirements: Passion in the field of game development and open-source game engine
+ Engine Programmer: Improve the coding style of the game engine and create more engine features.
+ Graphic programmer: Fluent OpenGL ES Shading Language to create more effect for engine
+ Document Writer: Create your own games using GDX Engine and write tutorials about your games!
You can also support the for GDX Engine simple by tell your friends about this engine and generate backlinks about GDX homepage Engine. If you can create game use GDX Engine, please let me know via email, I am very happy to hear from you!

About author

Hi everyone have visited my website. My first name is Vinh and game making is one of my hobbies beside I work in. NET Framework, Java, Wordpress, Web design and I'm working for a out-sourcing software company in my country. Before i start learing Libgdx, I have researched for the XNA Framework and [here] is some my minor project. English is not my native language so my tutorials maybe have some Gramma errors, if you spot anything wrong, please report me by writing comments. Your comments will be highly appreciated. As you see my nickname is 'Akemi-san' I named that from my favorite anime (cartoon in Japan) If you interest this, you can check the film in [link]. When you need to contact me, you can call me Vinh or 'Akemi-san', both names are fine. You 're welcome to mail me on my email, Maybe i can not reply to all emails you sent to me at once but i will read all of them.

Here is some content in website, you should follow this order if you are the beginner in game developments.

The Engine Architecture

Introduce to GdxEngine, how it works and how to develop yours libgdx game using GDX Engine

Introduction Game Service

Introduction Game Service, Game service is vital of the engine. This post will inform you how to use game service of GDX Engine


Introduce to SpaceWar

Spacewar is a game 2D example that using GDX Engine. I will inform you some important 2D graphic features of engine by the code of the example game.

Introduce to SpaceWar3D

Spacewar3D is a 3D version of spacewar example game. I will inform you some important 3D graphic features of gdx engine using in the game.

I list some engine packages belows:

Introduce to Gdx Engine Packages


This tutorial will describe lightly about packages of Gdx Engine.

You can see almost base classes and interfaces in here. Most of the engine are abstract classes and interfaces. With an abstract class, we often have the prefix "Base" before the class name to let you know it is an abstract class. To the interface, we will have a prefix of 'I' is an interface signal. Also engine has built standard class inheritance and implementation from an abstract class and interface, we usually have prefix 'Default' before the name to the class. You can create a new class by inheriting from the 'Default' class (the fastest way) or from the abstract class and implements other interfaces, if necessary optimize the class.
  1. Com.gdxengine.camera

Contains the camera is built exclusively for the game 3D. Camera should be added to the CameraManager Object to use
  1. Com.gdxengine.effect

contains the effect that GDX Engine was built. Particle Effect Manager used to create particle effects only for 2D games. Addition class ShaderManager will manage shaders, to render 3D objects, just for 3D gaming.
  1. Com.gdxengine.material

not built much. Material mainly used to store the values ​​of parameters passed to the shader. These are the parameters used for the texture when rendering objects. These parameters may be the model textures, TextureSampler, NormalTexture ...
  1. Com.gdxengine.light

No built many. Light mainly used to store the values ​​of parameters passed to the shader. These are the parameters used for the light to render objects. These parameters can be type LightColor, LightDirection, LightPosition ...
  1. Com.gdxengine.object3d

Contains the standard extension classes based on the parent class in the package framework or framework.Interfaces. You can rely on the classes in this package to build 3D objects for your own 3D games
  1. Com.gdxengine.ui

Contains the class supports the creation of user interface components in the game. I have built the class to create a custom menu. Other components such as dialog, input text, checkbox, ... will continue to be added in the update of GDX engine.
  1. Com.gdxengine.test. *

Contains classes show some individual features of GDX Engine or contains sub package contains the source code of the example game is available that GDX Engine has provided.