Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

176 Neutral

About AgustinAlvarez

  • Rank

Recent Profile Visitors

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

  1. Te amo hermoso! que tengas un bello día hoy ^^
  2. Te amo demasiadooo hermoso
  3. Te amo demasiado novio hermosooo
  4. AgustinAlvarez

    Optimization of a method

    You could implement the voxel storage as a tree, each leaf is connected another leaf, only if that block is adjacent. Then when you add or remove block dynamic you could just go the the leaf where the near block is at and attach it or just add a new leaf if it doesn't have adjacent blocks. You could also use divide and conquer and divide those chunks in small pieces and calculate them parallel. The method it self can be optimized if you pre-cache the position   if (cube.World.Translation.Z + 0.5f != adjacentCube.World.Translation.Z - 0.5f) { cubeToDraw.Add(cube);   break; } if (cube.World.Translation.Z - 0.5f != adjacentCube.World.Translation.Z + 0.5f) { cubeToDraw.Add(cube);   break; } auto bZ1 = cube.World.Translation.Z - 0.5f; auto bZ2 = cube.World.Translation.Z + 0.5f; auto cZ1 = adjacentCube.World.Translation.Z - 0.5f; auto cZ2 = adjacentCube.World.Translation.Z + 0.5f; if (bZ1 != cZ2 || bZ2 != cZ1 || ....) cubeToDraw.add(cube) But like Batterius said, its the design rather than the method.
  5. AgustinAlvarez

    Component based system

    Your library seems very well designed, i will take a look at it :). Thanks everybody!
  6. Hello, so i'm designing a entity component based system for my engine (Based of Artemis design). Most of the example code i watched, has static containers and static stuff. My question is, is that a good idea?, my design is an hybrid approach of both dynamic and static implementation since i can add and remove system from my plugins dynamic. My current design is: Component   -> isActive(), setActive(bool) [this is when the entity owner is sleeping]   -> isValid(), setInvalid()         [When the entity owner removes the component or the entity is destroyed]   -> getId()                              [ID of the component class] Componentable<T> : Component   -> static ID                            [This is for mapping]   -> Component::m_Id = typeid(T).hash_code() [Get ID of the class at compile time] ComponentCollection<T>   -> addComponent, getComponents, disposeComponent [Store contiguous each component of the same type] for CPU cache. ComponentManager (Map ComponentID To ComponentCollection)   -> addCollection<T>           [Add a collection of components into a map]   -> getCollection<T>            [Get a collection of components from a map] ComponentHolder   -> addComponent<T>, getComponent<T>, hasComponent<T>, invalid(), removeComponent<T>   -> Holders contain a pointer to the components owned.   System<T>   -> Logic part of the component   -> Iterate over each component of the same type, those components invalidated will be removed from the collection, and those sleeping       will not be executed. SystemManager   -> Contains every system registered World   -> Contains a system manager and creates an entity (Component holder + ID) How it works?   struct LifeManaComponent : Componentable<LifeManaComponent> { uint32_t m_Life, m_Mana; }; struct DefenseComponent : Componentable<DefenseComponent> { uint32_t m_Defense, m_Attack, m_RecvDamage; } class AttackSystem : public System<LifeManaComponent, DefenseComponent> { void OnExecute(Entity & entity) { .... } }; //////////////////////////////////////////////// Code ///////////////////////////////////////////////////////////////// World->AddComponentCollection<LifeManaComponent>(); World->AddComponentCollection<DefenseComponent>(); World->AddSystem<AttackSystem>(); auto & pHolder = World->CreateEntity(); pHolder.addComponent<LifeManaComponent>(30 /* Life */, 0 /* Mana */); pHolder.addComponent<DefenseComponent>(0, 0, 0); // Now the entity will be eligable for attackSystem. pHolder.hasComponent<LifeManaComponent>(); // Return true pHolder.getComponent<LifeManaComponent>(); // Return attack component reference. pHolder.invalidate(); // Invalid all components World->RemoveSystem<AttackSystem(); World->RemoveComponentCollection<DefenseComponent>(); UPDATE: CODE
  7. AgustinAlvarez

    A retro journey.

    Hello, my name is Agustin and i'm a 23 year old programmer who likes video games. My first video game was at the age of 5, and if I remember correctly was Master of Magic; a fantasy turn based strategy that I love. I found my call at the age of 11 when I coded my first line of code for an open source mmorpg game, using Visual Basic. Since that day I had been coding and learning a lot about video games and how to make them. So I decided to start my own personal journey and do what I like the most, code from ground all those games that I loved for all these years, not just for me, but for all those people that feel the same. My vision is to extend them all, using technology that wasn't at that time, that would make them a piece of art.   To be able to extend them, i'm currently coding a C++ modding platform, that will allow to mod each one of them, not just for me, but for all those people that wants to add their own assets to the games. The engine is called Ghrum and that is why i'm here today. The engine can be found Here.   Planned Games: Dune 2 Master of Magic X-Com Apocalypse ... More games to come.   If you love those games like I do, please leave a message and if you want to help me in my journey, please write me to wolftein1@gmail.com. Thank you for taking the time to read this.
  8. AgustinAlvarez

    A Resource manager design.

      Thank you, that gave me a lots of ideas on how could i improve my design.
  9. AgustinAlvarez

    implementing scripting

    I just knew about Runtime Compiled C++ and must say, wow, amazing idea.
  10. AgustinAlvarez

    This beauty...

    Who ever coded that doesn't know what "funroll-all-loops" is :P and tried to achieve same result by hand.
  11. Hello!, i'm trying to design my own resource/asset manager for my own game engine. I would like feedbacks or any opinion on how may i improve it. The design is: IResourceLocator: A class that represent a place where to look for the files. Examples: FileLocator, ZipLocator, UrlLocator. Code: https://github.com/Ghrum/Ghrum/blob/master/include/Resource/IResourceLocator.hpp Example Code: https://github.com/Ghrum/Ghrum/blob/master/include/Resource/Locator/File/FileResourceLocator.hpp IResourceLoader: A class that define how an resource is loaded. Examples: ImageLoader, AudioMP3Loader, AudioOGGLoader. Code: https://github.com/Ghrum/Ghrum/blob/master/include/Resource/IResourceLoader.hpp IResourceCache: A class that define how is the resource stored. Example: WeakReferenceCache, ContignousMemoryCache. Code: https://github.com/Ghrum/Ghrum/blob/master/include/Resource/IResourceCache.hpp And finally the resource manager that keeps track of every IResourceLocator, IResourceLoader and IResourceCache. Each module is comunicated using a ResourceKey that contain the name and file of the resource. Code: https://github.com/Ghrum/Ghrum/blob/master/include/Resource/IResourceManager.hpp An example of usage: void onInitialization(IResourceManager & manager) { manager.registerLocator<FileLocator>("." + PATH_SEPARATOR + "cache"); manager.registerLocator<ZipLocator>("." + PATH_SEPARATOR + "data" + PATH_SEPARATOR + "textures.zip"); manager.registerLoader<ImageLocator>("png", "jpg", "jpeg"); } void onSomethingElse(IResourceManager & manager) { auto & resource = manager.getResource<Image>("texture.png"); } Any feedback or tip will be appreciated.
  12. AgustinAlvarez

    Grounded Pointers

    Good articles :)
  13. Muchos caen, pero pocos resurgen de las cenizas como un fénix resplandeciente en su máxima expresión.
  14. AgustinAlvarez

    Separating API specific code from the rest of the framework

    You should separate implementation from interface. DirectX and OpenGL are implementation so should be in a file named like GLVertexBuffer, DXVertexBuffer or simple as GLMesh, DXMesh, etc. That allows you to create an attachable library, you could add dx or opengl shared library at runtime. The only downside is that interfaces will produce vtables, but thats not a big deal. A can give you an example of how i do it: (Interface) https://github.com/Ghrum/Ghrum/blob/master/include/Event/IEventManager.hpp (Implementation) https://github.com/Ghrum/Ghrum/blob/master/include/Event/EventManager.hpp  
  15. Hi, i'm trying to render at the center of the screen, being 0,0 at the top-left. What i'm doing wrong here? public World(int numRow, int numCol) { this.tiles = new Tile[numRow][numCol]; this.centerViewRow = numRow * 0.5f; this.centerViewCol = numCol * 0.5f; } protected void setViewport(float width, float height) { this.viewport.x = width; this.viewport.y = height; // Set the new viewport of the world this.modelViewRow = (viewport.y / WorldManager.TILE_HEIGHT); this.modelViewCol = (viewport.x / WorldManager.TILE_WIDTH); } private void calculateWorldBounds() { // Find the tiles we should render. We are doing pre cull phase here, // we're not going to render all the map because it will be ineficient. tileMinRow = (int) Math.max(0, centerViewRow - modelViewRow); tileMaxRow = (int) Math.min(centerViewRow + modelViewRow, tiles.length); tileMinCol = (int) Math.max(0, centerViewCol - modelViewCol); tileMaxCol = (int) Math.min(centerViewCol + modelViewCol, tiles[0].length); // Calculate from where the screen we are going to start drawing. This // is because we have a centered view over a point renderRowPos = (viewport.y * 0.5f) + WorldManager.TILE_HEIGHT; renderRowPos += ((centerViewRow - tileMinRow) * WorldManager.TILE_HEIGHT); renderColPos = (viewport.x * 0.5f); renderColPos -= ((centerViewCol - tileMinCol) * WorldManager.TILE_HALF_WIDTH); maxBoundaryY = renderRowPos + WorldManager.TILE_HALF_HEIGHT; minBoundaryY = renderRowPos - (tileMaxRow - tileMinRow) * WorldManager.TILE_HEIGHT - WorldManager.TILE_HALF_HEIGHT; minBoundaryX = renderColPos - (tileMaxCol - tileMinCol) * WorldManager.TILE_HALF_WIDTH; maxBoundaryX = renderColPos + (tileMaxCol - tileMinCol) * WorldManager.TILE_HALF_WIDTH; } private void renderWorldTiles(Renderer2D renderer, float deltaTime) { // Current rendering variables float currentScreenRow = renderRowPos; float currentScreenCol = renderColPos; // Loop though all the rows (X) for (int x = tileMinRow; x < tileMaxRow; x++) { // Make the absolute diamond shape coordinates currentScreenRow = (renderRowPos - (x - tileMinRow) * WorldManager.TILE_HALF_HEIGHT); currentScreenCol = (renderColPos - (x - tileMinRow) * WorldManager.TILE_HALF_WIDTH); // Loop though all the columns (Y) for (int y = tileMinCol; y < tileMaxCol; y++) { // Render the tile if it's valid. if (tiles[x][y] != null) { tiles[x][y].render(renderer, deltaTime, currentScreenCol + scrollCol, currentScreenRow + scrollRow); } // Make the diamond shape currentScreenCol += WorldManager.TILE_HALF_WIDTH; currentScreenRow -= WorldManager.TILE_HALF_HEIGHT; } } }
  • 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!