Jump to content

Canardia

Developers
  • Posts

    4,127
  • Joined

  • Last visited

Posts posted by Canardia

  1. I'm mostly worried about decent, usable shadows. LE2's shadowmapping works only for very short distances, and everything beyond 500 units is just fullbright. OpenGL stencil shadows would provide infinite distance of shadows, which is very important for me, but I think Josh doesn't like them. So I really don't know how to make a decent game with shadows on Android and Windows, because all the engines which actually have decent shadows have no C++ support.

  2. Someone just posted a custom shader for UV scaling and scrolling (=offset), so theoretically it could be possible to use different UV offsets for cubes of the same material/shader, by telling the shader to use different offsets based on some value which different for each cube. The EntityColor could be one such value, so it could be used as a mapping value for a UV offset.

  3. So do I, I get very stressed by the long compilation times of Visual Studio, because my style of game development is to write small code changes and then compile and test it. CodeBlocks compiles much faster than Visual Studio, and also produces faster code (with MinGW64).

  4. You are probably initializing Framework before Graphics is created. If you use LEO classes in your own classes, you should always specify Classname object(CREATE_LATER), else your classes will launch in a random order (in the order you declared their instances).

  5. It disables creating the engine.log file and also any output into the engine.log and to stdout from the engine itself. But it doesn't disable stdout from C++.

     

    You can compile my example with mingw64 using:

    g++ main.cpp -Ic:\prg\le\cpp c:\prg\le\cpp\engine.cpp -O6 -static -m32 -o main.exe

    to see it yourself.

  6. AppLogMode(0) disables all the engine logs, and you can still use use printf() to print your own debug messages:

    #include "engine.h"
    int main()
    {
       Initialize();
       AppLogMode(0);
       Graphics();
       CreateFramework();
       CreateSpotLight();
       BP cube=CreateCube();
       MoveEntity(cube,Vec3(0,0,5));
       double n;
       while(1)
       {
           UpdateFramework();
           if(KeyHit(KEY_A))printf("**** My Debug Message ****\n");
           if(KeyHit(KEY_ESCAPE))break;
           n=AppSpeed();
           TurnEntity(cube,Vec3(1*n,2*n,3*n));
           RenderFramework();
           Flip(0);
       }
       return Terminate();
    }

    • Upvote 1
  7. It's very simple actually. You can use a normal Apache PHP server, and send HTTP requests to the server.

    For sending HTTP request, you can use for example libcurl ( http://curl.haxx.se/ ), which is very easy to use, for example:

     

    /* A multi-threaded example that uses pthreads extensively to fetch

    * X remote files at once */

     

    #include <stdio.h>

    #include <pthread.h>

    #include <curl/curl.h>

     

    #define NUMT 4

     

    /*

    List of URLs to fetch.

     

    If you intend to use a SSL-based protocol here you MUST setup the OpenSSL

    callback functions as described here:

     

    http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION

     

    */

    const char * const urls[NUMT]= {

    "http://curl.haxx.se/",

    "ftp://cool.haxx.se/",

    "http://www.contactor.se/",

    "www.haxx.se"

    };

     

    static void *pull_one_url(void *url)

    {

    CURL *curl;

     

    curl = curl_easy_init();

    curl_easy_setopt(curl, CURLOPT_URL, url);

    curl_easy_perform(curl); /* ignores error */

    curl_easy_cleanup(curl);

     

    return NULL;

    }

     

     

    /*

    int pthread_create(pthread_t *new_thread_ID,

    const pthread_attr_t *attr,

    void * (*start_func)(void *), void *arg);

    */

     

    int main(int argc, char **argv)

    {

    pthread_t tid[NUMT];

    int i;

    int error;

     

    /* Must initialize libcurl before any threads are started */

    curl_global_init(CURL_GLOBAL_ALL);

     

    for(i=0; i< NUMT; i++) {

    error = pthread_create(&tid,

    NULL, /* default attributes please */

    pull_one_url,

    (void *)urls);

    if(0 != error)

    fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);

    else

    fprintf(stderr, "Thread %d, gets %s\n", i, urls);

    }

     

    /* now wait for all threads to terminate */

    for(i=0; i< NUMT; i++) {

    error = pthread_join(tid, NULL);

    fprintf(stderr, "Thread %d terminated\n", i);

    }

     

    return 0;

    }

     

    This example is also multi-threaded, so it doesn't stop your LE main thread while sending/getting HTTP data from the web server.

  8. You can use the UpdatePhysics hook:

    
    require("Scripts/constants/keycodes") 
    require("Scripts/console") 
    
    local bonks=0
    local frames=0
    
    function MyPhysicsHook()
    bonks=bonks+1
    AddConsoleText("PhysicsUpdates: "..bonks.."    Frame: "..frames)
    end
    
    --Register abstract path 
    RegisterAbstractPath("") 
    
    --Set graphics mode 
    if Graphics(1024,768)==0 then 
    Notify("Failed to set graphics mode.",1) 
    return 
    end 
    
    world=CreateWorld() 
    if world==nil then 
    Notify("Failed to initialize engine.",1)   return 
    end 
    
    fw=CreateFramework()
    
    camera=fw.main.camera
    camera:SetPosition(Vec3(0,0,-2)) 
    
    light=CreateSpotLight(10) 
    light:SetRotation(Vec3(45,55,0)) 
    light:SetPosition(Vec3(5,5,-5)) 
    
    model=LoadModel("abstract::oildrum.gmf") 
    
    ground=CreateBodyBox(10,1,10)
    groundmesh=CreateCube(ground)
    groundmesh:SetScale(Vec3(10.0,1.0,10.0))
    ground:SetPosition(Vec3(0.0,-2.0,0.0)) 
    groundmesh:Paint(LoadMaterial("abstract::cobblestones.mat"))
    ground:SetCollisionType(1)
    
    Collisions(1,1,1)
    --DebugPhysics(1)
    SetStats(0)
    
    light=CreateDirectionalLight() 
    light:SetRotation(Vec3(45,45,45)) 
    
    local timer=AppTime()+1000
    consolemode=1
    AddHook("UpdatePhysics",MyPhysicsHook)
    while AppTerminate()==0 do 
    
    if KeyHit(KEY_ESCAPE)==1 then
    break
    end 
    
    if timer<AppTime() then
    timer=AppTime()+1000;
    model=CopyEntity(model)
    model:SetPosition(Vec3(0,10,0))
    end
    
    fw:Update()
    fw:Render()
    
    frames=frames+1
    
    DrawText("FPS: "..UPS(),300,0)
    Flip(0)
    
    end
    
    

  9. I have successfully used a PS3 controller on the PC with the SDL_Haptic lib, and I think it supports XBOX 360 controllers also. Just google for SDL_Haptic, or maybe nowadays it would be GLFW to google for, since things change, but there will be always one lib which support PS3/XBOX controllers on PC.

×
×
  • Create New...