Olof Larsson

  • Content count

  • Joined

  • Last visited

Community Reputation

99 Neutral

About Olof Larsson

  • Rank
  1. Component manager design

    I do not have the answer to your question but this is the best article I ever found on component based game design: [url="http://gameprogrammingpatterns.com/component.html"]http://gameprogrammingpatterns.com/component.html[/url] When deciding how to use use pointers wouldn't the most important questions to answer be: [b]How will communication between components work?[/b] (Because in reality the componets will need to communicate with other components as well as the entity they belong to even if this shouldn't be necessary in the best of worlds.) and [b]Will you maintain some sort of index / structure of arrays?[/b] The article mentions a structure of arrays pattern and there will be even more pointers involved there. I suggest the following (possibly insane) "Gang of Four strategy pattern" approach because I use it in javascript programming: * The entity contains pointers to it's components. * The components only contains state and no logic. * The components does NOT have a pointer to the entity they belong to. * The logic is executed by subsystems. * A subsystems handles all entities which has a certain component type and you use an index aka strucuture of arrays to be able to find those entities fast. Read more on that approach in my article here: [url="http://jsteam.org/component-based-entities/"]http://jsteam.org/component-based-entities/[/url] Would such an approach work in C++? If you decide to not use a "Gang of Four strategy pattern" approach and keep the logic as well as the state in the component you could do it like this: * The entity contains pointers to it's components. * The component contains a pointer to the entity it belongs to. * The components contains both state and logic. * Use one of the many suggestions for communication between components mentioned in this article: [url="http://gameprogrammingpatterns.com/component.html"]http://gameprogrammingpatterns.com/component.html[/url] * You have index aka strucuture of arrays to be able to find all components of a certain type fast.
  2. Unity Full script based game engine

    [quote name='Bow_vernon' timestamp='1306992782' post='4818531'] I mean the one that handle input processing in the script too. I heard about unity and udk. But I dunno how they work/if they handle input in script. I want to know if there's an engine where making games is just a matter of writing scripts and run the .exe file. Do you know any such engine? [/quote] Have you tried coding JS / HTML5 games? Using javascript and the canvas? The engine would be your webbrowser I'm totally in to js games at the moment. There are some performance issues but for small games that is not a problem.
  3. I know this thread is a year old now but I'm so glad to find it . It is kinda hard to find info on component based game design in javascript. Are you still coding js-games? [b]Should we code something together?[/b] I made this "game" using a component based approach: [b][url="http://game.sylt.nu/example"]http://game.sylt.nu/example[/url][/b] Use arrow-keys or wasd. Change zoom using scroll-wheel. My component based approach is quiet different from the one in your asteroids game. [b]I wrote an article on it: [url="http://jsteam.org/component-based-entities/"]http://jsteam.org/co...based-entities/[/url][/b] [b] Is my approach even component based?[/b] I have no logic in the components. Only state. What I find being awesome about this is that there are much fewer references between components and entities (none at all actually). The subsystems contains all the logic and works on an entity (as opposed to a component) and thus the problem of communication between components disappears. What do you think about my approach [b]I could really use some feedback[/b]
  4. [web] JavaScript game loop

    [quote name='capn_midnight' timestamp='1281958174' post='579738']I'm not happy with the performance of setInterval (or its retarded brother, setTimeout) and was wondering if y'all knew of a better way.[/quote] No you must either use setTimout or setInterval. I would actually recommend you to use setTimeout because setInterval will stack the function calls if the game logic takes longer time to execute than the interval.. I just wrote a quiet in depth article on gameloops for javascript HTML5 games. Read it all here: [url="http://jsteam.org/?p=6"]http://jsteam.org?p=6[/url] You could use the class in the end of that article. I MIT licensed it.