Games XUI2D

Discussion in 'Game Development' started by ilan, Aug 26, 2018.

  1. ilan

    ilan Expert Licensed User


    i am not sure if this is the right place to start a thread about my thoughts about XUI2d but i hope it is and if not then erel please move it to the right place.

    ok after reading so many threads and seeing really nice example made with xui2d i wanted to try the framework and see how it works. i made a lot of games until today and most are using libgdx and some also box2d (for android) and for ios am using iSpritekit. for b4j i get a very good result using simple canvas and jBox2d so this is what i use for b4j.

    Anyway i started with the simple Hello World example and then also looked at the invaders and super Mario example and i really struggle to understand how it works. it is in my opinion too complicated for such simple examples like the hello world example where some donuts and rectangles fall from the sky. i would need maybe less then 80 lines for that example using spritekit, libgdx + box2d or for b4j canvas + box2d but in the xui2d example i have 7 CLASSES !! but why ??

    those are just 2 objects that are created randomly so why so many classes and to be truth i still don't understand how it works. the code is to "object-oriented" for me.

    i work a lot with ispritekit and i really like how simple and powerful it is so i am planning to make it possible to use the same syntex in b4a as in b4i only that i will use libgdx (or accelerated surface) and box2d for the rendering and physics calculation in the back. so the idea is using the same code as i use in my b4i apps also for b4a but only use libgdx instead. because it is very powerful and can get easily a great performance. i know it wont be easy but it is worth to start with simple object and convert them to b4a like skspritekits, skactions, skbodies etc.

    it will be a very interesting project but a very powerful game making tool for ios and android!

    btw i will include a very simple example using b4k and jbox2d and clone the hello world example of xui2d. in my opinion, it is much better to understand and also looks like it is shorter.

    (note that it is a very simple example so much more stuff can be added and the object creating class can be and should be extended for your needs)

    PS: and very old example i did using b4j and box2d (i have some mistakes in like like to angle drawing but i fixed it in a later version:

    Attached Files:

    Last edited: Aug 26, 2018
  2. LucaMs

    LucaMs Expert Licensed User

    I want to comment, as I am very experienced; in fact, I have never developed 2D games (let alone 3D), I do not know libGDX or even XUI2D :D

    ["Then why do not you shut up?" - I do not know :D; or rather, it would be too long to explain. Also, I like to have so much source code available that maybe I can study and use and, sooner or later, I will do it]

    Many classes - source code - means more power on you hand! You know that one of the programming tips is to split / subdivide the "problem" to be solved in many small parts ("dividi et impera").
    Also, again without knowing libGDX, I suppose you use many of its objects, which are obviously existing classes, which you do not see and of which you do not have the source code. Maybe you use a command like: SomeLibGDXObject.Xyz not knowing that behind that simple command there is a series of cascaded classes. When I use an EditText, I could think it is a single class, and it is but:
    all this "behind the scenes", but there are a lot of classes to create a simple EditText.

    (And this one? :D)

    Finally (although this is the main reason for the creation of XUI) you can create apps for Android and iOS with minimal changes using it, while when you use libGDX and iSpritekit your sources will certainly be much more different from each other.

    Now (maybe) I can go to watch the source of XUI2D "Hello World".
    ["Now? You should have done it before writing these stupid things" :D]
    Rockefeller Goldman likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    You are counting it wrong. The X2 classes are not your classes. Think about them as a library. You just need to add them to your project. You don't need to open the modules and you don't need to modify or add anything to these classes.

    The complete code of the hello world example is less than 80 lines and most of these lines come from a template (there are about 10 lines of code added to the default template).

    I could have compiled the X2 classes into a library but I think that it is better to let developers see the code when they need it (there is also a performance factor here as some of the subs in the Game class, which is your class, are called from the main loop and direct calls are the fastest calls).
  4. LucaMs

    LucaMs Expert Licensed User

    this is very interesting so I have to go and see what it is (assuming it is available to us).
  5. LucaMs

    LucaMs Expert Licensed User

    I write here, the worst place to do it :p, one of my comments concerning Erel's sources (so you will understand that I am also able to criticize :D, although Erel already knows this - Resumable :D):

    I do not understand why he, who knows perfectly the OO programming and you can see this, does not use the Regions! :eek:
  6. Erel

    Erel Administrator Staff Member Licensed User

    The simplest way to create a new XUI2D project is by making a copy of one of the example folders.

    The template of the Game class is available:

    LucaMs likes this.
  7. LucaMs

    LucaMs Expert Licensed User

    despite my statement:
    when I saw the first example, the one with the walking man, I tried to add an arrow (and shoot it, of course).
    I did it in 5 minutes, having looked at the code for the first time and for a few minutes.
    This demonstrates the excellent structuring of the source code (and of the excellent comments).
    Johan Hormaza and Erel like this.
  8. Erel

    Erel Administrator Staff Member Licensed User

    ilan likes this.
  9. LucaMs

    LucaMs Expert Licensed User

    I saw (now), it is part of the XUI2D library (I like very much this new feature, you can add your own class templates to the IDE :))
  10. Erel

    Erel Administrator Staff Member Licensed User

    Need another 10 - 20 minutes to complete a cross platform tank:

    Peter Simpson, ilan and LucaMs like this.
  11. LucaMs

    LucaMs Expert Licensed User

    Too many minutes; I would not pay you the job or I would fire you :p
  12. ilan

    ilan Expert Licensed User

    ok i understand, so i think it would be maybe better to put them inside a lib to avoid confusion :)

    sure!!!! (if i would understand how xui2d works i would do that by myself)

    so a very simple question, how do i add a simple bitmap to my canvas in xui2d? how do i connect a body to it?
    do i draw all bitmaps according to the bodies position or is there a simple xui2d view that holds a texture and also hold a body and i just apply forces to that body and the texture is moving automaticaly with it?

    the hello world example is not clear to me. i also preffer to understand how to make simple actions and then create my classes as needed so the main activity is to empty right now.

    can you create an example where everything is in the main activity and you cretate manually the bitmap view and then the body view without tiled or any class that does it automatically??

    thank you erel :)
  13. ilan

    ilan Expert Licensed User

    really coold erel!! you have a gamer soul inside your body!! ;)
    LucaMs likes this.
  14. LucaMs

    LucaMs Expert Licensed User

    inside ONE of his heads !!! :D
  15. Erel

    Erel Administrator Staff Member Licensed User

    B4A example is ready. Small delay with B4i as there is a missing method in iXUI2D...
    ilan likes this.
  16. LucaMs

    LucaMs Expert Licensed User

    Seeing someone (Erel) skilled in every field of computing (and they are so many) is humiliating, depressing, makes you feel stupid.
    Fortunately this is not my case, since I am really stupid :p
    inakigarm and ilan like this.
  17. Erel

    Erel Administrator Staff Member Licensed User

    Done. Movie is being uploaded. Without the template code there are about 50 lines of code.
    ilan and LucaMs like this.
  18. Erel

    Erel Administrator Staff Member Licensed User

    XUI2D is a big framework. You need to learn how to use it. In the long run it is better for developers to have easy access to the X2 classes code. It will allow you to better understand how it works and modify it as needed.
    Rockefeller Goldman and LucaMs like this.
  19. Erel

    Erel Administrator Staff Member Licensed User

    I'll add the source code to the example pack.
  20. LucaMs

    LucaMs Expert Licensed User

    I simply knew :)
    Rockefeller Goldman likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice