Jump to content

Daimour

Members
  • Posts

    191
  • Joined

  • Last visited

Posts posted by Daimour

  1. How can i output time of the day from script

    Use SetEntityKey() function to se tup the time. Or GetEntityKey() function to get the time from script.

    This script (entity) has 3 keys: "hour", "minutes" and "seconds". So use these keys.

    hour = GetEntityKey(daynight, "hour")
    
    SetEntityKey(daynight, "hour", hour)
    

  2. Since I love Lua in Leadwerks I would advice to start making your main loop with Lua.

     

    Because of (I wrote it before here):

     

    - It's simpler than C++;

    - You don't need to compile anything or run any external IDE (you don't need any IDE at all);

    - It works inside Leadwerks Editor (you can play around with it, you can play your game directly in Editor);

    - You can edit LUA-script on fly and see result immediately;

    - You can easily include or exclude any features (on fly).

     

     

    And when you will see that Lua is not enough for you can rewrite your code to C++ or BlitzMax or whatever you want.

  3. Rendering something to buffers every frame is not the best idea. Do it only if your picture changes every frame (for post-effects, mirrors, picture in picture etc.).

     

    In other cases render picture only once to get desired texture. And then use this texture multiple times where you need to draw it.

    I think you can use such approach for GUI.

  4. I heard that it's faster to load the frames as separate textures and only change the MaterialTexture.Is that right ,or would you say that the methode with the 2nd buffer is better?

     

    I think they are the same. They different only in getting small texture (grabbing it from the big one vs loading from separate file). Since it happens only once at starting game the difference has no matter.

     

    If you are looking for the fastest way, I think it would be fastest to use one big texture and special shader to change UV coordinates.

  5. You can draw a little piece of big texture to little texture. Then you can use that little texture as you want.

     

     

    Code from the video:

    --preparations
    local cbst = LoadTexture("abstract::cobblestones.dds")
    local buf = CreateBuffer(128, 128, BUFFER_COLOR)
    local tex = CreateTexture(128, 128, TEXTURE_RGB)
    SetColorBuffer(buf, tex, 0, 0)
    
    --render image to custom buffer
    SetBuffer(buf)
    DrawImage(cbst, MouseX() - 512, -(MouseY() - 512), 1024, -1024)
    SetBuffer(BackBuffer())
    
    --draw custom buffer to back buffer
    DrawImage(tex, 100, 100, 128, 128)
    

    • Upvote 2
  6. Hi. What red light are you talking about? I can't see any red lights in video.

    It's too hard to guess what you expect from light and what techniques you use...

     

    Try to make your light less intensive if it will help.

  7. I've learned a little about GNet. And I like it very much. It's the simplest thing for networking I've ever seeing.

     

    In your case you don't need all that code on the server side. Because all work is going on the client side.

    Simplify your code as much as possible for debugging purposes.

     

    Try to replace server side code with this:

    Local port = 80 ' users would normally choose one allowed through their firewall
    Local servername$ = "Freezing_world_server"+Rand(1000, 9999)
    
    Local success
    success = GNetListen( host, port )
    If Not success Then RuntimeError "Cannot create server!"
    
    Repeat
    Delay 10 ' allow other apps some cycles to minimize CPU use
    PollEvent
    GNetSync host
    Until EventID() = EVENT_WINDOWCLOSE
    

     

    So since nothing happens on the server side you can easier debug your client side code.

    • Upvote 1
  8. Nice. What about Lua? Will it use the same object model?

     

    May be commands should be separated in two groups: "high level" functions (main building blocks) and "low level" functions (for thin tuning). So Leadwerks will not lose charm of simplicity (when looking at high level functions only).

×
×
  • Create New...