Code Monkey home page Code Monkey logo

Comments (16)

8bitskull avatar 8bitskull commented on May 16, 2024 1

Good luck! Please don't rush on my account, the demo performs adequately and full release is many weeks away.

Regardless, I look forward to seeing the result!

from daabbcc.

8bitskull avatar 8bitskull commented on May 16, 2024 1

Excellent work @selimanac , thank you very much. Will let you know if I encounter any issues.

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

Yes this could be very very useful a specially on performance side.
But as far as I know it is not possible to pass gameobject instance to C yet:
https://forum.defold.com/t/defold-1-2-181-has-been-released/68048/22?u=selimanac

from daabbcc.

8bitskull avatar 8bitskull commented on May 16, 2024

Good news, I asked JCash and he says it is implemented:

https://defold.com/ref/stable/dmGameObject/#GetPosition:instance

Is this what is needed?

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

Not sure. I guess this is only for GameObject which is created on C side.
If we are able to pass dmGameObject::HInstance from Defold(lua) to C then yes. I had a quick review on API docs and cant find anything related to getting instance. Maybe I am missing...

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

There is GetInstanceFromIdentifieron gameobject.h but looks like it is not documented. This might be it.
https://github.com/defold/defold/blob/dev/engine/gameobject/src/dmsdk/gameobject/gameobject.h#L545

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

It is not documented but looks like it is what we are looking for. There is a test for it:
https://github.com/defold/defold/blob/72266d8c039f5b91c7aba7cbecb8b15a75bfd577/engine/gameobject/src/gameobject/test/collection/test_gameobject_collection.cpp#L207

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

@8bitskull are you still using this on Void Scrappers? If so and you got time, I'm going to test this. Since it is not a released function I can't promise for making it work.

from daabbcc.

8bitskull avatar 8bitskull commented on May 16, 2024

@8bitskull are you still using this on Void Scrappers? If so and you got time, I'm going to test this. Since it is not a released function I can't promise for making it work.

Yes I am, will gladly help in testing.

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

@8bitskull Ok. Then please give me a few days. I got a project release this week. I'm going to try to figure this out as soon as possible.

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

@8bitskull +also maybe I can prepare a much more custom version for the game. Which doesn't require checking collision on every frame(maybe just using callback). I can't promise, but I want to contribute on this if I had time.

from daabbcc.

8bitskull avatar 8bitskull commented on May 16, 2024

Thank you very much @selimanac. I have managed to create a pretty good system by batching updates, so I think a custom version of the extension is not quite necessary. The extension itself is already massively useful - if you manage to implement the two issues I have raised it will be even more so and I will be able to use it in lots of future projects I have in mind as well!

...Well, we'll see how the game performs when I try to port it to Switch. But I think it will be my code that is the bottleneck, not this extension.

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

@8bitskull I figure that out and it is possible to get position from C now. But require a more work on extension side. I will had to keep all the go instances, get their positions and maybe trigger a callback. This is going to be quite big change on the internals. I hope I can manage it on the next week.

I am planning to use callbacks because it will save a lots of performance. Not just for your project but every other projects...

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

@8bitskull Update: unfortunately I couldn't work on this last week. But I started today. My initial plan was the re-wrote the all thing but it seem like it's gonna take a long time. So I decided to go with a patch. We will have to do a lots of test :)

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

@8bitskull Update: Almost ready for testing. Since I made a lots of critical changes I want to test it as much as I can. I'm going to build a simple game to see if everything works fine before send it to you. It is going to take a few more days I presume.

from daabbcc.

selimanac avatar selimanac commented on May 16, 2024

Hi @8bitskull ,
I think it is ready now. I made a small game by using new version and new functions.
I did try to test every possible scenario as much as I can think of. It seems pretty stable.

I'll wait until you have been test this and when everything is fine then I'm going to release a build. It is here for now:
https://github.com/selimanac/DAABBCC/archive/refs/heads/v2.1.zip

There are two major functions related to Gameobjects:

  • aabb.insert_gameobject(group_id, url, w, h)
local go_url = msg.url("/go")
local w = 50
local h = 50

local aabb_id = aabb.insert_gameobject(enemy_group, go_url, w, h)
  • aabb.remove_gameobject(group_id, aabb_id)

This is the recomended way of removing Gameobject and its AABB.
But also it is safe to use aabb.remove, it is going to search and remove any Gameobject related to group id and proxy id.

These are pretty straight forward but you can check out the example project which I just develop if you need to. Also updated the example on this repo:
https://github.com/selimanac/space-shooter-daabbcc

There is two new more functions:

  • aabb.run(boolean) It is for stop/resume Gameobject iteration(get/set position) on update. It might be useful when pausing game. It might not effect much but give your frame/cpu a more time.
  • aabb.clear() is for cleaning everything(Groups, proxies, gameobjects). It is best to use it when collection is unloaded(when game is over and game collection is unloaded).

There is more on release notes.

I'm going to close this issue. Feel free to open new one...

from daabbcc.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.