Announcement

Collapse
No announcement yet.

Civiliza - work continues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    DirectX is dropping color key support in favour of alpha blending, which is why you are having problems. It will still support black transparency (as you have seen) but has problems with other colors.

    If you want to use color keying, just use black (0,0,0), or alternately, you can set up an alpha channel(s) on your bitmaps (though to be honest, I've found this is a royal pain in ass to do in practice. Not many paint programs allow you to directly work with alpha channels).

    I don't see the problem with player colors. This doesn't require non-black color keys. To do this, you need one master image (the building) with black for all tranparent bits, as well as black for where the player colors will go. Then, you need one bitmap for the player color which, if you are clever and know what you are doing, can be black and white. The white part is where the player color will be draw, the black is transparent.

    The steps you'd take, then, are to draw the player color bitmap, passing the player color as an argument to replace the white bits. Then draw over it the building bitmap. If you need specifics on how to set that up (Render states and texture stage states), let me know, we do something pretty similar.

    Ron
    Manifest Destiny - The Race For World Domination
    -Playable Alpha now available!
    http://www.rjcyberware.com

    Comment


    • #47
      the problem is that there are more than 10 colors that i need to swap. i can't just use black for all the colors unless i make more than 10 images of each structure
      but that will take way too long (not to mention eat precious memory). right now i'm just ripping the art out of the game and using their color codes (it is pretty obvious what they are because the same colors are used all throughout the game for color coding).

      also, about newer DirectX versions having this transparency problem, aren't all DirectX versions supposed to be backwards compatible? and also, why does it work on XP and not Win98?
      Project Leader of Civiliza, an Alternative Civilization game based on Civ 2.

      Comment


      • #48
        Originally posted by dexter4dxm
        the problem is that there are more than 10 colors that i need to swap. i can't just use black for all the colors unless i make more than 10 images of each structure
        but that will take way too long
        Maybe I'm not understanding what your needs are. The way I understand what you are trying to do, you need to show a building (such as a Barracks). This building will be the same for every player, except that it will have trimmings in each particular palyer's color. Is that right?

        If that's the case, you don't need 10 images of the same building. You need 2, and that will create all 10 different variations of the same building. You simply need to pass, as a drawing parameter, the player color to use for the trimming.

        also, about newer DirectX versions having this transparency problem, aren't all DirectX versions supposed to be backwards compatible? and also, why does it work on XP and not Win98?
        They're backward compatable in the sense that if you program your game using DX8, and the end user gets DX9 sometime in the future, your game will still run just fine. That's why you request interfaces to COM objects during DX initialization. Every DX has every interface from the previous version. You could even, if you wanted to, request an earlier interface than the DX you're using (though there's generally no reason to do this). This does *not* mean that every interface version has to support every feature the previous version supported. It's perfectly legal, in COM world, to do this. Consider, if a programmer uses feature Foo in DX7, and the new DX8 interface doesn't support it, it's okay, because the DX7 interface is still available in DX8, which is the interface the programmer requested, and the feature will still work.

        It is *not* legal, in COM terms, to change an old interface. Once they're released, they're set in stone. DX8 can not change the DX7 or earlier interfaces, because that could break games written with those interfaces, which is against the rules. (Note that's not to say they can't change the *implementation* of a function, as long as it provides the same functionality as before, but they have the leave the calling interface alone).

        So, yes, DX8 doesn't neccessarily need to support color keying just because DX7- did. I expect (though I don't know for sure) that DX9+ won't have any functionality for color keying at all, and it'll be all about alpha channels.

        This was your quick introduction to COM interface rules

        Ron
        Manifest Destiny - The Race For World Domination
        -Playable Alpha now available!
        http://www.rjcyberware.com

        Comment


        • #49
          I wouldn't mind seeing something between Civ and CnC. To be truly strategic in scope you need to discard the tactical elements: all buildings and units require only 1 tile of space, some kind of ZOC, nor ranged attacks except for air units, and units can be stacked on units or structures (but not structures on structures).

          Looking at RON, BR has gone halfway there. Still uses tactical substitution instead of true strategic scaling. I don't know that any kind of ZOC is implemented, and I suspect that ranged attacks are there but limited.
          (\__/) Save a bunny, eat more Smurf!
          (='.'=) Sponsored by the National Smurfmeat Council
          (")_(") Smurf, the original blue meat! © 1999, patent pending, ® and ™ (except that "Smurf" bit)

          Comment


          • #50
            Originally posted by Straybow
            I wouldn't mind seeing something between Civ and CnC. To be truly strategic in scope you need to discard the tactical elements: all buildings and units require only 1 tile of space, some kind of ZOC, nor ranged attacks except for air units, and units can be stacked on units or structures (but not structures on structures).
            Um, you've just described MD almost perfectly (though we do have ranged attacks in the form of both air units and strategic missles, and, late in the game, satellite to ground weaponry). MD is a very strategic scoped game (it's a true world conquering game, even the map is an actual sphere). We show tactical battles, but their "out of player control". They're only there to show the effectiveness of the units you've designed versus the units the enemy players have designed.

            I think Clash has most of those same characteristics you're looking for as well (Mark, correct me if I'm wrong ).

            Ron
            Manifest Destiny - The Race For World Domination
            -Playable Alpha now available!
            http://www.rjcyberware.com

            Comment


            • #51
              Originally posted by RonHiler
              Maybe I'm not understanding what your needs are. The way I understand what you are trying to do, you need to show a building (such as a Barracks). This building will be the same for every player, except that it will have trimmings in each particular palyer's color. Is that right?
              Not just the trimmings. In some cases only a flag will have the player's color, and in some cases nearly the whole building will have the player's color. but the thing is that it's not just one color, it's a whole set of similar colors that make up the image. in other words player red's power plant will have about 10 different shades of red in it after the entire image is done blitting, but if i stored all of those areas as black, it wouldnt be able to tell them apart.
              Attached Files
              Project Leader of Civiliza, an Alternative Civilization game based on Civ 2.

              Comment


              • #52
                Ah, I see.

                Probably your best bet, then, is to use a single player color, as I suggested. Then use, on the master image, partial transparency (you'll need an actual alpha channel for this) to add in the shadings.

                Alternately, you could use greyscale on the player color image, where whiter = brighter player color and darker = dimmer player color. That's probably a better solution, come to think of it. It's the same idea as before, only instead of your player color image being black/white, it's now shades of grey. This *might* not even require alpha blending, but I'm not sure about that. You'll probably have to modify your RenderStates to get the shading to work right. Look at the TFactor render state flag, in particular.
                Manifest Destiny - The Race For World Domination
                -Playable Alpha now available!
                http://www.rjcyberware.com

                Comment


                • #53
                  I see what you are saying now. I suppose it would't take too long to change the images, but I'm afraid I haven't gotten far enough in alpha-blending to understand how to do this technique.

                  alpha-blending is definitally on my list of things i need to finish learning though (along with directplay, directsound and directinput. i'm saving direct3d for my 3rd game )

                  if u have any good links on alpha-blending or directplay i'm always up for those reads
                  Project Leader of Civiliza, an Alternative Civilization game based on Civ 2.

                  Comment

                  Working...
                  X