SiS-Shadowman

Members
  • Content count

    1033
  • Joined

  • Last visited

Community Reputation

359 Neutral

About SiS-Shadowman

  • Rank
    Contributor
  1. Possible neutrinos travel faster than light

    [quote name='dysphoric' timestamp='1317052035' post='4866101'] Uh, Photons do too reach the maximum speed of light.....[b]Photons are massless particles[/b] that move unhindered because gravity only exerts a pull upon things with mass.... [/quote] 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 [url="http://www.quantenwelt.de/faq/masse.html"]this[/url] (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. Winsock difficulties

    [quote name='Deek880' timestamp='1317015595' post='4865953'] HP: Your hostility is unbelievable. I came to this forum seeking knowledge, not abuse. [/quote] 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. 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. 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. Deleting a Large "list",

    [quote name='Geometrian' timestamp='1316586375' post='4864121'] Hi, I've got a very large list of pointers. The pointers point to new-d objects. I need to free all the objects and then delete the list (which is itself new-d). My current technique looks like:[source lang="cpp"]for (list<Token*>::iterator iter=_tokens->begin();iter!=_tokens->end();++iter) { delete (*iter); } delete _tokens;[/source]Unfortunately, the "delete _tokens;" line takes a very long time (about ten times longer than loading the data into the list in the first place, doing lexical analysis, and parsing, all put together). Clearly, this is problematic. I have tried "_tokens->clear();" before the delete, but then that line takes forever instead. I have also tried manually removing all the elements one by one with a loop, but then that loop takes too long. Help? Thanks, -G [/quote] You have to release that memory, unless you want to leak it. [b]There is no way around it[/b]. 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 [b]WRONG[/b]. 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. [quote name='CRYP7IK' timestamp='1316049417' post='4861832'] [quote name='SiS-Shadowman' timestamp='1316006709' post='4861535'] 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. [/quote] 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. [code] Entity e = entitySystem.CreateEntity(); e.Add(alreadyExistingRenderable3DComponent); [/code] 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). [code] 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 [/code] 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. [code] 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 [/code] 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): [code] Transformable t = e.Component<Transformable>(); Renderable3D r = e.Component<Renderable3D>(); [/code] *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. The future of massive multithreading?

    [quote name='nQue' timestamp='1315927684' post='4861125'] the cost of multithreading [...] most often outweighs the benefits [...] if [...] you [b]don't know what youre doing[/b]. [/quote] Well that statement is certainly true. If you don't know how to use a tool then you're probably doing it wrong.
  11. 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 [url="http://create.msdn.com/en-US/"]XNA[/url] which has a big community and tons of online code, examples and existing games. If you go the python route, there is [url="http://pygame.org/news.html"]pygame[/url], 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 ;) [b]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 ;)[/b] 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. [PROBLEM] Game crashes outside VS 2010

    [quote name='Blodyavenger' timestamp='1315228176' post='4857810'] [b]I'm back with a victory cry over the problem![/b] Yes, there was somekind of memory leak. I was using 2 variables that weren't initalized and that was the source of the problems. I should write my code more carefuly and learn how to use debugging you've mentioned Oliver - thanks for that, it will be of great use! And thanks to everyone else trying to help me, I appreciate your time taken [/quote] You should take a look at shared_ptr's and the likes.
  14. [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...