Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Nymphodora), 972 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Was und Wie waren wie befehle von A3 ? #464947
03/19/17 14:35
03/19/17 14:35
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
Hallo Allerseits,

schon seit längerer Zeit versuche und suche ich eine Möglichkeit,
wie man 3D Gamestudio oder 2D/3D Progamme auf Android ausführt ...

Code:
Das aber geht vom Werk her nicht so (wegen DirectX,Windwos Header Dateien und alles)
da Android ein Linux Kernel besitzt !



Jetz habe ich mich mal da mal ein bisschen schlau gemacht und
habe folgendes Gefunden:

Code:
C4Droid (Android C++ Compiler that creates Apk files) Kostet einmalig 4 Euro im Playstore || und libs und links werden AUTOMARTISCH erzeugt )



Code:
GCC Compiler (a muss have plugin for C4Droid )



Code:
SDL2 Plugin (2D Engine)



Nach paar Jahren und etlichen Foren und Google Besuche
bin ich dahintergekommen, wie es Funtioniert und habe
auch schon ein 2D Shooter für Android geschrieben (mit touch,feinde,schüsse,sound,scroe,lives,levels)

/////////////////////////////////////

Jetz wollte ich aber auf 3D Umsteigen und bin auch hier fündig geworden..SDL2 kann anscheind auch 3D!!! (in Form von OpenGL)


ABER:
Code:
-> Android arbeitet nicht mit OpenGL sondern mit OpenGL ES !!!

-> es ist sehr kompliziert da es nur in der version 1.0 
   verliegt (mittlertweile OGL-ES 4+ ..Vulcane)
   
-> es git kein EGL oder sonstiges (gl_position , gl_camera..)
   sondern NUR C#/C++ und SDL2/OpenGL ES 
   
-> es gibt keine X,Y,Z coordinaten sondern nur: (0.5f, 0.0f,0.5f) 
   
-> will man ein Object bewegen so muss man die Matrix manipulieren* via. translation,rotation pushMatrix,PopMatrixs
   
-> es können keine 2D Surfaces und Fonts (bmps,jps..)dargestellt werden !
      hierzu braucht man ein "Surface to GLTexture converter" 

-> Object Loader MUSS man selbst schreiebn (kein OpenGL ES example im netz)



/////////////////////////////////////


Hierzu habe ich mal ein 3D Cube Code gefunden der sich dreht:

copy in c4droid and paste - compile / run


Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

#include <SDL2/SDL.h>
//#include <SDL2/SDL_image.h> 
#include <SDL2/SDL_opengles.h>

static SDL_Window *window;
static SDL_GLContext context;

