• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Francisco Tufr
      Hi everyone! I'm currently working on a series of books about 2D Shader Development.

      The idea is to synthesize a bunch of techniques that are specifically useful for 2D, even if they work on 3D as well.

      I released the first book last week. It's 4.99 on Amazon or free on the series website, https://www.2dshaders.com

      This is an independent initiative, I don't work for any publisher whatsoever. The contents of the books are the result of a 4-year span where I started teaching this in Argentina and USA, always making the workshop better. Now I'm expanding it to make more sense in book form.

      I'd love to hear your opinions on the idea and if you get the book let me know what you think.

      By the way, the examples are in Unity, but the concepts from the book should be easily transferable to any graphics api/engine.

      Hope you like it!
    • By RoKabium Games
      While looking out for that pesky Terrator, our little alien is doing a bit of relaxed mining down on the new gas planet "Lelantos" this weekend.... 
      #gamedev #indiedev #madewithunity #screenshotsaturday
    • By vividgamer
      I have a native iOS game (objective c, XCode build) which I am considering to port to other platforms.
      Core gameplay is based on solely on geographical maps, and custom drawing over maps. It also has Core Data. This part is complete in development.
      What is not done yet is: monetization, gamification (leaderboards, challenges) and multiplayer functionality.
      As I think more about it, I am tempted to think if this is the right time to move to a cross platform tool such as Unity. But before dedicating time to port my 5 years side-project effort in Objective C, I really want to know if its worth it.
      - Does Unity support such plugins / assets that will fulfill all my above requirements?
      - Unity Personal seems to have only 20 concurrent users - is it too costly scaling if I decide for extending to web and android platforms?
      - What is the general workflow involved in publishing to iOS, Android, PC, and web platforms while using Unity? I mean to ask about various points of signing stuff, paying fees and getting certified.
      - How long will it really take to port my entire Objective C project into Unity? I am somewhat familiar with C# but I am finding it hard fidgeting with Unity IDE as lot of things are focused around FPS and 3D while my game is still 2d - not much action involved. I seem bit overwhelmed by the list of features I see there. All in all, I do not want to lose my momentum while still making sure its portable to everywhere.
      - Any assets I could use (for free to try basis in debug) that are relevant for my game?
      - Last but not the least, are there any costs that I need to be paying upfront to Unity, for using it (apart from their monthly subscription model)? I don't understand their costing for multiplayer in conjunction with their subscription fees - if someone could kindly elaborate.
      Thanks in advance for your time reading a newbie
    • By GytisDev
      me and few friends are developing simple city building game with unity for a school project, think something like Banished but much simpler. I was tasked to create the path-finding for the game so I mostly followed this tutorial series up to episode 5. Then we created simple working system for cutting trees. The problem is that the path-finding is working like 90% of the time, then it get stuck randomly then there's clearly a way to the objective (tree). I tried looking for some pattern when it happens but can't find anything. So basically I need any tips for how I should approach this problem.
      Use this image to visualize the problem.
    • By aymen
      please any know how can i' calculate the centroid from any number vertices
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Architecture for putting sounds, textures, etc into entities

This topic is 3824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I couldn't think of a better title for this topic, but let me try to explain further here. I'm working (in C++) on a new version of my engine for a new game, and have the opportunity to try to architect things a bit more optimally. I'd like to get some ideas on what you guys think about a problem I have and the solution I chose. The problem I'm trying to solve is this (I use the example of textures but it applies generally to any component from a foreign subsystem): I've got various classes (representing entities of various sorts) that need to have textures assigned to them. At the same time, there needs to be a central repository of all textures that have been assigned, because I don't want to load the same texture twice. I currently deal with this (I'm simplifying for the sake of brevity) by having a TEXTUREMANAGER class that holds a bunch of TEXTURE objects (I use OpenGL so the TEXTURE object is little more than a texture ID) in a map <string,TEXTURE>, and has a public function to take a texture name string and return a reference to a TEXTURE. If it's not in the map already it'll add it and do the actual texture loading. So, the entity has a TEXTURE reference/pointer/smartpointer/whatever and gets it assigned it by calling TEXTUREMANAGER::LoadTexture(string texture_name); A similar problem comes up with my sounds. I've got my entities that need to have SOUND objects assigned to them, yet there needs to be a central repository of SOUNDs so they can be mixed together (yes, I do my own sound mixing, but don't let that throw you off). There's also the issue of not wanting to load sound buffers twice, but that's similar to the above so I'll ignore that problem for this example. My solution is similar: I have a SOUNDMANAGER class that holds a list <SOUND>, and has a public function to add a SOUND to the list and return a reference to a SOUND. It also has a public function to do the actual sound mixing, and for that it iterates through its SOUND list. This all result in my entities having to know about SOUNDMANAGERS and TEXTUREMANAGERS and having a lot of functions like ENTITY::LoadSounds(SOUNDMANAGER & use_this_soundmanager); and ENTITY::LoadTextures(TEXTUREMANAGER & use_this_texturemanager); A higher level system (which creates the actual entities) is responsible for passing in the managers to use. I like this architecture a lot better than using singletons or statics or globals, yet it still seems to have a fair amount of coupling. Anyway, that's a long explanation, but my real question is: what other architecture options are there that could solve these problems?

Share this post

Link to post
Share on other sites
Resource managers are pretty standard so don't fix what isn't broken imho. Your system doesn't sound overly coupled at all. At some point eventually stuff in your engine is gonna have to know about other stuff. =)

Good question though. What are the alternatives? I agree that statics, globals, or singletons are not good solutions. Just about every project I have worked on uses some form of resource manager.

Share this post

Link to post
Share on other sites
Right. So you're making the design requirement that your entities need to have textures and sounds assigned to them, and then you're wondering why the implementation has entities which are coupled ( since you assign textures and sounds to them )?

Seems a little silly to me.

Personally, I'd look into the higher level system that passes in the manager do some aggregation so that you end up with something that has an entity and a texture and a sound (or two, entity/texture; entity/sound) rather than trying to tie everything to the ubiquitous Entity.

Share this post

Link to post
Share on other sites
Original post by Telastyn
So you're making the design requirement that your entities need to have textures and sounds assigned to them, and then you're wondering why the implementation has entities which are coupled ( since you assign textures and sounds to them )?

Fair enough; I should have said the requirement is that entities need to be associated in some way with specific sounds and textures. As for my concern about coupling, I was worried that the entity has to know about the sound *and* the sound manager -- seems a little odd. Your suggestion is interesting and I'll have to look into it.

I'm also happy to hear that nothing I'm doing seems too backward -- I developed a lot of my general engine architecture in a vacuum, so to speak, using only trial and error from one project to the next (only discovered this great community recently).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement