Search Unity

How do I make a Infinite weapon generation system? (Borderlands-esk)

Discussion in 'Scripting' started by BreakofHavoc, Nov 26, 2014.

  1. BreakofHavoc

    BreakofHavoc

    Joined:
    Nov 26, 2014
    Posts:
    4
    I'm really new to this kind of stuff, honestly my friend has just been teaching me. And I was just wondering if there is a way I can make a weapon pool type deal like Gearbox and 2K's famous "Borderlands" series?
     
  2. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Get some resizable gun parts that are adjusted by code. Make a few variables that affect gun stats, and adjust them by code. Mix those two systems and you're set.

    If you're new, I would focus on either making modular gun parts or the variable weapon stat parts.
     
    BreakofHavoc likes this.
  3. BreakofHavoc

    BreakofHavoc

    Joined:
    Nov 26, 2014
    Posts:
    4
    Thank you so much! do you happen to have any pre-written coding i could use or is this gonna be hours of extra work?
     
  4. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    If you want something AAA-quality, yes it's going to take a lot of work! Check out this dev blog that lays out exactly how loot rolls in Borderlands 2 works.
    http://www.gearboxsoftware.com/community/articles/1087/inside-the-box-the-borderlands-2-loot-system

    That's probably overkill for you. Just thought I'd stop by with this link. Yeah, not very helpful I know. >.>

    EDIT: Re-reading your post, you're asking about randomizing the weapons themselves, not how to pick which weapon to drop as loot. You might still get some insight into the weapon stats part of it, but it's not exactly what you're asking for.
     
    Last edited: Nov 26, 2014
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's -esque

    /grammar nazi
     
  6. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    My lazy, phonetic eyes went right past that mistake D: I feel so ashamed...

    You could make a weapon property script. Here's something so basic that I wrote it line by line in the insert-code window on this forum page. You might want to replace damage with a bullet class that you would need to also write, since you'd like to have custom bullets as well. I suggest you first write a list of the properties & parameters that you want players to be able to modify, then decide which should be grouped together.

    Code (CSharp):
    1. class Weapon : MonoBehavior
    2. {
    3.     /*damage per shot*/
    4.     int damage;
    5.     /*variables for fire rate*/
    6.     float delay;
    7.     float delay_max;
    8.     /*clip size*/
    9.     int clip_size;
    10. }
    If you're interested, I'll walk you through something silly that will help you lay out your game. Making a board game out of it.
     
    BreakofHavoc likes this.
  7. BreakofHavoc

    BreakofHavoc

    Joined:
    Nov 26, 2014
    Posts:
    4
    Id love for you to help me honestly! My mom knows c++ and shes willing to teach it to me just she told me to look up tutorials.
     
    Tomnnn likes this.
  8. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    It's settled then. You should PM me so you can add me on skype, then the 3 of us (including your mom) can discuss turning your idea into a board game over winter break, then turning the fully planned out & functional game idea into a digital game (assumed at this point to be an fps).

    #altruism

    -edit

    Here's my initial thoughts for the board game.
    boardgame_with_guns.png

    I think if you have a little thing setup for players to hold & use their cards on, it'll be a pretty awesome game. Then you need a board of course to be the world the players occupy. Then, since you want modular weapons, you need a list of parts. That could be its own deck. And you'll need lots of rules for determining when you draw cards and which deck you draw from. Maybe one space on the board is your reserved space for the weapon shop. Then a rule similar to...

    When a player lands on the shop space, draw several cards from the parts deck to make up the shop's inventory. The player can then take one card and the rest get shuffled back into the deck / the player can spend in-game coins collected from jobs for parts & sell parts they've collected for more coins.

    As for the bottom bit of the image I posted here, that is the weapon the player has. The parts will determine the stats on the weapon which will add up for the success or failure (or dice roll & influence) on completing jobs.

    Stuff.
     
    Last edited: Nov 26, 2014
  9. BreakofHavoc

    BreakofHavoc

    Joined:
    Nov 26, 2014
    Posts:
    4
    Wait so youre saying you think I should put cards into the game whet? XD and my mom is a bit busy with a my nephew... hes 2 and uhm ill pm you right now
     
  10. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Cards are just by far the best way to handle having so many parts.

    Alright, we only really need her at the end so she can learn you some programming and then you can turn the game into a digital one. I'll check that PM.