Jump to content

Daimour

Members
  • Posts

    191
  • Joined

  • Last visited

Posts posted by Daimour

  1. I may assume that both physics driven update and entity->SetPosition() are producing new position in world->Update() simultaneously. So they concurrent to each other and SetPosition() wins.

     

    I don't know if it will be suitable for you, but you can try call entity->SetPosition() not every frame, but every second frame. Thus first world->Update() will move entity by physics and the second one will execute SetPosition().

     

    Or you can try to call world->Update() twice in one frame for that purpose. And use SetPosition() between them. But I'm afraid it will eat a lot of FPS.

  2. Here is error message in web browser:

     

    1365011892-clip-93kb.png?nocache=1

     

    Full text under spoiler.

     

    MediaWiki internal error.

     

    Original exception: exception 'DBQueryError' with message 'A database error has occurred

    Query: SELECT value,exptime FROM `objectcache` WHERE keyname='leadwerk_wikiadmin:messages:en'

    Function: MediaWikiBagOStuff::_doquery

    Error: 1286 Unknown storage engine 'InnoDB' (localhost)

    ' in /home/leadwerk/public_html/wiki/includes/db/Database.php:606

    Stack trace:

    #0 /home/leadwerk/public_html/wiki/includes/db/Database.php(561): Database->reportQueryError('Unknown storage...', 1286, 'SELECT value,ex...', 'MediaWikiBagOSt...', false)

    #1 /home/leadwerk/public_html/wiki/includes/BagOStuff.php(454): Database->query('SELECT value,ex...', 'MediaWikiBagOSt...')

    #2 /home/leadwerk/public_html/wiki/includes/BagOStuff.php(324): MediaWikiBagOStuff->_doquery('SELECT value,ex...')

    #3 /home/leadwerk/public_html/wiki/includes/BagOStuff.php(240): SqlBagOStuff->_query('SELECT value,ex...', 'leadwerk_wikiad...')

    #4 /home/leadwerk/public_html/wiki/includes/MessageCache.php(246): SqlBagOStuff->get('leadwerk_wikiad...')

    #5 /home/leadwerk/public_html/wiki/includes/MessageCache.php(606): MessageCache->load('en')

    #6 /home/leadwerk/public_html/wiki/includes/MessageCache.php(543): MessageCache->getMsgFromNamespace('Mainpage', 'en')

    #7 [internal function]: MessageCache->get('mainpage', true, true)

    #8 /home/leadwerk/public_html/wiki/includes/StubObject.php(58): call_user_func_array(Array, Array)

    #9 /home/leadwerk/public_html/wiki/includes/StubObject.php(76): StubObject->_call('get', Array)

    #10 /home/leadwerk/public_html/wiki/includes/GlobalFunctions.php(467): StubObject->__call('get', Array)

    #11 /home/leadwerk/public_html/wiki/includes/GlobalFunctions.php(467): StubObject->get('mainpage', true, true)

    #12 /home/leadwerk/public_html/wiki/includes/GlobalFunctions.php(432): wfMsgGetKey('mainpage', true, true, true)

    #13 /home/leadwerk/public_html/wiki/includes/GlobalFunctions.php(380): wfMsgReal('mainpage', Array, true, true)

    #14 /home/leadwerk/public_html/wiki/includes/Title.php(293): wfMsgForContent('mainpage')

    #15 /home/leadwerk/public_html/wiki/includes/Wiki.php(105): Title::newMainPage()

    #16 /home/leadwerk/public_html/wiki/index.php(60): MediaWiki->checkInitialQueries(NULL, 'view')

    #17 {main}

     

    Exception caught inside exception handler: exception 'DBQueryError' with message 'A database error has occurred

    Query: SELECT page_title FROM `page` WHERE page_is_redirect = '0' AND page_namespace = '8' AND (page_title not like '%%/%%') AND (page_len > 10000)

    Function: MessageCache::loadFromDB

    Error: 1286 Unknown storage engine 'InnoDB' (localhost)

    ' in /home/leadwerk/public_html/wiki/includes/db/Database.php:606

    Stack trace:

    #0 /home/leadwerk/public_html/wiki/includes/db/Database.php(561): Database->reportQueryError('Unknown storage...', 1286, 'SELECT page_ti...', 'MessageCache::l...', false)

    #1 /home/leadwerk/public_html/wiki/includes/db/Database.php(969): Database->query('SELECT page_ti...', 'MessageCache::l...')

    #2 /home/leadwerk/public_html/wiki/includes/MessageCache.php(329): Database->select('page', 'page_title', Array, 'MessageCache::l...')

    #3 /home/leadwerk/public_html/wiki/includes/MessageCache.php(264): MessageCache->loadFromDB('en')

    #4 /home/leadwerk/public_html/wiki/includes/MessageCache.php(606): MessageCache->load('en')

    #5 /home/leadwerk/public_html/wiki/includes/MessageCache.php(543): MessageCache->getMsgFromNamespace('Databaseerror', 'en')

    #6 /home/leadwerk/public_html/wiki/includes/GlobalFunctions.php(467): MessageCache->get('databaseerror', true, false)

    #7 /home/leadwerk/public_html/wiki/includes/GlobalFunctions.php(432): wfMsgGetKey('databaseerror', true, false, true)

    #8 /home/leadwerk/public_html/wiki/includes/Exception.php(70): wfMsgReal('databaseerror', Array)

    #9 /home/leadwerk/public_html/wiki/includes/db/Database.php(2565): MWException->msg('databaseerror', 'Database error')

    #10 /home/leadwerk/public_html/wiki/includes/Exception.php(192): DBQueryError->getPageTitle()

    #11 /home/leadwerk/public_html/wiki/includes/Exception.php(155): MWException->htmlHeader()

    #12 /home/leadwerk/public_html/wiki/includes/Exception.php(174): MWException->reportHTML()

    #13 /home/leadwerk/public_html/wiki/includes/Exception.php(260): MWException->report()

    #14 /home/leadwerk/public_html/wiki/includes/Exception.php(294): wfReportException(Object(DBQueryError))

    #15 [internal function]: wfExceptionHandler(Object(DBQueryError))

    #16 {main}

     

     

  3. There are tons of approaches to make inheritance in Lua.

     

    First of all you need to decide - "do you really need inheritance?" Or you just need similar behave for group of objects?

     

    In Lua you can override properties and methods of objects "on the fly". And you don't need "polymorphism" because Lua has no types in common and you don't have to deal with type-casting.

     

    The easiest way (IMO) to create similar-behave objects - to make factory-functions for each type of objects.

     

    
    

    function CreateInventoryItem(picture, weight)

    local obj = {}

    obj.picture = picture

    obj.weight = weight

     

    return obj

    end

     

    function CreateGunItem(picture, weight, damage)

    local obj = CreateInventoryItem(picture, weight)

    obj.damage = damage

     

    return obj

    end

    • Upvote 2
  4. So we can conclude that LE2 is very fast engine but nobody (except couple of people and may be Josh) can use it properly to rich decent FPS and nice picture. It's very very tricky, I know.

     

    That's why we can't see tons of games created with LE2. So will this situation repeat with LE3? May be to have a good engine is not enough?

     

    Josh, did you consider ways to teach people use your engine(s) properly? And teach them to make decent games with engine? I know, you are a programmer and not a teacher. But think about it.

     

    You teach people -> They make many decent games with LE -> More people see it -> More people buy LE

    • Upvote 1
  5. As Red October already said, dynamic light eat a lot of FPS especially for complex scene with many point light sources (we experienced that in our project). Besides, dynamic light sources have strong limitations (light radius, shadow distance etc.).

     

    Thus for best performance:

    - bake as much as you can

    - use as little light sources as possible

    • Upvote 1
  6. I did something similar for waypoints.

    Video:

     

     

    But it's not a ring actually (it's a 12 connected lines). It's not for selected entity (only for newly created or moved entity). It's for only one entity class (so it works not for all entities on the scene). And it's hiding automatically after some period of time.

     

    Code example (for entity-attached lua-script):

     

    
    

    local class=CreateClass(...)

     

    function class:CreateObject(model)

    local object=self.super:CreateObject(model)

     

    function object:Init()

    self.show_markers = 0

     

    AddHook("Flip", object.Render)

    end

     

    function object:Render()

    if object.show_markers > 0 then

    SetColor(Vec4(1, 1, 0.5, 1))

    local pos = EntityPosition(object.model, 1)

    local range = 5

     

    for i = 1, 12 do

    local angle = math.rad((i - 1) * 30)

    local dx = math.cos(angle) * range

    local dz = math.sin(angle) * range

    local pos1 = CameraUnproject(fw.main.camera, Vec3(pos.x + dx, pos.y, pos.z + dz))

    angle = math.rad(i * 30)

    dx = math.cos(angle) * range

    dz = math.sin(angle) * range

    local pos2 = CameraUnproject(fw.main.camera, Vec3(pos.x + dx, pos.y, pos.z + dz))

     

    if pos1.z >= 0 and pos2.z >= 0 then

    DrawLine(pos1.x, pos1.y, pos2.x, pos2.y)

    end

    end

    end

     

    SetColor(Vec4(1, 1, 1, 1))

    end

     

    function object:ReceiveMessage(message,extra)

    local values=string.Explode(message,",")

    local command = values[1]

    if command == "hide_markers" then

    self.show_markers = 0

    end

    end

     

    function object:ShowMarkers()

    self.show_markers = os.clock () + 1

    SendEntityMessage(self.model, "hide_markers", nil, 1000)

    end

     

    function object:UpdateMatrix()

    self:ShowMarkers()

    end

     

    function object:UnlockKeys()

    self:ShowMarkers()

    end

     

    function object:Free(model)

    RemoveHook("Flip", object.Render)

    self.super:Free()

    end

     

    object:Init()

    end

     

     

    • Upvote 1
  7. Because KeyDown() means you are holding pressed key.

     

    Let assume you are holding key "A".

     

    After line

    if (KeyDown(KEY_A)){sequence = 2;} else sequence = 1;

    variable "sequence" will have value 2.

     

    But after line

    if (KeyDown(KEY_D)){sequence = 2;} else sequence = 1;

    variable "sequence" will have value 1.

     

    Because you are not holding "D" key pressed.

    • Upvote 1
  8. Yes. It should work. You could hide preloaded entities or move them far away. But if you don't render the scene while loading it's not necessary.

     

    I think it will be better to turn physics off for that preloaded entities to avoid collisions between them.

  9. How do I check collision speed?

    I don't know if you can check collisions for character controller or not. But you could measure it's speed with GetBodyVelocity() and check for difference from previous frame.

×
×
  • Create New...