Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by metsfan

  1. metsfan

    How to tell if a function parameter is an object?

      I did see that quote, but I do want the behaviors of SetArgObject to be used if at all possible.  I will give your solution a try.  I inspected the code to get a variable's type ID, and I don't like how much code is executed just to get a value that is already cached in the asCScriptFunction object, which is why I was hoping there was another way, but this seems like it would work out fine  Thank you.
  2. Hello all,   First, let me describe the behavior I am trying to implement.  I have created a custom wrapper around Angelscript functions in order to make calling them easier.  One of my wrapper functions handles the "pointer" case (i.e. the user passes a pointer as a parameter).  In this situation, Angelscript can either accept this parameter using SetArgObject or SetArgAddress.  What I would like to do is try SetArgObject first, and if that fails, then try SetArgAddress.  However, the problem I am facing is that if I pass an invalid parameter to the context, it invalidates the entire context, and prepare must be called again in order to use the context again.    I did some digging into the Angelscript code and noticed that before the context actually sets the argument in SetArgObject, it first checks the function to see that the parameter is an object, and if it's not, it returns and error and sets the error code.  It would have been nice, however, to know before calling SetArgObject that the call would be rejected, so that I didn't have to invalidate the context.  The problem is it seems the data types used by Angelscript to check if the parameter is an object are hidden from the front-facing API.   What I would ideally like is to do the same check that the context does before setting the object to make sure I am passing in a valid object to the context to avoid destroying the current context state.  Does anyone know any way to do this, other than modifying Angelscript?     I hope this hasn't been too hard to follow.   P.S. For Andreas: one solution I have come up with is to expose the asCDataType as asIDataType and allow users to query the data types for function parameters in the public asIScriptFunction interface.  I would create a new method on asIScriptFunction, like GetDataTypeForVar(int index) which would return an asIDataType.  If you are happy with this solution, I can implement it and send you a patch for your approval.  
  3.   Perfect, thanks.  Yes, I was referring to dedicated desktop GPUs.  
  4. Hey all,    I am wondering something about texture swapping, hoping someone can shed some light.  Question is simple:  If I swap to a different texture unit, whether it be DirectX or OpenGL, will the operation take longer depending on the size of a texture?  In other words, is a texture swap to a 64x64 texture the same cost as a 2048x2048 texture?  Is it just like changing a pointer, or does it actually have to move the memory to make it accessible to the GPU?  It is safe to assume in this situation the textures are fully initialized and have already been rendered with already (so the data is guarenteed to be in GPU memory), and that the data will not change for the runtime of the application.   It seems intuitive to me that it would take longer for the larger texture swap, but I have found more than once that the GPU does things that surprise me, so any knowledge here would be great.  Thank you.
  5.   What is this "trend" you speak of?  Do you have data or a study to back up your claims that the majority of C++ developers are inexperienced, closed minded people who dont know any better?  If you want to talk about trends that's fine but you have to provide some proof that there IS a trend.   You have not spoken in anything but personal opinions.  Which is fine, you are entitled to your opinion.  But there is no trend.  Simply by stating that your words represent a general truth or a "trend" about C++ developers is proof that what I said is correct: you believe your own personal opinions and biases to be fact.  They aren't.  This will be my last post on the matter, so enjoy the last word.
  6. metsfan

    You Don't Need to Hide Your Source Code

    I should send this to my boss, he'd get a good laugh.  Good luck getting anyone to invest money into your game if your source code is open source.  The premise of this article is flawed, and that is demonstrated by this statement:   "Understand: keeping source code secret does not by itself do anything to stop unauthorized copying.".    Businesses do not keep their source code a secret to prevent unauthorized copying.  There are other measures built into software and sometimes even hardware to prevent this sort of thing.    The purpose of keeping source code a secret is all about equity.  Source code is an asset.  Businesses spend anywhere from tens of thousnads to hundreds of millions of dollars building source code.  The applications themselves are valuable, yes, but the real value is in the source code itself.  By exposing the source code of their applications, a business would essentially be inviting competitors take what they spent their hard earned cash on, and put you out of business.  Additionally, sometimes in business the only thing you have on other competitors is a head start, and by giving out your source code, you forfeit that advantage as well.   I understand where you are coming from, and it is noble, but naive.  Businesses take OSS every single day, brand it as their own, and give absoutely nothing back to the community, and snicker "those open source idiots, they saved us millions, and we dont have to give them a dime".  I'm not saying OSS is bad.  I love OSS and contribute to it myself.  But the way us idealistic software developers think of OSS is not how the majority of the world, especially the MBAs, think of it.    TLDR - OSS is great, but sometimes its best to keep things to yourself, especially if you are trying to make money and/or have competition. 
  7.   Your statement does not stand, and is extremely judgemental.  C++ is a great language with many strengths that make it a great choice (and sometimes the best choice) for a wide variety of projects, and there are many great programmers who enjoy using it, some of which I work with every day.  Of course it has weaknesses too, but so does everything man-made.  You can say the reason I like C++ is because I don't know it, and I'd respond by saying the more I learn about C++, the more I do like it.  And no, I don't like having hot wax poured on my genitals .       Translation: "It is a fact that what I don't like is terrible, and everyone who likes what I don't like is stupid".
  8. I'd say that your goals are the most important thing in choosing a language.  Are you trying to get a job in the game industry? Or just make a small game for fun?  Or are you looking to make money?  Is the game going to be 2D or 3D?  If your goal is to land a job at a AAA studio doing game or engine development, then you HAVE TO learn C++.  If you just want to make a game for fun or to make money, pick a higher level language, like C#, Java, or Objective-C.  Performance is only going to matter if you have a very CPU intensive game (such as a first person shooter or any other game with lots of physics calculations).  Most of the work these days in games is done on the GPU, which is irrelevent of language.  If you are making a 2D game, these factors are even less relevent, and you can basically choose any language you want which has a high level 2D graphics library.   Best of luck.     Anyone who describes C++ as a "piece-of-shit nightmare" clearly hasn't used C++11.  C++11 is a great language with speed that can only be surpassed by assembly, and freedom and expressiveness on par with Scala. 
  9.   I respectfully disagree.  I agree that some hackers will see the challenge as appealing, but obfuscation as a security technique has been proven a successful deterrent   It will remove an entire class of hackers from wanting to hack your game.  It's the same reason encryption algorithms use a cypher.  Sure, a talented hacker with a lot of time on their hands could discover the cypher and crack the algorithm, but it will deter lower level hackers who dont have the skills to crack the cypher, and the hackers who dont feel like putting in the time to crack it.  You cannot prevent 100% of all hacking, it's about staying 1 step ahead, and putting hurdles in their way.
  10. metsfan

    Terrain lighting seams?

    If you are using bezier patches, make sure you are joining your patches with at least C1 continuity.
  11. metsfan

    Engaging Independent Creative Professionals

    Well written article.  I would change the title though, and generalize this article, as these tips are good advice when dealing with ANY kind of contracted work.  
  12. Hello All,   I've been reading about using spherical harmonics to create irradiance environment maps and I want to give it a shot.  However, one question I have, which I can't seem to find an answer from in the resources I'm reading is how the original cube map is formed.  So obviously in a static scene, you can just load a cube cross from disk, and viola.  But, for real time rendering, you are going to need to regenerate this environment map on every single frame, theoretically.  So the way I see it, this is my rendering batches:   Render the current environment 6 times, one for each cube face, render to a texture Compute my irradiance environment cubemap, send it to the video card Render the environment again, this time from the POV of the camera Render all of my objects with my irradiance map Now maybe I'm underestimating my GPU, but this seems like a lot of processing.  It seems nearly impossible that I'm going to be able to do all of this in 16ms and still have time to spare to update the rest of my game world.  Is there something I'm missing here, or is this generally the strategy used for real time irradiance environment maps?
  13. metsfan

    problem with load obj file

    Just a suggestion:  If your goal is not to build a model parser, but just to load a model into memory so you can accomplish your actual goal, consider using: http://assimp.sourceforge.net/
  14. The idea with a pipeline is that the output from one stage is the input for the next stage.  What this means is that if you change the state in state 3, that's ok, because those stage changes are probably requires for stage 4, and stage 1 and 2 will receive those changes on the next frame.  Ideally though, you wouldn't modify state in stage 3 that would be required by stage 1 or 2.  However, if you do, those updates are always only 1 frame away, which is indistinguishable to the end user.
  15. It sounds like you're pretty concerned about your memory usage patterns.  I wouldn't worry about that so much right now.  You're still in your development phase.  Having custom allocators once you understand your usage patterns is very important, but you aren't even close to there yet.  Right now I'd just focus on getting something working.  The real memory eaters in applications aren't gonna be 50 unused bytes in an entity object.  It's going to be your disk assets (textures, models, maps, ect).  An extra 50 bytes per entity isn't going to break the bank (unless of course you have millions of entities, but that's not really a typical use case). 
  16. Just to add to what warnexus said, you are asking entirely the wrong questions.  If you are ready, as a programmer, to begin learning how to make video games, language is the last concern you will have.     As for choosing a language: this choice should depend mostly on platform, secondly what you already know, and thirdly based on the features of the language itself.  As an example:  let's say I want to make an iOS game.  I have to use Objective-C, C++, or C because of the platform restrictions.  Next, I am going to pick C++ because I know it best, and because it offers the language features I'm looking for (e.g. different levels of encapsulation, multiple inheritence, templates/generics).   However, let's say in another circumstance, the only thing that matters to me is speed, rather than convenience   In this case, I would pick C.  This is how you select a language.  
  17. At the very least, you will need a server that houses a database to store your auctions, as well as user accounts, stats, ect.  You could use this same server for matchmaking  assuming it had the resources available.  
  18. Hello all,   I am designing a scene graph for my rendering engine.  I would like to use the same rendering engine for rendering my GUI and my game objects, however, this means that I would need to switch cameras during rendering.  Here are the options as I see them:   Option 1: Create a separate scene graph for each type of camera.   Option 2: Use the camera nodes as the root nodes, and add other top level nodes as children of the camera nodes. Option 3: Something I didnt think of?   Thoughts?
  19. Well, the way I've set up my scene graph is a bit different, it's not a full on scene graph OSG style.  Mainly the way it works is each node has a "Shape" attached to it, so the nodes are rather generic, and the Shapes are what is different.  The only time I do extend the SceneNode class is for nodes which only affect state.  Which comes to the main reason I am using a scene graph, which is state sorting.  I have a parent class that sets up a bunch of state, then we render all of its children with that state active. I am always open to alternatives though.  The 2nd reason I use is a scene graph is the transform stack.  Parent sets up a transform, passes it onto the child. If someone can present a way to represent such things without a scene graph, i'd love nothing more than to give up scene graphs altogether.  I'd also be curious how these other non-scene graph systems handle cameras.  I could see camera just being a parameter you pass into a "Draw" method.  That seems plausable as well.
  20. Just thinking more about the system you posted, it seems reasonable in theory, the biggest issue I see is that it is limiting in that you can't easily change what types of techniques/passes a shape supports.  Also, all those string look ups every frame are going to kill you, you need to employ some caching, and only do those string lookups when values change.
  21. The way I handle this is with the following architecture: Shapes: Shapes represent actual objects They store vertex buffers Each shape has a string key which is stored which represents the current "technique" Materials: Materials are represented using the entity-component model Each component is represented by an Attribute class, (i.e. TextureAttribute, ShadingAttribute, BoneAnimationAttribute) Each material type is represented by a Material subclass which uses multiple inheritence to mixin the attributes that material should have Techniques: Techniques represent a rendering method (for instance, "Phong Shading". Each technique has an array of Pass objects Pass: Represents a single pass of a technique (for instance, if I were rendering a line by rendering first the outline, then the inner line, i would have an "StrokePass" and "FillPass") Maintains a pointer to a shader program, which it will populate with the current render state RenderState: Stores the current render state, including a world transform stack, current projection transform, current material, lights, ect Passed through to each rendered shape, shape will push its own state, possibly pass that state onto its children. Each type of technique is instantiated at runtime, and stored in the GraphicsContext with a string key. These techniques are then by the shape when their Draw method is called. We then bind the appropriate vertex buffer, go through each pass of the technique, apply the pass (which essentially sets the shader state), and execute our draw call. I hope i have done a good job explaining the system and it makes sense. It has worked out well for me so far, though I imagine there will be many improvements I'll make.
  22.   Another option for this particular situation is the Service Locator Pattern (http://en.wikipedia.org/wiki/Service_locator_pattern), though there are some who consider this an anti-pattern. 
  23.   If performance is not an issue, this system should work fine.   The problem here, is that using a string map, or even an integer map if you decided to use an enum instead of strings, is that if you are looking up components in a map, and you are doing this many times per frame (in the hundreds or thousands), the performance will suffer big time.     The way I have implemented the entity-component model if performance is important is to use multiple inheritance  and use the compentent classes like "mixins".  For instance, if you want a Rock to have Sprite and Velocity, per the example in the article, you would do:   class Rock : public SpriteComponent, public VelocityComponent   Now Rock has those getters/setters, and you don't have to do any icky dynamic casting or string map lookups, of course at the cost of the dynamic ability to create new entity types, since now you will have to create a new class definition for each new entity type.  Tradeoffs.
  24.   Wish I could, unfortunately, this engine will need to support mobile devices.
  • 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!