Misc Let's make a dungeon crawler!

Discussion in 'Community Creations' started by lychee, Apr 8, 2018.

  1. Ddraig

    Ddraig Frostfire Dragon|Retired lurker|FFF|Loved by RNG

    Joined:
    Apr 6, 2016
    Messages:
    7,855
    Likes Received:
    22,461
    Reading List:
    Link
    I mean the equipment takes the element type and elemental spells
     
  2. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    Ohhh, thank you! This is precisely what would be useful!

    I actually won't be working on this for a while. >___<

    I think my priority will be finishing working on the bot, and... I probably won't have a lot of time to do so until after Apr-16.

    So I probably won't work on any game details for now at all. This means that pretty much anything goes in terms of the game details. If you wanted to start designing the game (in pseudocode), it wouldn't take that much effort to implement it regardless of the language if you've figured out all the formulas and tables.

    Pseudocode example:
    Code:
    class Player:
      int floor
      int x_pos
      int y_pos
    
    while every_loop(5 minutes):
      # Bot reads thread and action commands
    
      # Compute player actions
     
      # Computer monster actions
    
      # Bot posts to thread
    
    
     
    Ddraig likes this.
  3. Milanin

    Milanin [Reader] [???] [Freeloader]

    Joined:
    May 6, 2016
    Messages:
    1,573
    Likes Received:
    1,497
    Reading List:
    Link
    H1:
    - So, you'd have a database of player data... In a post on here or somewhere separate? Since there are edit post features...
    H1-Ex:
    - You reserve the whole first page for your bots happenings. (Since there is a character limit per posts, even though many don't reach it (Is it still 10k?))
    - Into those first page posts, you place the maps of the players and their choices? (trading confirmation?) amongst other things like battle outcomes and shop windows.
    - You have a secondary thread somewhere that keeps player ID's (user ID) in one post and then in subsequent posts their stats, inventory, 'onlineness', last known position & map, etc..
    H2:
    - Player stats, weapon stats, monster stats, etc... Basic or advanced?
    H2-Ex:
    - For instance, do you just have attack, defence, HP, MP?
    - For instance, do you have STR, AGI, DEF, RES, INT, WIS, etc. (that each have a weight that calculated the attack, defence, etc.)?
    - For instance, do you have a occupation/race/class system that does what @Fluffums said of adding +% to each to differ from each other? Or do you simply let people choose by themselves (as @xconan25x suggested).
    - For instance, do you have status modifiers? Weapons, ailments/buffs, etc. that change the stats of the player while they are in play.
    - For instance, does Weapon X have an advantage over Weapon Y? Does Element of Weapon Y overturn the advantage or level it out? (@Ddraig ,@Fluffums )
     
  4. Ddraig

    Ddraig Frostfire Dragon|Retired lurker|FFF|Loved by RNG

    Joined:
    Apr 6, 2016
    Messages:
    7,855
    Likes Received:
    22,461
    Reading List:
    Link
    Depends on the values involved, each of the advantage or disadvantage will have there modifier variables in the damage calculation formula. Now it depends on what formula the game will use, any special effects and the balancing of dmg numbers
    Like for example we can have an example system where everyone can deal three types of damage, elemental or magic, melee/weapon and range with there seperate armor types, magical, normal and pierce

    More important than these we need to come up with atleast a starting framework and formulas for the game which can be improved afterwards
     
  5. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    The bot would be running from an external server with its own database.

    Something like python/selenium + sqlite

    For players to check their own data, they'd have to use a !status command

    I forget the character limit. I think @AliceShiki knows.

    I'm thinking the bot would only update screens for players who are currently "online" and there's been a change to the past screen they had.

    I'll give an example:

    ----------------------------------------------
    Bot post #431:
    @AliceShiki
    Code:
    ##################
    ######██████######
    ####████████  ####
    ####████****  ####
    ##██████    ████##
    ##██████[]██████##
    ####██^^  ████####
    ##################
    
    []: You
    
    Terrain:
    ██: Wall
    ^^: Rubble
    **: Shrub
    
    (Previously, @AliceShiki was the only one to have made an action in the last 5 minutes)
    (All the other "online" players received their most recent screen in a prior post)
    ----------------------------------------------

    @AliceShiki's post:
    !move up right up

    @Milanin's post:
    !status

    @lychee's post:
    !attack .a

    Other "online" players (did not take any action): Satan, Tony, Westeller
    Other "offline" players: 37 offline players

    -----------------------------------------------
    Bot post #432

    @AliceShiki Dungeon Floor 3
    Code:
    ##################
    ######██████######
    ####██████████####
    ####██████.a.b####
    ##████████  **██##
    ##████**[]  ^^.c##
    ####██    ████####
    ##################
    
    []: You (on shrub)
    .a: (1) A fire pit, (2) A skeleton, (3) A pair of worn clothes, (4) Money
    .b: An orc (on rubble)
    .c: A chest
    
    Terrain:
    ██: Wall
    ^^: Rubble
    **: Shrub
    

    Notice that multiple things can stack onto one square.

    @Milanin Dungeon Floor 1
    Code:
    ##################
    ######████  ######
    ####██████  ██####
    ####██.a    ██####
    ##████      ████##
    ##████  []      ##
    ####██    ████####
    ##################
    
    []: (1) You, (2) 1 rusted knife
    .a: A treasure chest
    
    Your status:
    Name: Milanin
    Level: 3
    Exp: 434/732
    ATK: 8
    DEF: 3
    Inventory: (1) 5 pieces of bread, (2) Escape scroll, (3) 2 red potions, (4) 400 gold, (5) copper key
    
    Terrain:
    ██: Wall
    

    Too lazy to print lychee's map, but you get the idea.

    Since 3 players took action in the last 5 minutes, we print the updated screens for those three players. We would also re-print the screen for online players that had their screens change since the last screen they received (e.g. a monster wandered on the screen).

    As you can see, player's don't have full map vision. They can only see what's around them immediately.

    All players are in the same "world", but the entire "world" isn't necessarily all printed at once.

    --------------------------------------------------

    Depends on how much time it takes to write it.... brainstorming for now.

    Probably best to start simple and expand from there.

    I think this is up for discussion for people designing the game. Simpler is better to start with, I think. If we can get a "alpha" working, it's not as much trouble to try and expand later.

    I don't play enough games so I can't really say I'm experienced in this.

    Honestly it's better to think of me as a programmer. :blobmelt::blobmelt:
     
    Ddraig likes this.
  6. AliceShiki

    AliceShiki 『Ms. Tree』『Magical Girl of Love and Justice』

    Joined:
    Apr 27, 2016
    Messages:
    24,650
    Likes Received:
    98,372
    Reading List:
    Link
    *will read thread later because I got curious*

    Character limit per post? 150000 characters, do you think you'll use this many?
     
  7. Fluffums

    Fluffums 【R-18 Researcher】【Seeker of Moe】

    Joined:
    May 12, 2016
    Messages:
    2,406
    Likes Received:
    3,660
    Reading List:
    Link
    Yeah, that's why I suggested Fire Emblem - it's one of the least complicated in the bookkeeping department. Even if players come up with a custom class, you just put in the base stats, base level, and % chance to increase on level up, and then on each level up the stats can be overwritten automatically (level +1, other stats +0 or +1). Then just have an inventory and an [Equipped] weapon which you could change easily with a command (!equip iron sword) as long as you can equip it and you have it in your inventory. Then you'd have "current hp" and "current xp" as other variables to keep track of.

    Enemies are even easier; if a "level 10 Orc" appears, the bot can just take the basic stats for a level 1 orc and automatically add the average bonuses for 9 level ups, then set its "current hp" variable equal to the calculated "hp" stat, and give it an inventory based on the "Orc" and "level 10" tables (the class determines the type of item, the level determines the quality of item). So individual enemies would just need a slot for level, a slot for class, a slot for current hp, and a few slots for inventory, however much they can hold.

    Even if you have a complicated enemy, like a dragon, you can just stat their attacks as individual weapons and give them an algorithm for switching (random, at certain %hp, certain type of opponent, certain numbers of opponents, opponents behind them, whatever). So a dragon might have Breath, Claw, Tail, Bite, and Wing attacks equipped without making the bookkeeping any more difficult - because a wolf will have a Bite attack, and a cat will have a claw attack, etc.

    Then weapons have: weapon type (strong vs one type, weak vs one), physical or magic type, base damage, base accuracy, base critical chance, range (standard in FE: 1 for melee, 2 for ranged, 1-2 for magic spells and melee weapons that can be thrown, etc), weight (if your strength is too low for the weight, your speed gets lowered by the difference while it's equipped). Certain weapons are "slayers" - extra effective against certain classes (bows vs flying enemies, or a dragon-slaying weapon vs dragons, or holy magic vs undead) - there can be a "slayer" table listing classes affected by each "slayer" weapon modifer. So weapons need what, 8 fields? You could still simplify that if you don't want to worry about some of the stats in FE, but they're pretty easy to apply.
     
    Ddraig, Milanin and lychee like this.
  8. Milanin

    Milanin [Reader] [???] [Freeloader]

    Joined:
    May 6, 2016
    Messages:
    1,573
    Likes Received:
    1,497
    Reading List:
    Link
    ... A fiction can use it up pretty quickly, especially if it's written in advance and then just copy pasted in...
     
  9. AliceShiki

    AliceShiki 『Ms. Tree』『Magical Girl of Love and Justice』

    Joined:
    Apr 27, 2016
    Messages:
    24,650
    Likes Received:
    98,372
    Reading List:
    Link
    150000 characters is around 20000 words from my empiric experience, I don't think the first post will make that many.
     
  10. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
  11. Ddraig

    Ddraig Frostfire Dragon|Retired lurker|FFF|Loved by RNG

    Joined:
    Apr 6, 2016
    Messages:
    7,855
    Likes Received:
    22,461
    Reading List:
    Link
    EnemyGen(name,type,level,modifier[][] ,growthRate[],inv[])
    {
    Name;
    Type;
    level;
    Modifier will include weakness like
    F T W M S
    2 1 0.5 1 1
    We dont even need it to be 2d if we maintain the modifier order correctly always. There will a last element for special modifier
    So the mon takes double dmg against fire and half dmg against water. (we make this for all monsters in a database)
    Many of the parameters can be clubbed together into a single object(like name, modifier, type and growthrate defines a single monster object)
    Growthrate will include there growth rates for all stats, for example
    Phy atk at level n = phy atk(1) + n*growth rate;
    (we can use a better, more complex formula here, or even many different formulas like used in pokemon levelling system)
    Inv will be rng generated with the next item appearing being less and less likely
     
  12. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    Can you explain what abbreviations are?
     
  13. Ddraig

    Ddraig Frostfire Dragon|Retired lurker|FFF|Loved by RNG

    Joined:
    Apr 6, 2016
    Messages:
    7,855
    Likes Received:
    22,461
    Reading List:
    Link
    Fire thunder water melee spell
    They are not important as the only thing we need to decide is order of modifiers and number of types
     
  14. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    [​IMG]
    Story:

    Welcome, impoverished adventurer, to the Scavenger City of Nuph. Are you here to seek your fortune?

    Three thousand years ago, a terrifying yet mysterious ancient civilization existed here. No one knows exactly what happened to them, but they are now extinct. Their only remaining relic is an enormous underground shape-shifting dungeon that we call the Labyrinth, which is infested with monsters and demonic beasts.

    Are you willing to try your hand at being a scavenger?

    The entire economy of this city revolves around the trinkets and magic cores that adventurers fish up from the depths of this ancient city. If you are lucky, you may unearth treasure that will allow you to live the remainder of your days in luxury!

    But beware -- the Labyrinth is no place for those who fear death.

    It is said that many who enter these doors, will never leave.

    General Game Mechanics:
    • The Labyrinth is a dungeon that gets wider in diameter and contains more difficult monsters as it gets deeper.
    • The Labyrinth floors are randomly generated and changes shape if:
      • No "online" human player is on that floor for ONE DAY (24 hours)
      • The floor reset/shuffle can be prevented for a temporary period of time if:
        • 1 week: A human player is "offline" but has their position saved on that floor
        • 1 week: A special item ("Observer") purchased from shop is placed on the floor
    • Perma-death
    • Food and rations decline over time (while "online")
    • Limited inventory capacity (need to purchase expanded inventory "item bags", etc.)
    • Players can "logout", but HP/MP does not recover while logged out
    • Need to return safely to surface to sell loot (usually)
     
    AliceShiki and Ddraig like this.
  15. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    Status update (programming):

    Yesterday I spent time working on bot code. I'll talk a little bit here about what I've done and what directions I'm going in.

    Programming language
    • Python 3, because I'm most familiar with python and I'm assuming I'm the one doing the most coding
    • I've normally only done webdev with python in the past (flask/django) using python 2.7, but now is probably a good time to use python3 since I'm starting a new project anyways
    Project design/structure
    • The "bot" will be a separate app from the "game". This is because I can imagine a bot being used for many separate other things, so I will write the "bot" as a standalone python library that's used as a dependency by the "game"
    • I've decided to name the "bot project" as "haori" on github
    • Haven't started the "game project" yet
    Bot project dependencies
    • BeautifulSoup4 - using to convert raw HTML into something python can traverse programatically
    • Headless browser - needed for the bot to simulate a user logging in and interacting with NUF. Several options:
      • Selenium - Pros: Seems to be most popular - Cons: Needs an underlying browser install (e.g. Chrome, Firefox)
        • Currently using this. Setup is Google Chrome/chomedriver/selenium
        • I'm worried about it running a little slow because Google Chrome needs to be booted up each time its run
        • I'm also worried about how well it will work straight out of the box when I run everything on a server (e.g. heroku)
        • Advantage is that it's a real browser, so it's a near-perfect simulation
      • PhantomJS
        • Pros: formerly most popular, doesn't require an underlying browser
        • Cons: no longer being maintained
        • Cons: Known for sometimes rendering pages inaccurately
      • mechanize
        • Tried this one already
        • Pros: doesn't require an underlying browser, very lightweight and fast
        • Cons: does no simulate javascript, so NUF modals won't work
    What it would be like using the "haori" library (vague idea):
    Code:
    # File: test.py
    
    from haori import Bot
    
    my_bot = Bot(username="myusername", password="mypassword")
    
    # Log in bot
    my_bot.login()
    
    # Get page 2 of NUF thread with id: 63096
    # Returns a list of Post objects
    my_posts = mybot.get_thread(id=63096, page=2)
    
    # Get text on the first post
    single_post = my_posts[0]
    print(single_post.get_id())
    print(single_post.get_text())
    
    # Can also loop over each line in the post
    for line in singe_post.get_lines():
        print(line)
    
    # Log out bot
    my_bot.logout()
    
    Thinking about how the syntax should be...
    Code:
    class Bot:
    
        ...
    
        def get_thread(self, id, page=1, limit=1):
            ```Get the Posts within a NUF thread.
    
            Parameters:
                id (int): NUF thread ID
                page (int): Page number to start fetching posts from. Default: 1
                limit (int): Maximum number of pages to fetch posts from. Default: 1
    
            Returns:
                Post[] A list of Post objects
            ```
            pass
    
        def get_posts(self, since, limit=None):
            ```Get the thread posts starting from a certain post ID
    
            Parameters:
                since (int): NUF post ID to start fetching posts from.
                limit (int): Maximum number of posts to return. Default: none
    
            Returns:
                Post[] A list of Post objects
            ```
            pass
    
     
    Last edited: Apr 11, 2018
    Ddraig likes this.
  16. Ddraig

    Ddraig Frostfire Dragon|Retired lurker|FFF|Loved by RNG

    Joined:
    Apr 6, 2016
    Messages:
    7,855
    Likes Received:
    22,461
    Reading List:
    Link
    I can help write pseudocodes or algo then.. Or just help with listing monsters and getting a game system idea with others
     
    lychee likes this.
  17. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    Sure! Whatever you like! I think it will be helpful whichever you'd like to do.

    I'm focusing on the Bot right now, which is fully encapsulated and separated from the game itself, so there won't be an conflicts if other people start thinking about how the game should be coded.
     
  18. Ddraig

    Ddraig Frostfire Dragon|Retired lurker|FFF|Loved by RNG

    Joined:
    Apr 6, 2016
    Messages:
    7,855
    Likes Received:
    22,461
    Reading List:
    Link
    I wont start till next week tho
     
    lychee likes this.
  19. lychee

    lychee [- slightly morbid fruit -] ❀[ 恋爱? ]❀

    Joined:
    Jul 22, 2017
    Messages:
    2,156
    Likes Received:
    5,407
    Reading List:
    Link
    More scratch paper that may not mean anything:

    Code:
    # main.py
    
    from apscheduler.schedulers.blocking import BlockingScheduler
    
    def loop(arg1, arg2):
        # Main game loop
        pass
    
    if __name__ == '__main__':
    
        # Initialize SQLAlchemy DB
    
        # Initialize Bot
    
        # Initialize Repeater and pass DB and Bot into each loop
        scheduler = BlockingScheduler()
        scheduler.add_job(loop, 'interval', args=[arg1, arg2], seconds=300)
    
        # Start the Repeater
        print('Press Ctrl+C to exit')
        try:
            scheduler.start()
        except (KeyboardInterrupt, SystemExit):
            pass
    
    File directory structure:
    Code:
    nuphtower/
        main.py
        database.db
        models/
            player.py
            floor.py
            monster.py
        assets/ # May be re-generated by game
            floor01.json
            floor02.json
        config/
            masterconfig.json
            monsters.json
            items.json
    
    blah

    Code:
    F#01:
    0000000000
    1101111010
    1111111010
    0111101110
    0001001011
    0111111000
    0111111000
    0111111110
    0111111010
    0111111010
    0000000000
    
     
    Last edited: Apr 11, 2018
  20. noisypixy

    noisypixy Sacatunn que pen, que summum que tun.

    Joined:
    Jun 25, 2016
    Messages:
    716
    Likes Received:
    950
    Reading List:
    Link
    Oh, you're the one behind Onigiri! Nice project. Too bad it's GPL-licensed though.