Action RPG Framework

by Forum_account
Action RPG Framework
A framework for developing action RPGs.
ID:856597
 
This version has a lot of changes but there aren't any major additions. I added the info bar, which is shown across the top of the screen and can be used to give info/hints/tips to the player. I also added health and mana regen, the mob.number_prompt() proc, the ability to drop items on the map and pick them up, and made the ability menu capable of showing multiple columns when you have a lot of abilities.

The biggest change was mostly internal. I re-did a lot of HUD stuff to make it easier to create custom HUD screens that look and function like the other ones. By creating an object that extends /HudBox, you get access to some procs that are useful for creating panels and list boxes. There's an example in demo\custom-hud.dm. In about 30 lines of code it creates a window containing a list of your abilities. You can use the arrow keys to move a cursor around and the space bar to make a selection.

Note: This version requires the latest version of the HUD Groups library, which was also posted this morning. I also updated the Pixel Movement library but I don't think anything here relies on that update.

Here is the full list of changes:
  • Added the info bar which is shown at the top of the screen. Added the Constants.KEY_INFO_BAR var, which is "h" by default, that sets focus to the info bar. While it has focus you can use the Delete key to remove messages and the arrow keys to cycle through them. The Esc and H keys set focus back to the player.
  • You can use the mob.info_bar.add_message() proc to show a text string in the info bar. You can use the info_bar's remove_message() proc to remove a message. There are examples of this in demo\help.dm.
  • Added health and mana regeneration. The mob.health_regen() and mob.mana_regen() procs are called periodically when the mob is below their maximum value. By default these procs do nothing but you can override them to call gain_health() and gain() mana. The sample game has an example of this. Note: the regen procs are only called if you're below your max health/mana value.
  • Added the Constants.REGEN_TICK_LENGTH variable which is the number of frames between calls to health_regen() and mana_regen(). It's default value is 40 so these procs are called once per second.
  • Increased the mana cost of Fireball in the sample game so you can notice mana regeneration more easily.
  • Increased the default layer of objects created with the atom.effect() proc to be the atom's layer + 10 because there were still some layering issues with these objects and equipment overlays.
  • Added the "attached" named parameter to the atom.effect() proc. If you call mob.effect("something", attached = 1), the object will follow the player as they move.
  • Changed the Quest.complete() proc to be called "is_complete" instead.
  • Added the Quest.acquired(), removed(), and completed() procs. acquired() is called when you receive a quest, removed() is called when you abandon or complete a quest, and completed() is called when you complete a quest. By default these don't do anything but they let you add custom behavior to getting or losing quests.
  • Added demo\help.dm which shows some ways to use the info bar to create context-sensitive help messages to a game.
  • Added the mob.number_prompt() proc which is similar to text_prompt() except you can only type digits.
  • Changed the way text and number prompts are handled internally, but this doesn't change how they're used.
  • Added the show_caption var to the HealthMeter and ManaMeter objects. When this is set to 1 it'll cause the stat's value and maximum to be displayed to the right of the meter. It is zero by default but the sample game includes code in demo\mobs.dm to set it to 1 for both meters.
  • Added the ability to drop items on the map. When you call mob.drop_item(item), the item will be placed on the map. It'll be displayed using its map_icon and map_state vars.
  • Previously, mob.drop_item(item) would set the item's loc to null and cause the item to be deleted. If you want to simply remove the item from their inventory and delete it, you can call mob.remove_item(item). This will set the item's loc to null.
  • Added the item.pickup var whose value can be item.WALK_OVER or item.INTERACT. This determines how the item is picked up - by walking over the item or by interacting (pressing the space bar). The default value is INTERACT.
  • Pressing D in the inventory screen makes you drop an item. Pressing the Delete key removes the item and deletes it entirely.
  • Made the ability menu able to show multiple columns in case the player has many abilities to choose from. The height of each column is determined by the AbilityMenu/size var which is 8 by default, but is set to 4 in the sample game so you'll see multiple columns there.
  • Added the AbilityMenu/show_ability() proc which takes an Ability object as a parameter and returns 0 or 1 to determine if the ability should be listed. This way you can limit what abilities are shown when the player is customizing their key bindings (ex: you can hide their crafting abilities from that menu and provide a separate interface to access them).
  • Added an outline to the item description text in the inventory screen to make it more readable when the caption is over top of a bright item.
  • Changed some things about on-screen interfaces. The HudBox object which many interface elements extend now contains the box() proc which is used to create the background of each window instead of creating the box using parameters passed to the New() proc.
  • Added the party.size_limit var which limits the number of players that can be in a party. The default is zero, which means there is no limit.
  • Added the party.invite_player(mob) proc which is used to invite players. This proc enforces the size limit. You can still call the mob's invite_player() proc since it calls the party.invite_player proc.
  • Added the HudGroup.focus() and close() procs. By default these do nothing but they're commonly defined procs that might come in handy for defining the behavior that should happen when interfaces are opened and closed.
  • Added the HudBox.panel() proc which creates an on-screen panel. These panels look like the backgrounds of the mob selection menu, inventory screen, prompt boxes, and other interface elements.
  • Added the HudBox.box() proc which has the same effect as the panel() proc but panel() creates the box as a child HudObject and box() creates it by adding objects to the current HudGroup.
  • Added the HudBox.list_box() proc which create an on-screen list box that can be used to display a list of objects. The list_box returns a type of HudGroup object. To use the list box you have to pass keystrokes to it. See demo\custom-hud.dm for an example.
  • Updated the current HUD interface elements to make use of the new vars and procs.
