Jump to content
  • Advertisement

Tim Leijten

Member
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Tim Leijten

  • Rank
    Member

Personal Information

  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Tim Leijten

    Game Engine API, smart pointers or not?

    That's even better than what I came up with! One issue though, if the user requests a pointer from a handle, do you then search through the entire scene for that one object wit the correct handle? Isn't a table faster? Okay. I'll go with smart pointers. Once memory becomes an issue, I might write my own library. But currently I don't think it's needed yet. Thanks for the tip though!
  2. Tim Leijten

    Game Engine API, smart pointers or not?

    So you reccommend just using a weak_ptr instead?(Makes things quite a bit easier)
  3. Tim Leijten

    Game Engine API, smart pointers or not?

    Okay, I'll look into it for a bit, see if I understand it. But I just thought of another solution to my problem, what if I use both handles and raw pointers, but in a different way? What I mean is, all functions return raw pointers and all game api functionality uses raw pointers, BUT, I make a function e.g. createHandleFromPointer, that will turn a pointer into a handle. And then having a function to get a pointer back from that handle. So createHandleFromPointer would add the pointer to a table, and then whenever an object get's deleted, that object will remove itself from the table. and then when you try to get a pointer from the handle, it will just return 0 because the pointer isn't in the table anymore. Does that sound like a possible solution or is it flawed? Edit: Is it safe to assume the destructor of an object will always be called? Or are there cases where it wont be called?
  4. Tim Leijten

    Game Engine API, smart pointers or not?

    Well, I don't know how to write a heap implementation or custom allocator. So I'm going to leave that for later.
  5. Tim Leijten

    Game Engine API, smart pointers or not?

    Why do I need a custom allocator? What for? I don't really get the fragmentation thing.
  6. Tim Leijten

    Game Engine API, smart pointers or not?

    The reason I don't like them is because I have to do something like getObjectPointer(handle); when I want to communicate with the class. I think that looks pretty ugly. Also, I don't like that with handles, it becomes harder for the user to create GameObjects themself and add them to the engine.
  7. Tim Leijten

    Game Engine API, smart pointers or not?

    Okay, sorry. I didn't realize.
  8. Tim Leijten

    Game Engine API, smart pointers or not?

    No no. I wasn't trying to be mean. It's just something I notice in general, both here and on reddit, people expect that if something changes it must be another thread. Which I find interesting.
  9. Tim Leijten

    Game Engine API, smart pointers or not?

    Thanks for your reply! I agree weak_ptr is the best choice. Just wasn't sure. This is my first game engine and I don't have much experience with C++ yet, so I don't want to make it too hard for myself. I might do my own reference counting at some point, but not yet.(I don't even have an idea how I would do that.)
  10. Tim Leijten

    Game Engine API, smart pointers or not?

    E.g. something a player does causes the object to delete itself. Why does everyone think it has something to do with threading? It's posible, but I don't think it's needed because in general, the pointer never changes unless you delete it. But I'll keep it in mind. I agree it's best to have one owner, and it would work for me I think, but there is unfortunately no way to check if a pointer is valid. Making it a bit harder to do. Handles aren't a bad idea, I just don't like to have my game code cluttered with handles and getPointerByHandle's. And even worse would be switching the entire engine to handles.(I wouldn't have access to classes) So I think I'm just going to take the smart pointer route where needed. Thanks for all your help!
  11. Tim Leijten

    Game Engine API, smart pointers or not?

    No. I don't use threads. If obj A creates obj B and stores a pointer to it.(E.g. to get the position or communicate something else). The because of some player action, obj B is deleted. Now obj A has an invalid pointer. So obviously I want there to be a way for A to check if B exists. E.g. a weak_ptr. Anothrr solution would be a messaging system or a table containing all valid GameObjects(and then check if the pointer is in there), but that's waayyy more work than using a weak_ptr. I'm not a fan of handles as it doesn't play well with oop. I would prefer going the pointer route. So you are saying shared and weak ptr's are ok when needed. And I should use raw ptr when possible?
  12. Hi, I'm writing a game engine, when my API returns a pointer, most of the time it is meant to be used and then discarded right away. But I have some things where it might be useful to store the pointer. E.g. addNewGameObjectToScene. It would create a new object, add it to the scene, and return a pointer. But there is one obvious problem, there is no way to check if the returned pointer is valid. Because the newly created object could be deleted at any point, and then the pointer is invalid and using it would cause crashes. Therefore, to me it would make sense to use smart_pointers to fix that. But have found that not everyone agree's with me on that.(And I personally don't like to use smart pointers in api if I can avoid it) So what do you guys think? If I should use raw pointers, how would I fix the issue, and if I should use smart pointers, will it impact performance or drive people away from using my api? Thanks!
  13. Hello everyone! I have been developing a Game Engine with Editor for a few months now, and need a good license for it. I have been thinking and doing research for a while, and found 2 options which I think are best: One option is the MIT license, it's as open as it gets, gives users a lot of freedom, but doesn't give me a lot of freedom. E.g. What if someone takes my Engine and Editor, improves it, then sells it without releasing the source or under another license? That all that work might be for nothing, because someone else now has the same product with more features. But an upside of the MIT license is that it allows users to tweak it as they see fit, and it draws more users to my Engine and Editor. Another option is the Mozilla license, from what I've read it's similiar to LGPL/GPL, but doesn't require you to have a separate Engine(exe) and Game(so/dll) binary. The Mozilla requires someone else to contribute back to my project hen they modify something(I believe), which means they can't just run of with my Engine and Editor and sell it, because the exact source is already available for free. The downside to this though is that it might be too restrictive for people and drive people away(also because it's less known). So the trouble I'm having is, I don't know which one to choose. I'm not a lawyer and I don't know much about it. I also don't have the money to hire one. So I here have a list of questions I hope you guys can answer: Does the Mozilla license require every change made to the Engine/Editor by someone to be contributed back to the Engine/Editor? So let's say the Editor has a blue theme, and someone doesn't like it. He then forks or clones it and changes the colors to a grey theme. Is he now required to submit those changes back? Or is he just required to publish them in his own repository? Does the Mozilla license require someone to contribute back at all? I mean, does it mean they have to contribute directly to my project, or does it just mean they have to publish their changes in a repository? Can someone clone my source code and change the license? And can I do that with my own source? Can the Editor and Engine be Mozilla/MIT licensed, and the Game be licensed differently? Can someone just take my source with the Mozilla license and change the name, improve it, and keep it in a separate repository?(Not contributing back to me) Will the Mozilla license drive people away? Is the Mozilla license well known? What are some Game Engines with it? Am I required to publish the source with either the MIT or Mozilla license? Would you personally use a game engine and editor that uses a Mozilla license?(If you needed one) Anything else important I might have forgotten? What are some other downsides to the Licenses I forgot? Thanks!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!