Game programming: levels?

Discussion in 'Off-Topic' started by khaos, Mar 21, 2011.

  1. khaos

    khaos DnB'addict

    So I wanted to make a small text RPG, to train my programming skills.
    But as we have only just started with loops at school, I don't know enough about programming :3

    Well, I started this project anyway.
    It's in VB.NET, because that's what we learn at school, and I don't want to learn another language just yet because I'm definitely going to mix it up.

    After making my interface and testing out things like hp and such I ran into the first problem: a leveling system.
    I went searching for information, but I find almost nothing that's documented enough.
    Then I figured out there are 2 basic ways of doing so; with a loop or with a table.
    I think it's easiest for me to go with the table. How do I create a table like this in VB.NET? And how do I check my current xp to the xp needed for the next level?

    Even if you don't know VB.NET, please add something in a language you do know :)

    Thank you!
     
  2. narfi

    narfi Lost

    Could you have it so that the player had to manualy level up after enough experience had been reached?

    Then your game wouldnt need to keep track of it, and its more "game play" for the user.

    if its a simple one variable for experience, then you could set the level requirements (something like 10exp for lvl 1, 50 for lvl 2, 100 for lvl 3, etc...) or whatever seemed fair.

    Then the player would have to either go to a "trainer" or just a simple "lvl up" button and request a level up. The "trainer, or game menu" would verify that he had enough points for the next level and then his lvl variable would be changed.

    I dont know much (really anything) about programming, so maybe im completely going the wrong direction, but it is an idea, dont know if it will help or not :)

    gl with your project and have fun,
    narfi
     
  3. khaos

    khaos DnB'addict

    That's actually a pretty good idea!
    Going to try that now.
    Maybe when I have this finished, I'll find a way to automate it :)
    Thanks!
     
  4. GeorgeSkywalker

    GeorgeSkywalker Explorer

    *** Ace levelling program 101 ***


    Initialise Exp
    Exp= 0


    If action then Exp= Exp+1

    If Exp=50 then





    *** ok that's as much as my programming memory allowed me to write :D
     
  5. khaos

    khaos DnB'addict

    Thought of that as well.. But what if I want to have a maximum level of 1000? It's kinda boring to make a select with 1000 cases.
    BTW. I'll probably use a formula to calculate it, so it's not linear
     
  6. NotAdmin

    NotAdmin Administrator

    You wouldn't do 1000 selects. Gathering from what you said earlier, you do not have too much experience in vB yet. The easiest way to do what you want would be by first figuring out how you want the level progression to be.

    Then you simply test whether the current level meets the condition. Say for now that you decide that every even level equals a ding. You can then add a check to the code where you raise the level or experience along the lines of the following:

    myExp++
    If myExp Mod 2 = 0 Then
    MsgBox "Ding!"
    End If

    One check will do the trick that way :-)
     
  7. khaos

    khaos DnB'addict

    Thanks for the input everyone!
    Have figured out a function by now;

    Private Sub Level()

    For x = 1 To intLevel + 1
    intNextLevel = 1.75 * intLevel ^ 2
    Next
    If intXP > intNextLevel Then
    intLevel += 1
    End If
    lblLevel.Text = intLevel
    Me.Invalidate()

    End Sub
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.