static void AspectAdjust(int w, int h)
{
    float aspectAdjust;

    aspectAdjust = (4.0f / 3.0f) / ((float)w / h);
    glViewport(0, 0, w, h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrthof(-2.0, 2.0, -2.0 * aspectAdjust, 2.0 * aspectAdjust, -20.0, 20.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glShadeModel(GL_SMOOTH);
}

static void Cube()
{
    static GLubyte color[8][4] = { {255, 0, 0, 0},
    {255, 0, 0, 255},
    {0, 255, 0, 255},
    {0, 255, 0, 255},
    {0, 255, 0, 255},
    {255, 255, 255, 255},
    {255, 0, 255, 255},
    {0, 0, 255, 255}
    };

    static GLfloat cube[8][3] = // 8 vertices, 3 vertexpoints
    {
    {0.5, 0.5, -0.5},
    {0.5f, -0.5f, -0.5f},
    {-0.5f, -0.5f, -0.5f},
    {-0.5f, 0.5f, -0.5f},
    {-0.5f, 0.5f, 0.5f},
    {0.5f, 0.5f, 0.5f},
    {0.5f, -0.5f, 0.5f},
    {-0.5f, -0.5f, 0.5f}
    };

    static GLubyte indices[36] =
    {   0, 3, 4,
        4, 5, 0,
        0, 5, 6,
        6, 1, 0,
        6, 7, 2,
        2, 1, 6,
        7, 4, 3,
        3, 2, 7,
        5, 4, 7,
        7, 6, 5,
        2, 3, 1,
        3, 0, 1
    };


    /* Do our drawing, too. */
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /* Draw the cube */
    glColorPointer(4, GL_UNSIGNED_BYTE, 0, color);
    glEnableClientState(GL_COLOR_ARRAY);

    glVertexPointer(3, GL_FLOAT, 0, cube);

    glEnableClientState(GL_VERTEX_ARRAY);
    glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_BYTE, indices);

    glMatrixMode(GL_MODELVIEW);
   glRotatef(5.0, 1.0, 1.0, 1.0);
}


int Render()
{
  Cube();
}

//////////////////////////////////////////////////////////

int main(int argc, char *argv[])
{
    int done;
    
    SDL_DisplayMode mode;
    SDL_Event event;
    
    Uint32 then, now, frames;

    if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
    { 
        SDL_Log("Unable to initialize SDL");
        return 1;
    }

    SDL_GetDesktopDisplayMode(0, &mode);

    SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);

    // Create our window centered
    window = SDL_CreateWindow("GLES example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
	mode.w, mode.h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN);
    if (!window) {
	// Die if creation failed
	SDL_Log("Unable to create window");
	return 1;
    }

    // Create our opengl context and attach it to our window
    context = SDL_GL_CreateContext(window);
    if (!context) {
	SDL_Log("Unable to create GL context");
	return 1;
    }

    SDL_GL_MakeCurrent(window, context);

    SDL_GL_SetSwapInterval(1);

    SDL_Log("Screen bpp: %dn", SDL_BITSPERPIXEL(mode.format));
    SDL_Log("n");
    SDL_Log("Vendor     : %sn", glGetString(GL_VENDOR));
    SDL_Log("Renderer   : %sn", glGetString(GL_RENDERER));
    SDL_Log("Version    : %sn", glGetString(GL_VERSION));
    SDL_Log("Extensions : %sn", glGetString(GL_EXTENSIONS));
    SDL_Log("n");

    AspectAdjust(mode.w, mode.h);

    /* Main render loop */
    frames = 0;
    then = SDL_GetTicks();

    done = 0;
    while (!done)
    {
        /* Check for events */
        ++frames;
        while (SDL_PollEvent(&event)) {
            switch (event.type) {
            case SDL_KEYDOWN:
                if (event.key.keysym.scancode == SDL_SCANCODE_AC_BACK) {
                    done = 1;
                }
                break;

     // lanfscape or potrai
            case SDL_WINDOWEVENT:
                switch (event.window.event) {
                    case SDL_WINDOWEVENT_RESIZED:
                        /* Change view port to the new window dimensions */
                        AspectAdjust(event.window.data1, event.window.data2);
                        /* Update window content */
                        Render();
                        SDL_GL_SwapWindow(window);
                        break;
                }
            }
        }

        Render();
      
        SDL_GL_SwapWindow(window);
    }

    /* Print out some timing information */
    now = SDL_GetTicks();
    if (now > then) {
        SDL_Log("%2.2f frames per secondn",
               ((double) frames * 1000) / (now - then));
    }

    SDL_GL_DeleteContext(context);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}



Mithilfe dieses Codes habe ich schon ein 16x16x16 VoxelCube programmiert

/////////////////////////////////////

Jetz hatte ich folgendes vor:

-> warum nicht mal versuchen eine eigende Engine zu schrieben ?

* 2d / 3D initalisierung
* x,y,z coodrdinaten system
* pan tilt roll
* camera
* steuerung

* Function Action
* Panels (2d,3d,fonts)
* einfacher OBJ Loader
* ent_create("file",vector(x,y,z), Action)

Und wollte folgendes Wissen:

-> Was waren die ersten paar befehle von Gamestudio A3 ?
-> warum nur A3 ? Erstmal als test

Wer kann und will mir helfen, sodas man später eine Datei hat (ohne linker libs und Paths)
und diese einfach in die Main einfügen kann auf Android und los gehts (coden wie in a3) ???




Last edited by ratz; 03/19/17 15:03.
Re: Was und Wie waren wie befehle von A3 ? [Re: ratz] #464951
03/19/17 21:02
03/19/17 21:02
Joined: Aug 2003
Posts: 118
Deutschland
E
Ezzett Offline
Member
Ezzett  Offline
Member
E

Joined: Aug 2003
Posts: 118
Deutschland
A3 gibt es hier http://server.conitec.net/down/a3.zip

Wäre es nicht sinnvoller, eine bereits existierende Open Source-Game Engine für Android zu benutzen und dort die gewünschten Gamestudio-internen Methoden und Klassen nachzubasteln? Dann spart man sich das Implementieren einer Engine.

Wenn es trotzdem eine eigene Engine sein soll, so empfehle ich erst einmal, die Bücher Game Coding Complete und Game Engine Architecture zu lesen. Die neuesten Auflagen natürlich. Hier findet man praktische Erfahrungen der Autoren aus Jahrzehnten in der Softwareentwicklung.

Re: Was und Wie waren wie befehle von A3 ? [Re: Ezzett] #466389
06/12/17 18:43
06/12/17 18:43
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
Ich empfehle libgdx als Engine. Ist Java


Follow me on twitter

Moderated by  TWO 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1