17 Replies Latest reply: Jul 12, 2013 12:48 AM by pauland RSS

    Flex BlazeDS based Poker game

    rjoshicool Community Member

      I am working on a Flex Java based poker game where multiple tables need to be created and people are placed on the tables depending on the table availability. I am facing issues adding people from resource pool to the tables. Any one worked on something similar? Any tutorials, examples or code snippets would be helpful.

        • 1. Re: Flex BlazeDS based Poker game
          rjoshicool Community Member

          Any help on this?

          • 2. Re: Flex BlazeDS based Poker game
            migueldiab Community Member

            This forums can be quite stale... I would recommend going to more active communities for help, and also trying to ask more specific questions...

             

            You can find very good tutorials and information here :

             

            http://lmgtfy.com/?q=blazeds+tutorials

             

            (also you might find usless things... but it's worth the shoot)

            • 3. Re: Flex BlazeDS based Poker game
              pauland Community Member

              ask more specific questions

               

              I think this is the key. "I am facing issues" doesn't really say much.

              • 4. Re: Flex BlazeDS based Poker game
                moccamaximum Community Member

                If you are looking for trhe official word of an algorithm that describes the problem you are dealing with:

                its Queue (or sometimes schedule when you look on reserving places at a certain point in time).

                Here is a nice description (tailored to Python, b ut you should have no probloem finding implementations for JAVA/Actionscript):

                • 5. Re: Flex BlazeDS based Poker game
                  rjoshicool Community Member

                  Thanks to all for replying. I am listing down the issues I have been facing lately:

                  1. Managing Threads for multiple tables. So that I can handle multiple tables and the data they will be broadcasting.

                  2. How to persist thread data in Server

                  3. Manage User pool so that multiple users can persist in a single table

                  • 6. Re: Flex BlazeDS based Poker game
                    migueldiab Community Member

                    rjoshicool, I stil don't understand what is your specific problem. I will try to answer to the best of my knowledge...

                     

                    1. Managing Threads for multiple tables. So that I can handle multiple tables and the data they will be broadcasting.

                     

                    What container are you using? Tomcat? Threads should be no different than how you use threads in Java... There is no "BlazeDS" flavor to it...

                     

                    2. How to persist thread data in Server

                     

                    What do you mean by "persist in the server"? You mean into the DB? Again, same as you would do in java, you can use Hibernate, JDBC, plain text or whatever you see fit.

                     

                    3. Manage User pool so that multiple users can persist in a single table

                     

                    I guess you can do this by either having a "Game Table"  that would be a single instance for each table and have the blazeds users access it's methods

                     

                    hope this helps     

                    • 7. Re: Flex BlazeDS based Poker game
                      rjoshicool Community Member

                      1. We are using the Turnkey version of BlazeDS. Do we need threading for handling multiple sessions?

                      2. Basically I want to maintain in sync the hibernate session and the BlazeDS session.

                      3. OK

                       

                      Meanwhile, I was looking into SmartFox Server and think that there are many items which it can handle itself. Also, it is a popular MMO solution being used. Will the switch be a smart choice?

                      • 8. Re: Flex BlazeDS based Poker game
                        rjoshicool Community Member

                        To add to this, here is how I think this system would work:

                        1. I maintain a DB Table of Poker Games
                        2. Each game has multiple Poker Tables. These tables are also maintained in the DB
                        3. A player goes to a Poker Game and selects one to join it.
                        4. On clicking join, player will be positioned on one of the tables with available seat. This will be updated in the DB Table corresponding to this Poker Table.
                        5. Once the person joins, his session will be created with the server.
                        6. Lets say Another user joins same game room and is now seated on the same table as the previous user.
                        7. We know that who else was seated on this Poker Table through the corresponding DB Table, so we update the first user with the new user's entry and the new user with the existing user's entry on their respective screens.
                        8. Now, whenever there is a new move on that table, we update it to all users who are connected to that table.

                         

                        Let me know if this is the correct approach.

                        • 9. Re: Flex BlazeDS based Poker game
                          moccamaximum Community Member

                          From your last posting I get the impression that you might be well advised if you first dig into the basics of database management before you try to solve the high-level probems you are facing.

                          No offense, but sentences like"Each game has multiple Poker Tables. These tables are also maintained in the DB" give the impression that you have a seperate database table for every poker table in your game (it is quite confusing to seperate the meaning of your words as you keep using "table" in this ambivalent manner, try to stay away from such fallacies).

                           

                          If you really setup different tables then read up on "Normalization" and why having double-entries is a death-sentence for every database.

                           

                          also read up: Views, Primary Keys and what their role in DB Managament is.

                          • 10. Re: Flex BlazeDS based Poker game
                            rjoshicool Community Member

                            Yes, I lack a bit in the db management concepts. About the db strcuture, there is no separate DB table for each Poker Game Table. All the Poker Game Tables reside in one DB Table as rows. This helps me keep track of what is happening on each Poker Table at DB level.

                             

                            I am following the concpet which is usually there in major Poker games like PokerStars.com:

                            1. A lobby of Games
                            2. Each Game has multiple Poker Tables
                            3. Each Poker Table has multiple Users
                            • 11. Re: Flex BlazeDS based Poker game
                              migueldiab Community Member

                              1. Yes and no. Tomcat will handle threads for you. Each request will most likely be allocated to a thread.

                               

                              2. No, you don't need to have those in sync. More specially if you are going to use a cache layer.

                               

                              I don't really now about SmartFox sorry

                              • 12. Re: Flex BlazeDS based Poker game
                                migueldiab Community Member

                                1. As long as you have your data, you can keep it as you wish. Your MER should be done by someone with DB knowledge and Normalization in minda as moccamaximum said.

                                 

                                2. I think this is wrong. Each game having multiple "physical tables" makes no sense, nor does each game having multiple "database tables"

                                 

                                3. Ok...

                                 

                                4. Ok...

                                 

                                5. Probably not.. most likely you will have the session already before that.

                                 

                                6. Ok

                                 

                                7. Again, I would not rely for this on the DB but try to have a game engine.

                                 

                                8. Ok

                                • 13. Re: Flex BlazeDS based Poker game
                                  pauland Community Member

                                  Rjoshicool, I think people are misinterpreting your explanation (simply because of the crossover of terminology) and you are on the right track.

                                   

                                  If I understand it correctly:

                                   

                                  You have a multiple number of poker Games. These are Tournaments rather than individual games.

                                   

                                  Each tournament has multiple poker tables associated with it and multiple players on each poker table. All players are associated with a tournament, game and table. This association is going to change over time and for the tournament as a whole.

                                   

                                  Database tables:

                                   

                                  You will need at least

                                   

                                  A tournament table, a poker_table table, player table, game_table. You are going to need a load of other tables to hold information about anscillary items perhaps - for example there may be a league, poker_team, etc. I don't know.

                                   

                                  In a multiple user system you need to take care of people disconnecting unexpectedly, wanting to get back to a game if accidentally disconnected, wanting to pause play, chat, etc.

                                   

                                  Most importantly you must be able to prevent concurrent updates of the database tables since you have multiple players effectively updating the state of a game/table.

                                   

                                  It can all get quite complex, quickly.

                                  • 14. Re: Flex BlazeDS based Poker game
                                    rjoshicool Community Member

                                    Hey Pauland,

                                     

                                    That sounds something very similar to what I have been thinking. Also, looks like you have been playing poker games

                                    So, coming back on the technical side, I am facing issues managing user sessions in BlazeDS and sending required data on the client side, to correct table. Any pointers to examples/tutorials?

                                    • 15. Re: Flex BlazeDS based Poker game
                                      pauland Community Member

                                      I don't play poker. I used to play bridge.

                                       

                                      I'm afraid I don't have any examples/pointers/tutorials to offer.

                                       

                                      You say you have issues with BlazeDS (which I haven't used), but not specifically what they are, so even BlazeDS users can't really offer any advice to generic, unspecific problems.

                                       

                                      It sounds like you have an overal grasp of the problem but are failing in using the technology stack to achieve what you want, so it's more about a a BlazeDS problem, not a poker software one.

                                      • 16. Re: Flex BlazeDS based Poker game
                                        rjoshicool Community Member

                                        I feel you are correct to some extent. The problem is how to implement things in BlazeDS instead of how game logic will be implemented. The issues I face right now with blazeDS is: How to broadcast data to each poker game table when a move is made or a person joins the table. I using the multicasting feature but doesn't seems to work well.

                                        • 17. Re: Flex BlazeDS based Poker game
                                          pauland Community Member

                                          If that was my issue I would create a small test system with no game logic at all, using BlazeDS to broadcast status changes from a database table to a load of listeners. I would focus entirely on making that work on it's own. Your project cannot work without that mechanism in place, so ignore the rest, focus on that.

                                           

                                          Get that mechanism working outside of the main project, then integrate it.