Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What's The Right Forum...

What's The Right Forum...

Scheduled Pinned Locked Moved The Lounge
game-devhelptutorialquestion
25 Posts 8 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    We really don't have a forum for that anymore. I would also like to have a place where I can't only post questions, but also 'brag' a little about my progress. The correct place would officially have been to ask a general question (look up in the menu under 'Quick Answers'. They don't like to have such things here in the Lounge. For your question: Draw your territories as convex polygons. Territories that are concave must be broken down to two or more convex polygons. You can then make a hit test on the polygons of each territory. The hit test works as follows: Define the polygons with 2D vectors that point into the same direction, clockwise or counterclockwise. Then calculate the cross product of each vector of the polygon and the point you want to test (extend each vector to 3D by setting the Z component to 0). The sign of the resulting vector's Z component will tell you wether the tested point lies inside or outside the polygon. The correct sign, positive or negative, will depend on the direction you defined your polygons, but each cross product must result in the same sign, otherwise the point can't be inside the polygon.

    At least artificial intelligence already is superior to natural stupidity

    B Offline
    B Offline
    Brady Kelly
    wrote on last edited by
    #10

    Useful to know, but yoou seldom have to roll your geometry classes any more.

    L 1 Reply Last reply
    0
    • B Brady Kelly

      Useful to know, but yoou seldom have to roll your geometry classes any more.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #11

      Really? Did you ever look at what kind of code you find in a pixel shader or a vertex shader? With a little thinking you can use the same data structures to render the polygons and perform the hit test on the GPU.

      At least artificial intelligence already is superior to natural stupidity

      B 1 Reply Last reply
      0
      • L Lost User

        Really? Did you ever look at what kind of code you find in a pixel shader or a vertex shader? With a little thinking you can use the same data structures to render the polygons and perform the hit test on the GPU.

        At least artificial intelligence already is superior to natural stupidity

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #12

        CDP1802 wrote:

        you can use the same data structures to render the polygons and perform the hit test on the GPU.

        Exactly, like I said, you seldom have to roll your own.

        J L 2 Replies Last reply
        0
        • L Lost User

          Pick a bitmap of a world-map. Give each country a unique color. When the user clicks on the bitmap, request the color of the pixel that has been clicked. Lookup in the dictionary which country the color was mapped to.

          Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

          B Offline
          B Offline
          Brady Kelly
          wrote on last edited by
          #13

          That is a great answer. Very practical for many purposes.

          1 Reply Last reply
          0
          • P Paul Conrad

            Probably the forum that fits whatever language you are developing the game with. There isn't a forum specific for XNA here at CP. Maybe Microsoft has forums for XNA, it's been a while since I've played around with XNA. As far as being able to tell where someone is clicking on a map in a game, it can't be any more than checking an event handler for the click and seeing what the coordinates are on the screen.

            "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

            J Offline
            J Offline
            Julien Villers
            wrote on last edited by
            #14

            Actually, in XNA, you don't get event handlers if you're not mixing it with WPF/WinForms/whatever, so that's more complicated than that. And yes, there is an official XNA forum to discuss and get help: http://forums.create.msdn.com/forums/[^]

            'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

            1 Reply Last reply
            0
            • B Brady Kelly

              CDP1802 wrote:

              you can use the same data structures to render the polygons and perform the hit test on the GPU.

              Exactly, like I said, you seldom have to roll your own.

              J Offline
              J Offline
              Julien Villers
              wrote on last edited by
              #15

              So how do you learn? Of course, there are many full featured engines out there, that doesn't mean one shouldn't learn at least partly how they work.

              'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

              1 Reply Last reply
              0
              • A Andrew Wiles

                Kevin Your best bet would be the App Hub forums for XNA at http://forums.create.msdn.com/forums/[^] Stack Overflow also provide pretty good XNA support. Be prepared for a lot of frustration getting started......

                www.it-workplace.com
                "If a man speaks in a forest where there is no woman to hear him, is he still wrong?"

                J Offline
                J Offline
                Julien Villers
                wrote on last edited by
                #16

                Andrew Wiles wrote:

                Stack Overflow also provide pretty good XNA support.

                And gamedev.stackexchange.com[^] too.

                'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                1 Reply Last reply
                0
                • L Lost User

                  Pick a bitmap of a world-map. Give each country a unique color. When the user clicks on the bitmap, request the color of the pixel that has been clicked. Lookup in the dictionary which country the color was mapped to.

                  Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                  J Offline
                  J Offline
                  Julien Villers
                  wrote on last edited by
                  #17

                  That might be a very good or a terrible solution, depending on the scale of the map ;) I would add that you would probably use two bitmaps: one to display a nice looking map, and one with flat colors to do the hit-testing.

                  'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                  L 1 Reply Last reply
                  0
                  • J Julien Villers

                    That might be a very good or a terrible solution, depending on the scale of the map ;) I would add that you would probably use two bitmaps: one to display a nice looking map, and one with flat colors to do the hit-testing.

                    'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #18

                    Do you all guys have too much memory and don't know what to do with it?

                    At least artificial intelligence already is superior to natural stupidity

                    J L 2 Replies Last reply
                    0
                    • L Lost User

                      Do you all guys have too much memory and don't know what to do with it?

                      At least artificial intelligence already is superior to natural stupidity

                      J Offline
                      J Offline
                      Julien Villers
                      wrote on last edited by
                      #19

                      My PC has 16GB yes ;p I've started my post by saying this using bitmaps could be a terrible idea, it all depends on the project (design, hardware target, etc...).

                      'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                      L 1 Reply Last reply
                      0
                      • B Brady Kelly

                        CDP1802 wrote:

                        you can use the same data structures to render the polygons and perform the hit test on the GPU.

                        Exactly, like I said, you seldom have to roll your own.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #20

                        Uhm, you do know that that means that he must set up custom data structures and custom shaders?

                        At least artificial intelligence already is superior to natural stupidity

                        B 1 Reply Last reply
                        0
                        • J Julien Villers

                          My PC has 16GB yes ;p I've started my post by saying this using bitmaps could be a terrible idea, it all depends on the project (design, hardware target, etc...).

                          'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #21

                          Who does not at least have an i7, 16 GB and a GTX 580? :)

                          At least artificial intelligence already is superior to natural stupidity

                          J 1 Reply Last reply
                          0
                          • L Lost User

                            Who does not at least have an i7, 16 GB and a GTX 580? :)

                            At least artificial intelligence already is superior to natural stupidity

                            J Offline
                            J Offline
                            Julien Villers
                            wrote on last edited by
                            #22

                            Me, my graphic card is rather old ;p The Xbox360 and Windows Phones too (possible targets for XNA).

                            'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                            L 1 Reply Last reply
                            0
                            • L Lost User

                              Uhm, you do know that that means that he must set up custom data structures and custom shaders?

                              At least artificial intelligence already is superior to natural stupidity

                              B Offline
                              B Offline
                              Brady Kelly
                              wrote on last edited by
                              #23

                              I think we might have a language issue here. You seem to be saying he can use the same data structures as those "ou find in a pixel shader or a vertex shader" and perform the hit test on the GPU, right?

                              1 Reply Last reply
                              0
                              • J Julien Villers

                                Me, my graphic card is rather old ;p The Xbox360 and Windows Phones too (possible targets for XNA).

                                'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #24

                                My XNA projects are full of XAML by now and both the Phone and the XBox don't have the .Net 4.0 namespaces I need for that. I guess I'm stuck on the PC.

                                At least artificial intelligence already is superior to natural stupidity

                                1 Reply Last reply
                                0
                                • L Lost User

                                  Do you all guys have too much memory and don't know what to do with it?

                                  At least artificial intelligence already is superior to natural stupidity

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #25

                                  1 Gb physical, and some swap-space. A 320x200 bitmap, scaled to 640x400 would still look "decent". Not much wasted space if you only use a few colours. As for practicality; you might want to use two worldmaps, one where you can select a continent, then a version where you select the country. That way you limit the colours you need :) Next!

                                  Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups