Thread: Tool for RPG

    #16
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    I guess we could have an on-line tool, but that could involve more work than if it was totally on each GM's PC. However, if it WERE on-line, it could have shared GMs that could access shared data (but we would still not want GM1 able to get to data that they are not authorized to access). Are you suggesting we go with something on-line? Applets or a Thomcat/Glassfish (which I know nothing about) based "thing"? I have some experience with on-line db and web interfaces from work, but the db I use there sits on a Unix box and is never uploaded/downloaded/turned on/off. If you think this is the way to go, I could likely be talked into this. I would need to invent a security system of some type, but I could likely get something on-line (lots of LAMP and WAMP stuff out there). If we go with a MySQL db, I would need to figure out how to:
    1) turn off the on-line db
    2) upload my changes to GLOBAL control tables (weapons, armor, other equipment), etc.
    3) do NOT clobber USER tables (characters, characterSkills, characterEquipment, etc)
    4) turn the db back on

    I am sure this is not a big deal - I just haven't done this myself - but I can learn.

    Ultimately (way down the line) it would be nice to have a drag and drop interface for adding/removing equipment - but that is a long way off (if ever).
  2. #17
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    Online is not necessary, I am just trying to visualize how the databases are going to be passed around. I guess the problem I am having is just that I don't understand how the game works. Not a huge deal. For now I will focus on writing a Java application which can read from an Access database and display the data using Swing components.

    Speaking of Swing, what type of Swing components would you like to use? (i.e. Have you already started programming that part?) If you haven't, probably the simplist thing to use will be JTable's to display data (perhaps set inside a JScrollPane if there is a lot of data to display), and JTextField's for data input. The page layout could be controled by placing individual tables or fields inside of JPanel's.
  4. #18
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    I have not started anything with NetBeans yet, but I could put together something over the next day or two. Unfortunately, we have to build the foundation tables before we can actually work on the combat stuff (since the combat is fed by everything else).

    Would you like me to throw something together? I would start with the character interface, followed by skills, then equipment.
  6. #19
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    That sounds like a good idea, at least to get you familiar with using Swing and trying out different layouts. I recently wrote a basic program for someone to help him learn how to edit and display a small table of data using two different JFrames. You might find it useful to reverse-engineer (it also highlights how easy it is to fill in Swing components with data, which is something we will be doing in this application)

    Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    public class ReturnToCallerExample
    {
        ViewDataJFrame viewFrame = null;
        EditDataJFrame editFrame = null;
        
        // Define the column names:
        String columnNames[] = { "Column 1", "Column 2" };
        // Define the table size and initial data values:
        String[][] data = 
        {
            { "Cell 0, 0", "Cell 1, 0", },
            { "Cell 0, 1", "Cell 1, 1" }
        };
        
        public static void main(String[] args)
        {
            new ReturnToCallerExample();
        }
        
        public ReturnToCallerExample()
        {
            // Create the two JFrames:
            viewFrame = new ViewDataJFrame( "View Data", 400, 130 );
            editFrame = new EditDataJFrame( "Edit Data", 400, 130 );
            
            // Make sure application shuts down when the window closes the ViewDataJFrame:
            viewFrame.addWindowListener( new ExitListener() );
            
            // Make the ViewDataJFrame visible:
            viewFrame.setVisible( true );
        }
        
        public class ExitListener extends WindowAdapter
        {
            @Override
            public void windowClosing( WindowEvent event )
            {
                System.exit(0);
            }
        }
        
        private class ViewDataJFrame extends JFrame implements ActionListener
        {
    	private	JTable table;
    	private	JButton button;
            public ViewDataJFrame( String title, int width, int height )
            {
                super( title );
                setSize( width, height );
                
                // Create the table and place it into a JScrollPane:
                table = new JTable( data, columnNames );
                JScrollPane tablePane = new JScrollPane( table );
                
                // Create the button and place it into a JPanel:
                button = new JButton( "Edit" );
                button.setActionCommand( "click" );
                button.addActionListener( this );
                JPanel buttonPane = new JPanel();
                buttonPane.setLayout( new FlowLayout() );
                buttonPane.add( button );
                
                //Put everything together into the content pane:
                Container contentPane = getContentPane();
                contentPane.add(tablePane, BorderLayout.CENTER);
                contentPane.add(buttonPane, BorderLayout.PAGE_END);
            }
            
            public void updateTableData()
            {
                // update the table data:
                table.setValueAt( data[0][0], 0, 0 );
                table.setValueAt( data[1][0], 1, 0 );
                table.setValueAt( data[0][1], 0, 1 );
                table.setValueAt( data[1][1], 1, 1 );
            }
            
            public void actionPerformed( ActionEvent e )
            {
                if( e.getActionCommand().equals( "click" ) )
                {
                    editFrame.updateTextFields();
                    editFrame.setVisible( true );
                }
            } 
        }
        
        private class EditDataJFrame extends JFrame implements ActionListener
        {
    	private	JTextField textField_x0y0, textField_x1y0, textField_x0y1, textField_x1y1;
    	private	JButton button;
            
            public EditDataJFrame( String title, int width, int height )
            {
                super( title );
                setSize( width, height );
                
                // Create the JTextFields and place them into a JPanel:
                textField_x0y0 = new JTextField( 10 );
                textField_x1y0 = new JTextField( 10 );
                textField_x0y1 = new JTextField( 10 );
                textField_x1y1 = new JTextField( 10 );
                JPanel textPane = new JPanel();
                textPane.setLayout( new GridLayout( 2, 2, 10, 10 ) );
                textPane.add( textField_x0y0 );
                textPane.add( textField_x1y0 );
                textPane.add( textField_x0y1 );
                textPane.add( textField_x1y1 );
                
                // Create the button and place it into a JPanel:
                button = new JButton( "Done" );
                button.setActionCommand( "click" );
                button.addActionListener( this );
                JPanel buttonPane = new JPanel();
                buttonPane.setLayout( new FlowLayout() );
                buttonPane.add( button );
                
                //Put everything together into the content pane:
                Container contentPane = getContentPane();
                contentPane.add(textPane, BorderLayout.CENTER);
                contentPane.add(buttonPane, BorderLayout.PAGE_END);
            }
            
            public void updateTextFields()
            {
                // fill in the text fields:
                textField_x0y0.setText( data[0][0] );
                textField_x1y0.setText( data[1][0] );
                textField_x0y1.setText( data[0][1] );
                textField_x1y1.setText( data[1][1] );
            }
            
            public void actionPerformed( ActionEvent e )
            {
                if( e.getActionCommand().equals( "click" ) )
                {
                    // apply the changes:
                    data[0][0] = textField_x0y0.getText();
                    data[1][0] = textField_x1y0.getText();
                    data[0][1] = textField_x0y1.getText();
                    data[1][1] = textField_x1y1.getText();
                
                    // update the ViewDataJFrame's table
                    viewFrame.updateTableData();
                    
                    // close the EditDataJFrame:
                    setVisible( false );
                }
            } 
        }
  8. #20
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    Now that I have had a chance to look at the JDBC-ODBC documentation a little more closely, I have another question for you. The way the thing works is there is a server and a client. The server connects to the actual database, and requires installation of drivers on the host machine. The client is completely Java and does not require anything seperate installed on the computer.

    So what this means is there are two ways we can make the program:

    1) We can (as you suggested) have both the database and the program on the GM's computer. This would be the easiest way to make the program, but would require them to install the EasySoft JDBC-ODBC server drivers on their computer before the program would work. They would need to create an account with easysoft.com to download the server software.

    2) We can install the server drivers on one computer (along with the database) and have the client programs connect to it remotely (either as an application through TCP-IP or an applet). This would require someone to host the database and server drivers, and all GM's running the program would connect to that one computer.

    I suspect that option #1 is the easiest way to go, but I wanted to get your input on this first.
  10. #21
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    More bad news. To install the server software, you must purchase a license. That being the case, Option #2 would be to only logical choice. I'll search around to see if I can find a free method for connecting to an Access database. We may end up having to use something more widely supported like MySQL.

    Another quick question: Do you intend to sell your program, or will it be freely available. If it is free, then you could potentially use GPL licensed stuff. I found a free GPL-licensed library for connecting to a mySQL database but nothing for Access, as of yet.
    Last edited by paulscode; October 22nd, 2008 at 04:16 PM.
  12. #22
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    I was thinking it would be free. Since I do not own the original game, I likely could not profit from any of this stuff w/o a bunch of legal mumbo-jumbo. I will make more inquiries along those lines, but I have not found who truly owns the rights to this game. I get lots of "last I heard..." and "I think..." but no definitive answer. About 4 years ago, I knew and asked if they would sell, but they said no, and I have lost that info due to multiple PC upgrades (you know how it goes). Maybe we could charge a nominal fee (which I would of course share with you).

    We don't need an Access db. I was just using it as a tool to build some data and link it all up for a testbed. I could export the stuff tables and re-load them into MySQL (and vise versa). In the past, I had a bunch of this in a WAMP setup on my PC. I used an ODBC driver to connect Access to MySQL which was nice. The only problem was that if I made any change to the db structure in MySQL, I had to rebuild all the fancy stuff in Access (that got old fast).

    The ultimate way to do this would be to let the user choose the db they like, let them set it up, import some basic data from txt files I supply, then you are free to add to your chosen db; Access, MySQL, DB2 (dream on), etc.

    I am also working on a basic character input screen to give you an idea of how this will work.

    I played a little with your code sample at work. I will play with it more tonight (if the kids let me).
  14. #23
  15. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    On an unrelated note, I wrote an applet that does a simple triangle fractal. It's pretty cool. The formula is very simple, but it does not paint what you would expect.
  16. #24
  17. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    My personal opinion is that this program should be free. There are a couple of reasons why. Firstly, it is probably unlikely that you will be able to obtain the rights for the game (however if you do, that could change things). Secondly, open-source libraries are often restricted to the GPL license, requiring projects built from them to be free and open-source. These libraries tend to be better supported and you have a better selection.

    Obviously, if you manage to gain the rights to the game, you might reconsider this, but for now I suggest we use the library I downloaded for mySQL which is free and open-source. We should write for only mySQL to start with, and perhaps add other databases later. Libraries for using an Access database appear to run between $100 - $300 to license them on a single computer, which is a bit high in my opinion.

    Do you have access to a mySQL server (through a web hosting service or something)? If not, I do have access to one, so if you provide me with what database tables to create, I can set that up.
  18. #25
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    I completely agree with the free thing, and for the same reasons. Everyone can afford free. Based on that, should we look to having this ONLY on-line? It would be more work upfront for the security stuff, but once done (if done right), you just plug it in and it works. I am a strong proponent of spending the extra effort to get the job done right the first time out.

    I have not used MySQL in about a year or so, but could download another copy (it's free!). It's a good product. So is the admin tool from SourceForge! There might be other good tools for it that have come out since I last played with it.

    Do you want me to have:
    1) an on-line MySQL server,
    2) a personal copy running on my PC,
    3) or both?
    I am almost certain that my web site (at GoDaddy) supports it. In fact I have a domain dedicated to this game, but never did much with it. I have never put a MySQL db on-line, but that is mainly due to the direction I was taking at the time.
  20. #26
  21. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    It would probably be smart to have the MySQL server on-line, if GoDaddy supports it. I think it would be ideal to design the program so that it connects to a single central database, so that you are not requiring all users to install MySQL on their computers.

    One other thing, do you think it is likely for there to be higher traffic than your hosting package is set up for? If so, you might want to design it as an applet after all, so that you could recover any additional hosting fees by placing a google ad on the page.
    Last edited by paulscode; October 22nd, 2008 at 10:43 PM.
  22. #27
  23. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    OK, on-line it is.

    Here's my next dumb question:
    I assume I should download MySQL, build the tables, populate them with some basic data, then upload them once they are built. Is that correct? How do you control/manipulate the tables once they are on-line?

    I will likely contact GoDaddy later today for some help setting this up.
  24. #28
  25. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    SW Ohio
    Posts
    64
    Rep Power
    11
    I logged into my GoDaddy account and see how I need to build a new MySQL db on-line. I will play with that more after work. More dumb questions to follow.

    What kind of access will you need to the web site?

    I do not expect there will be a lot of traffic, at least for a while.
  26. #29
  27. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50
    On my web hosting service (1&1), I usually edit MySQL databases by logging onto their servers with SSH ( I use PuTTY, which can be downloaded at http://www.chiark.greenend.org.uk/~s.../download.html ). This is something you might be able to look into to see if GoDaddy lets you do something like that.

    As for accesses for the website, I suppose you are talking about the directory the files are sitting in. They won't need any special access, so a normal 755 (rwxr-xr-x) would be fine (i.e. no reason to give people "write" access). The only writing they will be doing is to the database, which operates seperately from the website permissions.
  28. #30
  29. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Location
    Fort Meade, MD
    Posts
    170
    Rep Power
    50

    Using MySQL and PuTTY with GoDaddy


    I found these instructions for setting up a MySQL database:

    1) Log in to your Account Manager.

    2) In the My Products section, select Hosting.

    3) Next to the hosting account you want to modify, click Manage Account.

    4) In the Databases section of the Hosting Control Center, click the MySQL icon.

    5) Click Create New Database.

    6) Enter a user name and password, and then click Continue.

    7) Verify your MySQL database settings. If everything looks OK, click Create Database.

    It may take a few minutes to create your database. Click your browser's Refresh button to check if your database is ready.

    Once you have set up a database for your account, you can find your host name information by clicking the Pencil icon next to the name of your database.
    I also found the following information about accessing your Linux server with the PuTTY SSH client I mentioned:

    1) Open Putty and select SSH. The default port is changed to 22.

    2) In the Hostname or IP Address field, enter your IP Address.

    3) Click Open. The command line window displays.
    NOTE: The first time you log in to the server, the Putty Security Alert displays. Click Yes to approve the connection.

    4) At the login as: prompt, enter your user name.

    5) At the password: prompt, enter your password.

    6) If you need root access, type su - and enter your password again.
    Oh, and I forgot to mention, once you have logged in to the server with Putty, you would then log into MySQL from the command prompt like this:

    Code:
    mysql -h hostname -u username -p database
    (of course you would replace hostname, username, and database with the correct values). From there you can start setting up your database, adding tables, etc.
    Last edited by paulscode; October 23rd, 2008 at 04:07 PM.

IMN logo majestic logo threadwatch logo seochat tools logo