1
Programs / I started work on an RPG yesterday, 6/13. Any comments on my early build?
« on: June 14, 2018, 07:48:49 pm »
A quick introduction from me: I'm 43 and fooled around with Basic starting around 1984. It lasted until about 1995 or so, when I switched to C. I first programmed in VIC-20 Basic and eventually moved to an early version of QuickBASIC. (version 3.5, I think?) before eventually moving onto 4 then 4.5. I never made anything too complex in Basic; just really simple games I could bash out in an hour or so. I spent maybe 3-4 hours on my biggest game. More complex development happened in C. But I've always wanted to make a game that looked like it was from 1986-1987 or so. Real text heavy, few to no graphics. Lots of calculations going on under the hood.
So this is entirely text based. A few notes: I'm eventually going to use a custom window size, so I've made no attempt whatsoever to format the text. It looks awful and I know it. I've worked on it today and yesterday and it's about 375 lines. You can walk between three rooms, pick up a weapon and attack a skeleton. The attack routine is super buggy and no one can die. I just want to get the most basic systems in at this point, even if they're buggy. It's a fairly boring thing to play right now, what with the unkillable monsters.
I'm open to any suggestions. This is the most complex thing I've ever developed in Basic and I'm a bit overwhelmed right now.
So this is entirely text based. A few notes: I'm eventually going to use a custom window size, so I've made no attempt whatsoever to format the text. It looks awful and I know it. I've worked on it today and yesterday and it's about 375 lines. You can walk between three rooms, pick up a weapon and attack a skeleton. The attack routine is super buggy and no one can die. I just want to get the most basic systems in at this point, even if they're buggy. It's a fairly boring thing to play right now, what with the unkillable monsters.
I'm open to any suggestions. This is the most complex thing I've ever developed in Basic and I'm a bit overwhelmed right now.
Code: QB64: [Select]
- ' Steve's RPG-like thing.
- ' Written in 2018.
- ' Version 0.1-dev (pre-alpha)
- ' Short term to do: figure out what's wrong with attack:, Add npc inventory, recognize death condition for npc, stop respawning npc every time player enters a room.
- ' Longer term goals: Get the non-weapon slots working. Show inventory. exchange weapons between slots. drop items.
- doneroom = 0
- cmderror = 0
- GOSUB roomsetup: ' Create starting room, intialize other rooms.
- GOSUB weapongen: ' Create the weapon table!
- GOSUB npcgen: ' Create the npc table!
- GOSUB playergen: ' Player Generation routine
- croom = 1 'starts in room 1.
- GOSUB setroom: ' Set initial room properties.
- Main: ' Main loop
- PRINT "Exits:"
- GOSUB parse:
- GOTO Main: ' Shut up. I know.
- parse:
- phrase = "null"
- object = "null"
- phrase = res
- ' This will be replaced with a SELECT CASE eventually.
- attack: ' Attacking isn't balanced and needs extensive work, but the very basic framework of a round is in place.
- ' npc in room 3 seems to have too many HP. Attack is buggy and weird in general.
- PRINT "There is nothing here to attack."
- PRINT "Entering fight mode."
- FightLoop: ' Main fight loop. It's true turn based right now with no auto attack. npcs currently cannot initiate combat.
- attack = rolldice%(1, 20)
- ' There'll eventually me modifiers based on class/race
- defense = rolldice%(1, 20)
- ' Just d20 vs d20 now. Higher number wins.
- damage = rolldice%(WeaponTable(pcinv.weapon1).dice, WeaponTable(pcinv.weapon1).sides)
- curnpc.hp = curnpc.hp - damage
- damage = 0
- curnpc.hp = curnpc.hp - damage ' Done this way because there may evemtually be modifiers that add damage even if hit misses.
- attack = rolldice%(1, 20)
- ' There'll eventually me modifiers based on class/race
- defense = rolldice%(1, 20)
- ' Just d20 vs d20 now. Higher number wins.
- damage = rolldice%(WeaponTable(pcinv.weapon1).dice, WeaponTable(pcinv.weapon1).sides) ' Uses player's weapon for now.
- player.hp = player.hp - damage ' Player damage
- damage = 0
- player.hp = player.hp - damage ' Player damage
- dance:
- PRINT "You do that weird pointy dance people in leisure suits did in the 70s. Is this really becoming of an adventurer such as yourself?"
- help:
- PRINT "Game in Development. Move with standard cardinal directions. Do not, under any circmstances, attempt to dance. Quit or Exit to quit."
- cmderror = 1
- look:
- PRINT curroom.longd
- cmderror = 1
- quit:
- TYPE playertype
- TYPE inventory
- TYPE weapon
- TYPE npc ' This is totally cosmetic. I'll figure out better stuff to put here later.
- TYPE room
- playergen:
- ' INPUT "What is your name? ", player.name
- player.str = rolldice%(3, 6)
- player.dur = rolldice%(3, 6)
- player.hp = rolldice%(1, 10) ' Roll 1d10
- PRINT "Your stats are -"
- pcinv.weapon1 = 2 ' Starting weapon is a short sword.
- PRINT "Press a key to start playing."
- weapongen:
- ' I really want this to be a Constant so it can't be modified accidentally, but that doesn't seem possible.
- WeaponTable(1).sides = 8
- WeaponTable(1).dice = 1
- WeaponTable(2).sides = 6
- WeaponTable(2).dice = 1
- WeaponTable(3).sides = 4
- WeaponTable(3).dice = 1
- WeaponTable(4).sides = 3
- WeaponTable(4).dice = 1
- WeaponTable(5).sides = 6
- WeaponTable(5).dice = 2
- npcgen: ' These numbers are all made up and are changing at some point.
- NPCTable(1).str = rolldice%(3, 6) ' 3d6 is standard ability roll
- NPCTable(1).dur = rolldice%(3, 6) ' 3d6
- NPCTable(1).hp = rolldice%(1, 6) ' 1d6 for HP
- NPCTable(4).str = rolldice%(3, 6) ' 3d6 is standard ability roll
- NPCTable(4).dur = rolldice%(3, 6) ' 3d6
- NPCTable(4).hp = rolldice%(1, 6) ' 1d6
- NPCTable(4).str = rolldice%(3, 6) ' 3d6 is standard ability roll
- NPCTable(4).dur = rolldice%(3, 6) ' 3d6
- NPCTable(4).hp = rolldice%(1, 6) ' 1d6
- NPCTable(4).str = rolldice%(3, 6) ' 3d6 is standard ability roll
- NPCTable(4).dur = rolldice%(3, 6) ' 3d6
- NPCTable(4).hp = rolldice%(1, 6) ' 1d6
- NPCTable(4).str = rolldice%(3, 6) + 2 ' Dragon gets 3d6 + 2
- NPCTable(4).dur = rolldice%(3, 6) + 2
- NPCTable(4).hp = rolldice%(4, 8) + 5 ' 4d8+5 because dragons be strong.
- createnpc: ' Sets up NPCs based off NPCTable.
- curnpc.hp = NPCTable(curroom.npc).hp
- curnpc.dur = NPCTable(curroom.npc).dur
- curnpc.str = NPCTable(curroom.npc).str
- roomsetup:
- gameworld(1).roomid = 1 ' Starting room. You always start in 1.
- gameworld(1).shortd = "The start of a dungeon of fear"
- gameworld(1).longd = "You see bones strewn about. This is surely the entrance to somewhere pretty horrible."
- gameworld(1).south = 2
- gameworld(1).west = 3
- gameworld(2).roomid = 2
- gameworld(2).shortd = "Another room of roominess"
- gameworld(2).longd = "It's pretty scary here. You see a boogie woogie skeleton in the corner."
- gameworld(2).npc = 4 ' Skeleton
- gameworld(2).north = 1
- gameworld(3).roomid = 3
- gameworld(3).shortd = "The Armory"
- gameworld(3).longd = "You stand in an old forgotten armory. Most the weapons look old and unusuable. This place hasn't been properly tended to in decades, if not centuries."
- gameworld(3).weapon = 5
- gameworld(3).east = 1
- setroom:
- curroom.roomid = gameworld(croom).roomid
- curroom.shortd = gameworld(croom).shortd
- curroom.longd = gameworld(croom).longd
- curroom.npc = gameworld(croom).npc
- curroom.weapon = gameworld(croom).weapon
- curroom.item = gameworld(croom).item
- curroom.north = gameworld(croom).north
- curroom.south = gameworld(croom).south
- curroom.east = gameworld(croom).east
- curroom.west = gameworld(croom).west
- doneroom = 0
- roomchange:
- doneroom = 0 ' Make sure it's set to 0, which effectively means you can't exit.
- pickup:
- pcinv.weapon1 = curroom.weapon
- pcinv.weapon2 = curroom.weapon
- NEXT counter
- ' total should now contain an array of all dice rolls. Now we add them up.
- rolldice% = rolldice% + total(counter)
- NEXT counter
- ' I feel like there's probably a much better way of doing this.