Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

590 Good

About turch

  • Rank
  1. You'll have to draw 12 triangles either way. Just instead of using 8 vertices and reusing them for each face, you have 3 unique verts per face with the color.  This also applies to normals, u/v, etc - if two adjacent faces share a vertex, but have different normals, you'll have to split it into two vertices.
  2. turch

    How does tan work exactly?

    ok, so tan(angle x) = opp / adj In the image below, tan(x) = 2/1   tan^-1 is the inverse of tan, so if you have the angle, tan(angle) gives you the ratio, and if you have the ratio, tan^-1(ratio) gives you the angle. In the image below, tan^-1(2/1) = ~1.107 rads (~63.5 deg)       So you have the setup in the image below. Subtracting the position of the image from the mouse gives you the length of the two sides. You then divide them to get the ratio, and pass that to tan^-1 to get the angle (in radians).     The sin and cos formulas work the same but are used when you have the hypotenuse and one of the shorter sides.   There's also sin^-1 and cos^-1, they are also known as arcsine, arccosine, and arctan (asin/acos/atan).
  3. turch

    Terrain UV coordinate help

    I'm not seeing the problem here. From the code, it looks like the texture using texCoord should stretch across each quad (repeat on every quad) and the texture using texCoord2 should stretch across 256 quads (repeat every 256 quads). Is that not what's happening or not what you want?
  4. Civilization 4 & 5 have a pretty robust master-server-less multiplayer, so it is definitely feasible - you can even have players join and leave during the middle of a game with no problems. You have to do more planning to handle data disparity, since none of the data is "canonical" and you can't just throw the conflicting data away (or you have to decide on which client's data is the master representation). If your simulation isn't deterministic, you'll need to figure out a way to reconcile floating point errors between different clients.
  5. turch

    GitHub Forums

    Github has their issue system which you can use as a sort of forum, as well as a wiki.
  6. turch

    Resources with smart pointers?

    As Chetanhl said, use ComPtr   http://legalizeadulthood.wordpress.com/2009/01/11/direct3d-programming-tip-3-use-smart-pointers/
  7. "ChaiScript is the first and only scripting language designed from the ground up with C++ compatibility" and is very lightweight ("a header-only library"). I've used it before and had excellent results. It does, however, require either Boost or C++11   I've heard great things about Falcon, which isn't quite as lightweight, but trades it in for (allegedly) excellent flexibility. I've never used it but have had several people recommend it.
  8. Take a look at the iOS Application States.   applicationWillTerminate: looks like the obvious choice but it is not guaranteed to be sent to applications which run in the background. Your best bet would be applicationDidEnterBackground:   Basically, when your app is backgrounded, write out that it is in the background state. When it is foregrounded, write out that it is in the foreground state. When your app launches, check whether the background flag is set - if so, the app was killed while in the background - either by the os, the user, or lack of power. It's not ideal, but is the best you can do on an iOS device - since an application can go from "not running" to "terminated" without executing any code, you can only rely on background / foreground.   You should get applicationDidEnterBackground: called for every situation except for sudden power loss / destruction.
  9. 1. GIMP does not come with any fonts (at least it didn't back in 2011). The default fonts are the fonts you have installed on your system. 2. Font licenses apply to the font file itself. You only need to license it if you are going to distribute the font file - if you are just distributing the rasterized result you don't need to do anything special. Same thing for brushes - the license applies to the "use" of the brush, not the result. and of course, IANAL
  10. When your application is launched by an "open with", the current working directory is %WINDIR%\system32, so if you use any relative file paths they will be broken. It will be the first argument passed in to the application.
  11. turch

    Event System like RPG Maker?

    So, you have an "event", which is just an id to distinguish between events. It can be an enum, #DEFINE'd ints, hashed strings, whatever. You also have a "delegate", which is the code that should be executed when the event happens. Delegates in C++ (which is what I assume you're using) are a pretty big topic, so I'll link you to the stackoverflow question What is a C++ delegate? Lets say you have a class that keeps track of the player's score, and whenever an enemy is killed, the score should increase by the enemy's point value. Pseudocode would look like this: class ScoreTracker { class EnemyKilledDelegate : Delegate { int totalPoints; virtual void operator()(void* data) { totalPoints = (int*)data; } } ScoreTracker() { //... EventManager* mgr; EnemyKilledDelegate* del; mgr.RegisterListener("EnemyKilled", del); //... } } The event manager would then keep some sort of dictionary to call the delegates when the event occurs: class EventManager { map<string, vector<Delegate*>*> eventMap; // map strings to (pointers to (vector of pointers to delegates)) RegisterListener(string event, Delegate* delegate) { // get the vector of delegates for the event (or create a new one) vector<Delegate>* eventListeners = eventMap.getOrCreate(event); eventListeners.add(delegate); // add the delegate } ProcessEvent(string event, void* data) { // get the vector of delegates for the event (or create a new one) vector<Delegate>* eventListeners = eventMap.getOrCreate(event); foreach(Delegate* del in eventListeners) // loop through and call each delegate { (*del)(data); } } } And finally, to fire an event: class Enemy { int pointValue; Die() { //... EventManager* mgr; mgr.ProcessEvent("EnemyKilled", &pointValue); //... } }
  12. turch

    Scene design.

    Don't think of it as a monolithic structure. Keep as many copies of the data as you need. Graphics system needs to cull geometry based on visibility? Keep a quadtree/bsp tree/whatever around. Need to quickly look up certain game objects based on string keys? Keep those in a dictionary. Need a data structure specialized for physics? Have one of those around (if you're going to be using a 3rd party physics api then it will keep it's own copies of the data it cares about). A general purpose scene probably doesn't need to support parent-child relationships. You only really need that for calculating world transforms (and you've got another class for that right?). If this is the "master list of all game objects" type of scene, then really all it needs to be is an array or some sort of dictionary if you have unique ids.
  13. Its kind of hard to tell what's going on without more description.... What does the hash table store? Each tile's value? If so, I can only assume the tiles are in some sort of array to begin with, so you would be able to i = 0 j = 0 for each row for each column hash_table.Add( ((i * numCols) + j), tile_array[j]) j++ i++ And since your keys are 0-255 with no gaps, why do you need a hash table? A 1-d array would serve you just as well... Edit: from reading your previous question, I take it you are trying to generate one of 47 unique ids based on a 3x3 pattern?
  14. You usually do a two step update, parent -> child to update transforms, and then child -> parent to update bounding volumes for culling.
  15. For UI design specifically, Balsamiq Mockups is very good. It is $79 though, but I am mentioning it for completeness (I am unaffiliated with the company). For project organization in general, there are several methodologies, and they vary in usefulness depending on what you are doing. When I worked on internal business applications, often the "design" process was 1) try to get the PHB to actually tell me concretely what they want, 2) spend 2 hours programming it , 3) spend 2 weeks modifying it little by little as they change their mind on what they want. For writing something like a tax application, you can know ahead of time the exact requirements and can design the entire thing before programming a single line of code (waterfall model). For most projects, some form of agile development is usually helpful. Using issue tracking tools (whiteboards and notebooks are plenty good enough if you don't need to collaborate) you map out high level things ("display start menu", "load level", "draw frame", "check for collisions") and then refine and add more concrete goals ("create a vector class", then, later you realize you need to "add normalize function to vector class"). The ideal issue tracking tool you use will let you quickly and easily add a new issues - you don't want it to be a chore as you will be adding issues as you think of them while coding. I recommend you do some reading on agile development, but keep in mind that a lot of people tend to make it way to rigid and jargony (daily scrumm). Ignore that, and focus on the core message - keep your design agile and flexible. There are a lot of little things that you pick up here and there, like this blog post on time tracking (Joel Spolsky has many articles on design and related topics so I recommend you look through the archives).
  • 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!