Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

359 Neutral

About SiS-Shadowman

  • Rank
  1. SiS-Shadowman

    Possible neutrinos travel faster than light

    That's not true. Photons DO have a mass, however they don't have a rest mass (I hope this is the right word, in german it's called "Ruhemasse"). If photons had no mass then light could not be bent, however it is possible in extremely strong gravitational fields. These kinds of distortions are actually used to detect black holes (the quiet ones ;) ). *edit* I can't find an english source, but this (beware, german) is what I'm talking about. But according to that source, "bewegte masse" (moving mass, or something like that) just seems to be another word for energy. It renders my comment somewhat pointless
  2. SiS-Shadowman

    Winsock difficulties

    I didn't hear such a hostility. He gave you a hint to where to find such knowledge (eg. the library) ;) Once you have a better understanding of the means of communication you can come back to actually implement it.
  3. SiS-Shadowman

    Question on Threads

    Yes it will work. Most operating systems will use some sort of scheduling in order to let each thread run a little, before it will be swapped for another one. For example, my computer at work has about 1150 threads running (with just a view actually doing stuff).
  4. SiS-Shadowman

    Deleting a Large "list",

    I actually meant the destructor of your Token class. Calling delete(*iter) first calls the destructor of your Token object and then frees the memory associated with it. Depending on the Token object and the amount of work the destructor must do, it can take some time. But this totally depends. If you want to continue using the list class then I suggest you look into custom allocators and memory pooling. You could advise the pool to reserve a large amount of memory upfront (for example 10mb) and then use that pool instead of the default allocator (which simply uses new for allocating a node within a list). Another option would be to skip visual studio's memory allocator alltogether and use a better one: http://www.hoard.org/ We are using hoard at work and it has proven to be several times faster than the one visual studio provides.
  5. SiS-Shadowman

    Deleting a Large "list",

    You have to release that memory, unless you want to leak it. There is no way around it. Your way of doing it seems fine (although I wouldn't use raw pointers in containers): If you want it to be faster then you need to start profiling your code. Some hints: -You haven't told us what very large means to you -What is your destructor doing? -What compiler (gcc/msvc, debug/release, what optimizations), etc... -Have you tried another data structure? (std::vector comes into mind) -Have you looked into using memory pools (eg. custom allocators, etc..)? *edit* You should think about your code before randomly writing code. Calling _tokens->clear() is WRONG. Your list is empty afterwards and therefore the loop doesn't do anything and therefore you are now leaking memory.
  6. I would also recommend to first see how other GUI systems are implemented and then try to roll your own. I'm currently doing the same thing, mostly borrowing concepts from Qt and WPF. You basic block would most likely be a Widget or Control which has several parameters (position, size, etc.. come in mind). I would keep the inheritance hierarchy very small (most widgets directly inherit from widget in my case) and perfer composition instead. Depending on your needs this will be a huge amount of work (I'm currently two weeks in and have a plan for at least another month of work).
  7. It is not completely obvious to me why a sub-system holds a dictionary of entity -> component (I assume by component, it is the actual component the sub-system deals with) that may be because: A. My components can keep references to attributes that the entity has. (If you need position from the entity in the dictionary) B. My components have a reference to the entity that contains it. Do your components not know about their entities? [/quote] Yes, in fact they do. This is because my entities don't have a list of components attached to them, instead the subsystems take care of that. I figured that I'll propbably never need to get ALL components of an entity, only a subset. When creating an entity, it only references the entitysystem it has been created with. Upon adding a component, for examble your Renderable3D, the entity defers the call to the entity system, which in fact defers the call to the right sub-system. It will in return add the (entity, renderable) pair into it's dictionary. Entity e = entitySystem.CreateEntity(); e.Add(alreadyExistingRenderable3DComponent); I solved the attribute problem by allowing components to reference other components, in fact, each component type specifies a Template that describes what this component actually requires. For example a renderable would require a transformable (everything that can be rendered must have a translation). This requirement now changes the process a bit. Upon adding the Renderable component, the entitysystem verifies that ALL requirements are met and if they are, the component is added. Otherwise an exception is thrown, containing all requirements that are not met. (The same procedure is done upon removing a component). Entity e1 = entitySystem.CreateEntity(); e1.Add(new Transformable()); e1.Add(new Renderable3D()); Entity e2 = entitySystem.CreateEntity(); e2.Add(new Renderable3D()); //< throws because the transformable component is missing That very same template can be used to construct a component (because it is in fact a string => object dictionary + a list of required components) through a subsystem. My subsystems are not only responsible for calling update / draw on their components, the also serve as factories to create a component from a certain template. On top of that I have a template collection that describes an entire entity. This way I can create a template for a starship, store that template somewhere and finally create a thousand starships, only passing that template to the entity system. var template = new EntityTemplate(); dynamic transformable = ComponentTemplate.FromType<Transformable>(); transformable.Position = new Point(10, 100, -15); transformable.Orientation = new Quaternion(....); dynamic renderable = ComponentTemplate.FromType<Renderable>(); renderable.Mesh = "bunny.x"; renderable.Material = "bla" template.Add(transformable); template.Add(renderable); Entity entity = entitySystem.CreateEntity(template); // Entity now contains 2 components (transformable and renderable) // Both components will have all properties extracted from the template upon construction FYI: I'm using IronPython to describe all my components & entities, so I can simply redefine them while the game is running (and hence my c# example using the "dreaded" dynamic). *edit* I forgot to mention that when retrieving a specific component from an entity, you specify it's type. The entity simply delegates the call to the entity system which in turn delegates it to the subsystem, responsible for that type (this method is mostly used upon entity creation and when components are attached): Transformable t = e.Component<Transformable>(); Renderable3D r = e.Component<Renderable3D>(); *edit2* So to sum it up, the ENTIRE state is kept in the entity system. All a user has to do is to have a reference to it. The entity system takes care of registering the components with the right sub-system. This way you don't need global access to the renderer because the right sub-system has access to it (because it was given the renderer during construction), no need for global access to the physics simulator because of the very same reason.
  8. My system is pretty similar to yours, but instead of the entities holding the attributes, components do. When another component requires the same attribute, it must say so when it's attached to the entity (via requirements). Anyways, I have a big entity system that consists of subsystems. Each subsystem handles ONE specific type of a component. The one system holds all renderables, the other one all collidables, and so forth. This way I can render all renderables "at once" (the subsystem obviously holds an entity => component dictionary) and do collision tests for all components in the other subsystem. So basically you add one system per component (sometimes I do need a small hierarchy in components, so I've restricted my rule to having one subsystem per DIRECT subclass of component: all further subclasses are put into the same system). If you're interested, I can send you my sources.
  9. Hello, well I continued working on my game and feel the need to upgrade my current source-control system, as well as to add automated builds and tests. I'm currently using SVN (the repository is stored on my NAS) for source control and there is neitherautomated building nor -testing. I feel the need to switch to another source control system since either SVN itself or my clients (TortoiseSVN, AnkhSVN) seem a bit glitchy. Every now and then, my checkout becomes unusable (forcing me to delete it and to create a new one) and then there is the lousy rename / move support of AnkhSVN (it seems to me that files are just removed and re-added, which defeats the purpose of moving). What other options do I have (besides ClearCase and SourceSafe) and which ones do you use? Somewhere in a galaxy far, far away (and a long time from now), I might be able to actually release my game. I don't want to manually apply labels, hit the build button and the start my favourite installer (NSIS, etc..). What are my options here? Which ones do you use? But most importantly, I would like to run a series of tests again my code before a commit (preferably automated), so I can't screw up trunk or some branch. Again, what are my options? Do you even use automated tests? I would really like to hear about your setups & recommendations
  10. SiS-Shadowman

    The future of massive multithreading?

    Well that statement is certainly true. If you don't know how to use a tool then you're probably doing it wrong.
  11. SiS-Shadowman

    Moving from Game Maker

    I would suggest a language that is very easy to learn AND forviging when you make errors. I started with c++ which was a bad choice for me. I would suggest c# or python, however in the end it doesn't matter so much. If you go the c# route, you could choose XNA which has a big community and tons of online code, examples and existing games. If you go the python route, there is pygame, though I have never tried it, so I can't tell you about it's quality. There seem to be thousands of projects available. No matter which language you choose, you will need to develop certain skills (and preferably several programming methodologies) that apply to most languages. You can do this by reading books, going to university and ofcourse by visiting gdnet ;) The following is my own opinion and might differ from alot of users on this forum, I don't want to start a flamewar but instead give advice which I wish I had listened to when I started programming ;) I would suggest to not got the c++ route: in my opinion the language is way too complicated to be picked for learning programming, you can do so much wrong and so little right and it takes decades to truly understand that language (if it's even possible to, I don't know). Most of the time I find myself working on some minor detail (oh snap, you want to display non ascii characters, however most libraries work with std::string / const char*) , hunting down annoying access violations or burning in the windows dll hell. There can also be inconsistencies during building, not being allowed to export templates (in a standard way) and so much more annoying [insert your favourite swear word] that just distracts you from your goal: Creating a game.
  12. During the creation of my google maps clone (that is displaying vector & raster data using the mercator projection) a quadtree came in very handy and was several magnitudes faster for frustum culling than an ordinary hash map. Even with "huge" amount of items (about 100.000) it performed quite well and provided other means for culling as well. Drawing so many items would result in too much overdraw (for example if each is represented by a smal 16px² image) and thus less benefit for the user: I quickly came up with an algorithm that filtered out a big percentage of unseen items (basically only N items could be drawn PER bucket, where N is calculated from bucket_size / maximum_item_size). But as always, choose the right tool for the job: If a quadtree didn't perform as well for you, then it may not be the right one (or your implementation was bad, or you used it wrong, but I can't judge that ;) ).
  13. SiS-Shadowman

    [PROBLEM] Game crashes outside VS 2010

    You should take a look at shared_ptr's and the likes.
  14. SiS-Shadowman

    [PROBLEM] Game crashes outside VS 2010

    Exception Code 0xc0000005 stands for an access violation. This means that you are dereferencing a bad pointer. This can be due to several reasons: the pointer points to NULL, you are dereferencing a pointer you have previously deleted, you are dereferencing a pointer that was never initialized, and (my favourite) a combination of the above in any number of indirections. This is no complete list, but these are (at least in my opinion) the usual suspects. I can't tell you the exact error from that report, or where to look for, but you still have the ability to attach visual studio to your game while it is running. You said that the game only crashes after you perform some action. You should try the following: Start your game from windows explorer and then tell visual studio to attach itself to the game (Debug => Attach to process => select whatever the name of your game executable is). By chance the access violation still occurs and visual studio will hold the programm for you to inspect the callstack etc...
  • 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!