• Content count

  • Joined

  • Last visited

Community Reputation

202 Neutral

About Pieisgood

  • Rank
  1. Hey, I'm building an SDL2 + Opengl 3.x GUI system that uses HTML. Something I'd like to do is create a library or a dll in order to make it easy for people to use my software without having to push all my .h and .cpp files into their code base.    https://github.com/pieisgood/SDL2-GUI   This is the code (there's lots of things I need to work on... memory management, using smart-pointers instead of the pointers I do use ect. ) I'm in the process of building out a subset of html elements and adding css for the box model and other styling considerations.    I'm working in VS2012, can any one teach me how to create this into a library? Also any other advice would be nice... but it is currently a bit hard to understand in the code.     For those that want to know how it should work: The user of this system will create a GUIFactory. Use the factory to create a GUIManager by handing the factory an HTML/XML file Then pass SDL2 events to the GUIManager and call the managers draw function. To change properties of elements, I will be making an interface similar to the javascript DOM ... where you select an element or set of elements by id and then change or add properties to them. This will allow people to use the system for slightly dynamic user interfaces (such as updating points for a game). In order to render a different page, you will need to create another manager with the factory and call its draw and event functions instead (any suggestions for improving this would be appreciated).   Thanks a lot in advance.
  2. Cache Model Critique

    I've been thinking about memory access patterns and thought about a small model to represent cache oblivious memory layouts.   Def: A Computer has several levels of cache. We represent the set of caches as C   C = { c1, c2, c3, ... , cn } where cn is the n-th cache level of the computer.    Computer caches, we assume, follow two basic principles.   1: Memory sizes for each cache increases monotonically.    size-1 < size-2 < size-3 < ... < size-n   2: Cache access times also increase monotonically.   time-1 < time-2 < time-3 < ... < time-n   Given this definition of a cache and it's access principles, we define access patterns as a directed acyclic graph.    Each node in the graph lists the cache level accessed.    We then use the graph as a probabilistic graph with which to base to the expected access times for running our algorithm.     Has anyone ever worked with a similar model or abstraction? Can you tear this apart and tell me what's wrong or could be improved?
  3. That's another three to look up. Awesome. Also good to know, I'm starting to understand the framing here. It seems that not having cache misses is a serious issue.   Also, it opens my eyes a bit as to why a previous c++ program I wrote was super slow. It did matrix multiplication of markov chain matrices... it took SUPER long to compute. When I wrote the same thing in MATLAB it was incredibly fast. I can only assume this is because MATLAB matrix multiplication has way less cache misses, they do perform sparse matrix checks and calculations, but after the third iteration it should have been non-sparse... and it was still incredibly fast. Anyway, good information to have here.   http://penguin.ewu.edu/~trolfe/MatMult/MatOpt.html
  4. The way I understand this type of actor component system is to have a map structure that accepts the string name of the component type and then accesses a factory function to return a new instance of that component (with specified parameters).    So you would have a base type of "Component" and all your components would derive from this single type. Now you don't need to work with templates. Then your map would look like map< String, Component> This way you could just access them in your factory with some sort of function that only accepted a string. Component* createComponent(string jsonString){ Component *comp = new map[jsonString.name]; //... extra stuff goes here for each different component return comp; // return a pointer the a component and not the exact type of component }
  5. Data driven design IS engine design. Going as far back to Game Programming Gems 1 - Chapter 1 we can see that this has been a general goal in game development.    Also, inline function size is something else that you need to look out for in cache management.    While I'm not looking to write for the PS3, it's a nice example of the cost. It also seems like a good time to revisit memory management as whole new strategies are going to start cropping up on the PS4 and XBONE since they both have the homogeneous AMD cores.
  6. Thanks Hodgman, I certainly wasn't thinking of locality.  My code so far has three unique allocation strategies, and I was looking to expand that. The scope stack allocation I'm looking into now.    I'm glad I wasn't on some sort of crazy train here. I figure creating memory management up-front is sort of a safety net, like unit testing.    Also, is locality as much of an issue on hardware that supports virtual memory? Does that cost really add up on windows, linux and OSX?
  7. Memory managers can be pretty specific for particular games, sure. But, general memory management techniques and classes can at least be discussed.   When building a piece of software as general and large as a game engine; I think it's best practice to have a series of memory management, assert, and new/delete overloads and classes. For example, when building your software it's nice to know how memory is being allocated even before you begin writing specific game code. Like storing vertices, normals, UVs ect... it's nice to know through testing that you aren't having memory fragmentation so that you don't need to find this out later when you're actually running the game.   But I'm also just wondering if there's any type of memory management techniques you guys have seen come in handy. Like has there been a situation where organizing or monitoring memory has been critical to improving your game and allowed you to avoid cache misses.. ect. 
  8. Hey guys,    I've been building a series of memory management classes for a small game engine. I currently have a memory pool class, stack allocator class, double buffer allocator, and a series of overloaded new and delete operators to handle memory dumps.    Do you guys have any suggestions for other classes or techniques that would be good to use for memory management? I'm thinking about wrapping this portion of the code up and releasing it on github but I want to be sure it's not lacking critical functionality or structural classes.
  9. Is GLM fast enough for games?

      Yeah, but when talking about vector math operations I don't think anyone has ever complained that it was "too fast".   Take into consideration that this engine would want to push polys at around the One hundred thousand to million range.
  10. I'd suggest creating a factory for your game objects and a destructor function. So when your player leaves an area and you don't want to keep those objects in memory you call your objects destructor function which will then write data about it's private members (location, speed, yada yada) into a text file in a nice format (json, xml, your own). Then when your player re-enters that area, you create a new object with your factory and have it instantiate the private members with the data that was saved to the text file. This has an added benefit of easily extending to other types of files... like a save game file.    Hope that helps.
  11. Where do I go from here?

    I'd suggest you start solving problems at projecteuler.net . Once you've solved a hand full of problems and feel more comfortable with pointers and references and such, I'd suggest working on understanding classes and algorithms in a deeper way. This requires two things, ONE : Learn about design patterns, how they work and what they are as soon as possible. Design patterns are the difference between making small functions and creating larger software. TWO: Learn Data Structures. Data structures are all about improving speed and decomposing problems into smaller ones.    From there you'll want to test out writing a small game using SDL or SFML. Either of these libraries do A TON of the work for you. These will provide system time, ability to draw to the screen and other capabilities. Once you've completed or done a little something there you'll have probably learned enough to know where to go from there.   GOOD LUCK!   - Also... go learn rigorous mathematics (proofs) it'll make other types of math seem easier.
  12. Is GLM fast enough for games?

    So I'm starting work on a little game engine with a friend of mine. As of now I'm tasked with the graphics side of things. I am willing and able to write the proper vector, matrix and quaternion classes with SIMD/SSE but GLM seems attractive.    What I would like to know is, is GLM fast? fast enough for a simple game? Are there benchmarks to compare it with someones native code?   Obviously if it's fast it might just be advantageous to use GLM instead of writing and debugging my own stuff. Another question is, would there be compatibility or speed issues using GLM with Direct3D?     Thanks a ton.