Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. How to make a database with various levels?
Forum Updated to NodeBB v4.3 + New Features

How to make a database with various levels?

Scheduled Pinned Locked Moved Game Development
6 Posts 4 Posters 3.3k 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.
  • T Offline
    T Offline
    tommyj23
    wrote on last edited by
    #1

    Hi, I´m creating a simple game that have multiple lvls, and this levels should be blocked until you pass the first lvl with a minimum score, how to do this if the game have 4 separated sites with 15 levels for each site, the gameengine is created in javascript and qml for the lvls, how I make to save the score, with a database for each lvl?
    the levels are independent, one lvl and when you pass it, load other level, I have a selection menu for select the lvls.

    Thanks for this.
    other question, al lvls are moved by 1 timer, when I make some multimediakit soundeffect (a explosion) the timer apears to be freeze a few moment and all of the images freeze, when the music stops its the same,stops 1 or 2 frames and later all works ok, the cpu of the mobile is in 65% with sounds, what happening? the timer moves 14 items at the same time.

    thanks for all and sorry for my english.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      [quote author="tommyj23" date="1329152284"] how I make to save the score, with a database for each lvl?
      [/quote]

      Qt offers drivers for "several databases":http://developer.qt.nokia.com/doc/qt-4.8/sql-driver.html. I recommend you to use "SQLite":http://www.sqlite.org/

      http://anavi.org/

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tommyj23
        wrote on last edited by
        #3

        yes this is that I think, but, 1 database for 1 level? because my game have 15 lvls at the beginning but later may be have more... at the moment I create 4 database for the first 4 levels and it runs ok because you need to have a minimum of score to unlock the next lvl, the test are good at the moment.
        Is there another way to do this?

        The other think that give me headache is the timer that freeze when I play the sound I dont know why it freeze...

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          Why do you need to have one database per level? The fact that you have to reach a certain condition to move to the next level should have no bearing on how your database is designed and accessed.

          Perhaps you need to rethink your database design and core game level logic.

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            q8phantom
            wrote on last edited by
            #5

            XML Files are nice

            I use one xml which contains basically the names of all other xml files or levels, then if the user selects a level I load the xml file for that level! ie

            all_levels.xml

            <level xml=level1.xmll>
            <level xml=level2.xmll>
            <level xml=level3.xmll>
            <level xml=level4.xmll>

            Bests

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tommyj23
              wrote on last edited by
              #6

              I see that way in the qt-flying bus example, but I make the lvls with qml, and one loader that read a signal next game and change the level, but the way to make that the level-loader read the scores of each level is this that I dont know how to do.
              I do this to make one database to the first lvl:
              @function guardardatos() {
              var db = openDatabaseSync("lvl1", "1.0", "primerlvl", 1000000);
              var rs;

              db.transaction(
                  function(tx) {
                      // Create the database if it doesn't already exist
                      tx.executeSql('CREATE TABLE IF NOT EXISTS Niveluno(uno INT, dos INT)');
              
                      // Add (another) greeting row
                      tx.executeSql('INSERT INTO Niveluno VALUES(?, ?)', [ recto.score, recto.burbujas1]);
                      // Show all added greetings
                      rs = tx.executeSql('SELECT * FROM Niveluno ORDER BY uno desc LIMIT 1');
              
                  }
              )
              
              if (rs.rows.length > 0) {
                  var record = rs.rows.item(0);
                  recto.lvl1 = record.uno;
              }
              

              }@

              When the lvl ends I write 2 values: the score and and the quantity of bubbles eated,
              lather I created a other datbase called guardarDatos1() for the lvl 2 etc..., when I start the game one Timer reads all the databases and update the scores in the levelmenu and show which is active, pased with his score and which is bocked to the user. I dont know other form to make this, and in C++ buff is other world.

              if other knows other form to do this please explain me!!

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved