Announcement

Collapse
No announcement yet.

Database up and running

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

  • Database up and running

    Alright I am a day or two late but, as promised, a temporary database with the tournament settings is now up and running. If you are interested in participating, it will certainly benefit you to start getting familiar with the game and it will also really help me to make sure everything is running as expected.

    To create an account, head over to our "training wheels" interface at https://schemaverse.com/tw/

    Once you have created your account, you can keep using /tw/, or you can start using any client/programming language with PostgreSQL support.



    Things to keep in mind:
    -This is only for testing/learning, all game data will not be carried over to the tournament database

    -Use any client/language you please but you may want to make sure it has SSL support by the time you get to DEFCON.

    -/tw/ will likely not be running for the tournament. I haven't decided on this though.

    -The system isn't perfect. You are welcome to use this fact to your advantage during the tournament. However, if something isn't working or simply feels wrong and it's not going to help you out, please share here so that I can fix it.


    Connection Details
    host: schemaverse.com
    post: 5432
    database: schemaverse


    -Abstrct
    http://defcon.schemaverse.com

  • #2
    Re: Database up and running

    Since starting seems to be the toughest part of this game. Here is a nice little SQL script that will set you up to start mining your home planet.

    Code:
    -- Step 1 - Create 2 ships at the location of your player's starting planet
    -- This step will cost you $2000 from your starting balance 
    INSERT INTO my_ships(name, location_x, location_y) 
    	SELECT 
    		'Home Miner',
    		planets.location_x, 
    		planets.location_y
    	FROM generate_series(1,2), planets 
    	WHERE planets.conqueror_id=GET_PLAYER_ID(SESSION_USER);
    
    
    -- Step 2 - Upgrade each ships mining ability an extra 100
    -- 100 points per ship (at $25 per point) will cost $5000
    SELECT UPGRADE(id, 'PROSPECTING', 100) from my_ships WHERE name='Home Miner'; 
    
    
    -- Step 3 - Create a fleet that will run while you're not paying attention
    INSERT INTO my_fleets(name) VALUES('My Home Fleet'); 
    
    -- Step 4 - Update the fleet to do something
    UPDATE my_fleets
    SET
     script_declarations= 'miners RECORD; ',
     script='
    FOR miners IN SELECT my_ships.id as ship_id, planets.id as planet_id FROM my_ships, planets 
    	WHERE my_ships.location_x=planets.location_x AND my_ships.location_y=planets.location_y
    LOOP
        PERFORM MINE(miners.ship_id, miners.planet_id);
    END LOOP;
    ',
      enabled='t'
    WHERE
     name = 'My Home Fleet';
     
    -- Step 5 - This will buy one minute of automated processing time per tic
    -- Total cost is $10000000
    SELECT UPGRADE(id, 'FLEET_RUNTIME', 1) FROM my_fleets;
    After you run this script, you will start to build a wealth of fuel. Use the convert_resource() function to convert fuel into money that you can then use to continue building your fleet.

    Comment


    • #3
      Re: Database up and running

      I was hoping to edit my previous message but I seem to have missed the timeframe for doing so. Instead, I have uploaded a new version of the script to my server so you can download the latest edition without me spamming these forums with large chunks of code.

      Find the latest and greatest Getting Started script here: http://schemaverse.com/GettingStarted.sql

      Does nothing you see in the script make any sense at all but your still curious about the game? Don't forget to have a glance at the game's Guide and you can always ask me questions here.

      -Abstrct
      http://defcon.schemaverse.com

      Comment


      • #4
        Re: Database up and running

        I've been having trouble with movement.

        if I try to select move(), like so:
        Code:
        select move(1775,1,null,-226,-3245);
        I get back neither 't', nor 'f', but
        Code:
        The following error occured during execution:
        ERROR: query string argument of EXECUTE is null
        CONTEXT: PL/pgSQL function "move" line 135 at EXECUTE statement
        
        The original query was:
        execute
        if I try to update the headings directly, with a speed, direction, destination_x, and destination_y, then my ships move, but after 1 tic they stop (0 speed), but have still used up the fuel. I thought that after ships accelerated to speed, they continued until you stopped them?
        It's not stupid, it's advanced.

        Comment


        • #5
          Re: Database up and running

          Originally posted by YenTheFirst View Post
          I've been having trouble with movement.

          if I try to select move(), like so:
          Code:
          select move(1775,1,null,-226,-3245);
          I get back neither 't', nor 'f', but
          Code:
          The following error occured during execution:
          ERROR: query string argument of EXECUTE is null
          CONTEXT: PL/pgSQL function "move" line 135 at EXECUTE statement
          
          The original query was:
          execute
          if I try to update the headings directly, with a speed, direction, destination_x, and destination_y, then my ships move, but after 1 tic they stop (0 speed), but have still used up the fuel. I thought that after ships accelerated to speed, they continued until you stopped them?
          I just tried to take a look at that ship and it no longer exists (a new round started today) so I can't fully debug the issue but I can give some answers about what was likely first going on.

          My hope is that the error you showed below was because of the ship no longer existing. Try to create a new ship and then issue the move command again and see if you are coming across the same issue. I will fully admit that of all the commands in the system MOVE tends to be the most buggy so please keep us posted on this issue. Any other details you can offer (ships current x,y,speed, direction) is extremely helpful for squashing bugs.

          As for the ship stopping, this is to be expected if you have a destination_x and destination_y set. Once the ship is within range of this destination, it will stop (set speed=0). If you would like to to go and never stop, update destination_x and destination_y to be NULL.

          I hope that helps. As I mentioned, if you do keep running into the issue please post again to keep me updated. There are some weird corner cases in MOVE that I would love to fix before DEFCON.


          Thanks
          -Abstrct

          Comment


          • #6
            Re: Database up and running

            hmm. today, the move() command seems to work, more or less.

            As for the ship stopping, this is to be expected if you have a destination_x and destination_y set. Once the ship is within range of this destination, it will stop (set speed=0). If you would like to to go and never stop, update destination_x and destination_y to be NULL.
            this seems to be a bit annoying/unexpected, though. If I have a ship on (0,0), and I want to move it to (200,0) at speed 10, it will use up 20 fuel and move to just (10,0). I suppose this is because it's now 'in range' of (200,0), I was expecting it to actually get itself to (200,0).
            It's not stupid, it's advanced.

            Comment


            • #7
              Re: Database up and running

              Originally posted by YenTheFirst View Post
              this seems to be a bit annoying/unexpected, though. If I have a ship on (0,0), and I want to move it to (200,0) at speed 10, it will use up 20 fuel and move to just (10,0). I suppose this is because it's now 'in range' of (200,0), I was expecting it to actually get itself to (200,0).
              Fair enough, it becomes more useful when ships start traveling longer distances though. Otherwise you blow past the destination sometimes.

              Also keep in mind that you can actually create ships anywhere you want within the range 3000 and -3000 (x and y). Outside of that range you must create the ships on the same coordinates as planets you currently have conquered.

              If fuel is an issue for you, make sure you start building on your home planet first. (SELECT location_x,location_y FROM planets WHERE conqueror_id = GET_PLAYER_ID(SESSION_USER);)

              Your home planet is likely pretty far from other planets so it is a safe place to mine and prepare for battle in the centre of the map. Investing in prospecting skill on your miners will also drastically improve the mount of fuel you take in each tic.

              -Abstrct

              Comment


              • #8
                Re: Database up and running

                possible bug:

                I set a ship in motion with update my_ships.
                ship id 10348, direction 0, speed 100.

                as far as I can tell, current_fuel was never deducted. it's still 100, and I never refueld.
                It's not stupid, it's advanced.

                Comment


                • #9
                  Re: Database up and running

                  Originally posted by YenTheFirst View Post
                  possible bug:

                  I set a ship in motion with update my_ships.
                  ship id 10348, direction 0, speed 100.

                  as far as I can tell, current_fuel was never deducted. it's still 100, and I never refueld.

                  Yup, definitely a bug. Nice find :D
                  Thanks Yen!

                  I will tackle that one tonight. Until then, I am sure everyone will use the honour system and only move using the MOVE function and not directly update the speed column in my_ships.

                  Comment


                  • #10
                    Re: Database up and running

                    incidentally, should I keep reporting any bugs I find here, or would you prefer them on the github bug tracker, to keep the forum clean-ish?
                    It's not stupid, it's advanced.

                    Comment


                    • #11
                      Re: Database up and running

                      Value in both:

                      By reporting bugs here, it naturally keeps the thread active to draw attention to this contest.

                      By reporting the bugs here, other people learn about them and may exploit them.

                      By reporting bugs there, bug tracking is visible and there is no need for double-entry and double-response to issues.

                      Comment


                      • #12
                        Re: Database up and running

                        Originally posted by TheCotMan View Post
                        Value in both:

                        By reporting bugs here, it naturally keeps the thread active to draw attention to this contest.
                        true, but it could also be noise.
                        Originally posted by TheCotMan View Post
                        By reporting the bugs here, other people learn about them and may exploit them.

                        By reporting bugs there, bug tracking is visible and there is no need for double-entry and double-response to issues.
                        on github, the bugs are still publicly viewable, and anyone can learn about them, and exploit them (if not patched before the contest.) Even if not for the bugs, anyone seriously interested should probably be checking out the source code there.

                        The biggest negative, IMO:
                        There may exist players who have a DEFCON forum account, but not a github account, and thus could not report a bug without registering.


                        As an aside: Given their nature, I'm not concerned with exploitation of bugs I've publicly reported so far.
                        It's not stupid, it's advanced.

                        Comment


                        • #13
                          Re: Database up and running

                          If the forum mods don't mind it being discussed here, I certainly don't mind it as well!
                          It is the best way that my mistakes can at least help to generate interest in the game ;)

                          If you find something more serious though that you rather deal with privately, please feel free to email josh at schemaverse dot com


                          As for the actual bug that we were discussing, my night last night ended up being focused on some other more serious bugs. Tonight, as long as I can eventually leave the office, I hope to tackle this bug and go over all the other rules to try and find any other slip ups.

                          Again, I fully expect that everybody will adhere to the honour system and only use MOVE() until the my_ships update rule is fixed.

                          Comment


                          • #14
                            Re: Database up and running

                            Originally posted by Abstrct View Post
                            If the forum mods don't mind it being discussed here, I certainly don't mind it as well!
                            It is the best way that my mistakes can at least help to generate interest in the game ;)
                            I won't speak for all of the mods, but I find no problem with this, and would go so far as to say it is healthy for the forums to have discussions like this here; it encourages participation, speaking up, and increases the chances that various players will network with each other.

                            I approved this message. :-)

                            Comment


                            • #15
                              Re: Database up and running

                              edit: it's no longer doing this, I guess it resolved itself . .?

                              this should speak for itself:

                              select balance, fuel_reserve from my_player;
                              0, 159680

                              select convert_resource('FUEL',1);
                              [no response]

                              error stream:
                              [Error] You do not have that much fuel to convert
                              Last edited by YenTheFirst; July 28, 2011, 14:24.
                              It's not stupid, it's advanced.

                              Comment

                              Working...
                              X