Great Update gonna test it before replying any further
Awesome stuff man. I still haven't figured out datums so a lot of this is above my head. (If you can lead me somewhere where datums are explained well I would love that) But great job!
i am not sure if you did this on purpose but prompt dont show Background
In response to Ganing
Ganing wrote:
Awesome stuff man. I still haven't figured out datums so a lot of this is above my head. (If you can lead me somewhere where datums are explained well I would love that) But great job!

Hey Ganing this might help you!
http://www.byond.com/ forum/?post=785529&hl=datums#comment2186300
In response to Ganing
Ganing wrote:
Awesome stuff man. I still haven't figured out datums so a lot of this is above my head. (If you can lead me somewhere where datums are explained well I would love that) But great job!

Datums aren't different from any other object. If you were going to implement a gun you'd do something like this:

obj
gun
var
ammo

proc
shoot()

You make the gun a kind of object because it needs to have its own vars and procs. You make it a type of /obj because that type is typically used for items and because you might want to place guns on the map.

Making a datum just means you're making a type of object (something that has vars and procs) but it's not something you'd place on the map, like abilities.
In response to Lord Kakarot
Lord Kakarot wrote:
i am not sure if you did this on purpose but prompt dont show Background

Whoops! Line 75 in hud-prompt.dm should be split into these two lines:

..(owner)
box(width, height)

I just uploaded the change but not as a new version, so you'll have to make the change manually or delete your local copy and download it again.
ok
Here's what I've got planned for the next version so far:

 * Stun effects
* Friendly AI (ex: summoned monsters)
* More interesting enemy AI in the sample game
- Monsters that run away when weak
* Random stat bonuses on equipment in the sample game
* A proc for creating AoE graphical effects
- Add some examples to the sample game
* Size limit on the number quests you can have
* A mob selection menu (ex: player.mob_prompt(list_of_mobs))
* A better party menu
- Options to leave party, kick member, etc.
nice, i would be waiting for that Update
is it possible that you can update Keybord Library so it converts numpads to numbers.
For temp this is my solution
//Keydown Proc
mob
verb
KeyDown(k as text)
set hidden = 1
set instant = 1

// if input is locked, we do nothing.
if(input_lock) return

if(!use_numpad)
if(k == "northeast")
k = "page up"
else if(k == "southeast")
k = "page down"
else if(k == "northwest")
k = "home"
else if(k == "southwest")
k = "end"
else if(k=="Numpad1") k="1"
else if(k=="Numpad2") k="2"
else if(k=="Numpad3") k="3"
else if(k=="Numpad4") k="4"
else if(k=="Numpad5") k="5"
else if(k=="Numpad6") k="6"
else if(k=="Numpad7") k="7"
else if(k=="Numpad8") k="8"
else if(k=="Numpad9") k="9"
else if(k=="Numpad0") k="0"

keys[k] = 1

if(focus)
if(hascall(focus, "key_down"))
focus.key_down(k, src)
else
CRASH("'[focus]' does not have a key_down proc.")

//vars
var
const
ARROWS = "|west|east|north|south|"
NUMPAD = "|west|east|north|south|northeast|southeast|northwest|southwest|center|Numpad1|Numpad2|Numpad3|Numpad4|Numpad5|Numpad6|Numpad7|Numpad8|Numpad9|Numpad0"
EXTENDED = "|space|shift|ctrl|alt|escape|return|tab|back|delete|insert|"
PUNCTUATION = "|`|-|=|\[|]|;|'|,|.|/|\\|"
FUNCTION = "|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|"
LETTERS = "|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|"
NUMBERS = "|0|1|2|3|4|5|6|7|8|9|"

ALL_KEYS = NUMPAD + EXTENDED + FUNCTION + LETTERS + NUMBERS + PUNCTUATION
I have that in the keyboard library but haven't posted it yet.
great update Forum_account :)
In response to Forum_account
Forum_account wrote:
I have that in the keyboard library but haven't posted it yet.
oh ok but it was just a temp solution until you release latest version
That's basically how it works except it uses a list to look up the numpad keys and it adds macros for the decimal, multiply, etc. keys.
Looks like this is a nice update, and the next update looks even more promising than this one. I noticed you plan to work on the AI a bit, will you be adding any form of path finding? I wouldn't expect anything too specific, but it would be nice to see how you would go about making enemies move around dense objects.

I'm hoping doing so might increase the likelihood of the standards of BYOND changing. Most games don't seem to worry about this. I've been toying with it a bit lately, and the simplest things like this seem to make the biggest differences in AI's realism. This has also left me growing quite curious about how BYOND handles path finding in its procs like step_towards.
With pixel movement, BYOND uses A* for pathfinding. I think it has gotten pretty decent, too bad the Pixel Movement lib doesn't take advantage of it.
In response to Kaiochao
Ah, I see. What about without it, though?
also with the party system you can invite anything in the world to it o.O and they dont even need consent you can literally force people into your party XD
Page: 1 2