Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old October 27, 2010, 17:23   #11
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,808
Derakon is on a distinguished road
Monster and Player should definitely be subclasses of the same base class, since they share many things in common. Personally I'd call the base class Creature, but that's just me.
Derakon is offline   Reply With Quote
Old October 28, 2010, 05:59   #12
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,306
Donated: $40
Pete Mack is on a distinguished road
Seconded. I also figured Creature or Animate was the way to go. After all, Undead aren't living...
Pete Mack is offline   Reply With Quote
Old October 28, 2010, 06:03   #13
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,703
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by Derakon View Post
Monster and Player should definitely be subclasses of the same base class, since they share many things in common. Personally I'd call the base class Creature, but that's just me.
An ELO fan, perhaps
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old October 28, 2010, 06:37   #14
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,306
Donated: $40
Pete Mack is on a distinguished road
On further thought, take a look at the knowledge menus and various *.txt tables in ../lib/edit in various versions of Angband. (Including eg ToME, NPP, FA, Isoband, UnAngband.)

Your object model should plan for all of these relations.
* Spells
* Objects (with optional hasA spell list)
* Terrain Feature
* Display panel (Isoband)

A few other pointers:
You will need a whole lot of Listeners on game turns ... basically everything in dungeon.c`process_world()
While the process_world() model is poor, the class-level registration model for a big feature like this is worse. You're going to need a data-driven [tabular] registration model for this, too.
Pete Mack is offline   Reply With Quote
Old October 28, 2010, 19:37   #15
Tiburon Silverflame
Swordsman
 
Join Date: Feb 2010
Posts: 405
Tiburon Silverflame is on a distinguished road
Not to be pedantic, but Spell is not quite the proper base class...Effect is. This allows 5 sub-classes:

Spell (for @'s spells)
MonsterSpell (for those mana bolts, nether bolts, and such)
BreathWeapon
TrapEffect
ItemEffect
Tiburon Silverflame is offline   Reply With Quote
Old October 30, 2010, 07:20   #16
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,306
Donated: $40
Pete Mack is on a distinguished road
@Tiburon...
Yes, that is pedantic

Spell has a long history in *Band for this kind of thing (spell effects used to be called x-spell.c in the bad old days.) So I stick to "Spell" for some kind of non-standard "invoked" action.

Don't forget, there are other Effects, such as move, shoot, attack, open, disarm, bash, etc.

For this model, what we have now is Command. You might want to generalize it to Action, which basically is a map() call to a group of objects.
(The objects may area, or it may be a player, grid point, or monster alone.)

Actions:
* on behalf of an actor
* take a unit of time (decremented from the actor)
* have an (uniform) affect on a set of Objects, determined by some apply function.


Of course, this kind of thing is bog-standard FP and OO modeling. It's a very cool problem.

Best of luck!
Pete Mack is offline   Reply With Quote
Old October 30, 2010, 18:35   #17
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Spell type things take the "caster", "target", and "world" as arguments, just to be standard. A potion of cure light wounds will not care about target or world, but *destruction* does not care about target, etc.

Still no work till Tuesday, so I'll do what I can to have a basic thing working. I want at least a few weapons, armors, an ego or two, maybe an artifact, and a test monster and one or two consumables, just so I (we? ) can get this design model somewhat more concrete before continuing further.
Sirridan is offline   Reply With Quote
Old October 31, 2010, 06:05   #18
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Tval and Sval's are being worked on, here's some output:

>>> SVAL_NAMES['edged'][1]
'Dagger'
>>> SVAL_NAMES['edged'][0]
'Long Sword'
>>> SVAL_NAMES['edged'][5]
'Falchion'
>>> SVAL_NAMES['edged'][BLADEOFCHAOS]
'Blade of Chaos'
Sirridan is offline   Reply With Quote
Old November 1, 2010, 16:52   #19
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Man, made some big changes to things.

For now, edit files are just big python dictionaries, just formatted to be easy to read.
Item, Creature, Monster, etc, just copy the values into their own class, much like how it already works in V.

Will upload later, so essentially, everything that's on Git now is being replaced.
Sirridan is offline   Reply With Quote
Old November 1, 2010, 18:33   #20
Tiburon Silverflame
Swordsman
 
Join Date: Feb 2010
Posts: 405
Tiburon Silverflame is on a distinguished road
If Effect covers move, bash, et al...that's IMO VERY poor wording. Move is not an effect, it's an action.

And the reason I prefer 'Effect' to 'Spell' is that it's more general; it covers spells, plus things that can't be construed as a 'spell', like a breath weapon. Also, 'Spell' doesn't work well for side effects, such as "hit to confuse" which does damage, AND has an Effect of possibly confusing the target.

The better hierarchy is something like this:

Command: operates strictly at the UI level. There are non-action commands, such as setting options.

Action: move, shoot, bash, browse, cast spell, etc. These are the actor's options to interact within the game. Actions have very few options *in themselves*...most of the options exist at the next level down. That is: when you cast a spell, the *spell* knows its targeting options. With something like 'activate a wand', the detailed sequence would be:

action:
invoke item
update world

item:
check for legal use (has charges left)
go through Effect (my use) to determine targeting.
make activation attempt;
if successful,
apply Effect to Target
decrement charge count/force item recharge
end
exit

Move, open, attack, bash, disarm, and tunnel (at least) all have 1 parameter: direction. Fuel, Read, Quaff, Use staff, Aim wand, Zap, and Activate all use the Invoke Item model. Fire and Throw use ranged targeting, which should be a static call (with a param of max range) which is also used as necessary for Effect's targeting.

Effect has, I believe, the following:
--representation of the effect (what does it do): its apply() method
--range
--target (self, square, or 'victim')
--target type (self, monster, or world)

'victim' is used for side effects, such as Hit to Confuse. Hit to Confuse is an Attack, so its parameter is direction. Its apply() makes the swing, and assuming a hit, does the damage, THEN calls a ConfuseTarget Effect with a set target (the critter to which the damage is being applied) and applies it.

Note that this creates a very natural approach to create, for example, Confusion or Slow weapons/ammo for @'s use, as well as facilitating all the monster special attacks.
Tiburon Silverflame is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread ratings Timo Pietilš Oook! 1 September 7, 2010 17:08
Questions That Don't Need Their Own Thread karmatic Vanilla 21 February 4, 2010 20:31
Magnate's thread Magnate Vanilla 7 December 23, 2009 16:53
Another HE Mage Thread Adqam AAR 3 August 11, 2009 04:24
Another 3.10 thread (as if we don't have enough) Jungle_Boy Vanilla 3 January 16, 2009 18:50


All times are GMT +1. The time now is 16:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.