Games Who writes their own functions?

andymc

Well-Known Member
Licensed User
Longtime User
I've written my own onscreen joypad controls even though there are pre-written libgdx commands for this.

I've also written simple collision detection code I've been using in my games...

Who else tries to write their own code before using pre-written functions? I will learn box2D soon instead of writing my own physics engine though!
 

melonZgz

Active Member
Licensed User
Longtime User
Here!
I didn't even know there were onscreen controls in libgdx until you've said it :confused: I'm using gesture detector and input processor for my buttons on my platformer
I'm also not using scene2d. I'm doing manually all the animations of the GUI, using interpolators and textureRegions.
I was also writting my own physics until I tried Box2D... but box2d is awesome, just try it and you won't make any game without it :D
 

sorex

Expert
Licensed User
Longtime User
but box2d is awesome, just try it and you won't make any game without it

sure, if you have it for IOS aswell it's worth looking at. now it's limiting you/me to android only.

libGDX for ios would be ideal but I doubt anyone would like to spend time on making a b4i wrapper for it not to mention supporting it. :)

And yes, I wrote most things myself as you can see in my posts used libs.
All games have their B4J tool(s) aswell to prototype, generate & pack data (unless it's generated on the fly)
 

Informatix

Expert
Licensed User
Longtime User
sure, if you have it for IOS aswell it's worth looking at. now it's limiting you/me to android only.

libGDX for ios would be ideal but I doubt anyone would like to spend time on making a b4i wrapper for it not to mention supporting it. :)
It would be so complicated to make a libGDX lib for B4i that I'm pretty sure that will never happen. It would require to recode completely the hundreds of thousands of lines of the original Java library.
If you want to create a multi-platform game, writing the game directly in Java would be a better idea, so you could use the original libGDX lib and maintain a single source code for different OS (contrary to B4x, where you have to maintain different source codes). An even better idea would be to use dedicated tools like Unity.
 

sorex

Expert
Licensed User
Longtime User
It would be so complicated to make a libGDX lib for B4i

from what I see there is an ios version of it but it's the link between the 2 that needs to be done.

A single API to target:
  • Windows
  • Linux
  • Mac OS X
  • Android (2.2+)
  • BlackBerry
  • iOS
  • Java Applet (requires JVM to be installed)
  • Javascript/WebGL (Chrome, Safari, Opera, Firefox, IE via Google Chrome Frame)
 

wonder

Expert
Licensed User
Longtime User
I've written my own onscreen joypad controls even though there are pre-written libgdx commands for this.

I've also written simple collision detection code I've been using in my games...

Who else tries to write their own code before using pre-written functions? I will learn box2D soon instead of writing my own physics engine though!
Me!! I even write my own C++ libs!! :D
 

JordiCP

Expert
Licensed User
Longtime User
Yes, I found it useful for some massive array manipulations which allowed some kind of parallel processing. The setup is "quite easy" once you are already on the C side

For example, SIMD-Neon assembler for arm-v7 +. Used for instance here
B4X:
void myCfunction(...){  // Need only the structure so that it can be called normally from other C functions

   // your setup..

   asm volatile(

         // just some lines of a routine as an example
         "lsl %8,%8,#2  \n\t"
         "vld4.u8 {d0,d1,d2,d3},[%0],%8  \n\t"     // Llegim dades del TXT (BGRA)
         "vld4.u8 {d6,d7,d8,d9},[%1],%8  \n\t"     // Llegim dades del PIC (BGRA)

         // PIC --> necessitem un vector amb la Y:  Y sera 66*R+129*G+25*B (expandim)
         "vmull.u8 q10,d6,d10  \n\t"     // factor B --> Y = 25*B
         "vmlal.u8 q10,d7,d11  \n\t"     // factor G --> Y = Y + 129*G
         "vmlal.u8 q10,d8,d12  \n\t"     // factor R --> Y = Y +  66*R

        // .....
   )
}

Then someone knocked my door and a couple of years after I am not able to understand what I wrote o_O
giphy.gif
 

wonder

Expert
Licensed User
Longtime User
That's pretty cool!!

I tried to implement Sqrt14 from this page, but NDK's gcc doesn't like it... :(

B4X:
double inline __declspec (naked) __fastcall sqrt14(double n)
{
    _asm fld qword ptr [esp+4]
    _asm fsqrt
    _asm ret 8
}

I admire assembly code, but I know nothing about it...
 

JordiCP

Expert
Licensed User
Longtime User
I tried to implement Sqrt14 from this page, but NDK's gcc doesn't like it... :(
I think the assembly in the link is for x86 processors, but can't be sure.
Luckily nowaday's compilers can optimize code up to a level where only in very rare cases one will need assembler.
 
Top