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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

    If it's not broken, fix it until it is

    P J L V A 6 Replies Last reply
    0
    • K Kevin Marois

      I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

      If it's not broken, fix it until it is

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      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

      L J 2 Replies Last reply
      0
      • K Kevin Marois

        I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

        If it's not broken, fix it until it is

        J Offline
        J Offline
        JimmyRopes
        wrote on last edited by
        #3

        try here

        The report of my death was an exaggeration - Mark Twain
        Simply Elegant Designs JimmyRopes Designs
        Think inside the box! ProActive Secure Systems
        I'm on-line therefore I am. JimmyRopes

        1 Reply Last reply
        0
        • K Kevin Marois

          I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

          If it's not broken, fix it until it is

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

          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 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

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

            Naaah, just a little geometry. Define the territories as polygons and then do the usual hit test.

            At least artificial intelligence already is superior to natural stupidity

            1 Reply Last reply
            0
            • K Kevin Marois

              I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

              If it's not broken, fix it until it is

              V Offline
              V Offline
              Vivi Chellappa
              wrote on last edited by
              #6

              Kevin Marois wrote:

              What's the right forum to start asking these questions in?

              The "Write my homework assignment for me and make it quick" Forum! :laugh: PS. I know you are serious but I have to poke fun at someone this morning.:rose:

              1 Reply Last reply
              0
              • K Kevin Marois

                I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

                If it's not broken, fix it until it is

                A Offline
                A Offline
                Andrew Wiles
                wrote on last edited by
                #7

                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 1 Reply Last reply
                0
                • K Kevin Marois

                  I want to develop a game. Probably use XNA. The game will have a map of the world. I will need to know when the player clicks on a territory. I would need to know how to draw the countries/territories, and I would also need to know when the player clicked on one of them What's the right forum to start asking these questions in? Thanks

                  If it's not broken, fix it until it is

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

                  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[^]

                  L B J 3 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[^]

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

                    Eddy Vluggen wrote:

                    Pick a bitmap of a world-map. Give each country a unique color.

                    Ahh, Metro Maps? :)

                    At least artificial intelligence already is superior to natural stupidity

                    1 Reply Last reply
                    0
                    • 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
                                          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