Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old November 10, 2010, 22:42   #41
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 38
Posts: 1,516
d_m is on a distinguished road
Sounds like you all are already in agreement, but I agree that the client should submit [action, arg, ...] objects rather than key presses. The current Angband scheme of mapping client keybindings into "Angband" keybindings and using those internally is braindead.
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old November 11, 2010, 00:20   #42
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Quote:
Originally Posted by d_m View Post
Sounds like you all are already in agreement, but I agree that the client should submit [action, arg, ...] objects rather than key presses. The current Angband scheme of mapping client keybindings into "Angband" keybindings and using those internally is braindead.
That's what I was trying to do at first, but yeah, it was getting to be a PITA quite quick.
Sirridan is offline   Reply With Quote
Old November 11, 2010, 08:08   #43
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,268
Donated: $40
Pete Mack is on a distinguished road
Quote:
Originally Posted by d_m View Post
Sounds like you all are already in agreement, but I agree that the client should submit [action, arg, ...] objects rather than key presses. The current Angband scheme of mapping client keybindings into "Angband" keybindings and using those internally is braindead.
This is not to say that keybindings are a bad idea per se; just that the internal model* needs one more level of redirection. Instead of switching on (original keybinding) characters, switch on command actions, and bind keys to actions rather than characters.

The current strict disconnect between I/O events and commands (via util.c`inkey_ex) is extremely valuable.

* currently implemented in dungeon.c`process_command
Pete Mack is offline   Reply With Quote
Old November 12, 2010, 18:59   #44
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
499th post... 500th will be a link to something you should like
Sirridan is offline   Reply With Quote
Old November 15, 2010, 17:06   #45
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Woot! 500th post!

Right now pyAngband has gone though some changes. I basically threw out a bunch of my object code and such, and have decided to move on with that in a simpler, ground-up approach.

Anyway, commands are generated client-side and sent to the game so that the core logic doesn't give half a crap about keypresses.

Core logic can tell the client to prompt, and can check for instant-inkey for interrupts, not that repeated commands are implemented yet...

Door's can be opened and closed. I need to fix prompts, but besides that it works pretty well.

I will upload to Github a little later, going out now. Will also post a .zip of code here since it is still quite small.

EDIT: Posted source as .zip, only WindowsClient.py works for now, so just run that. I'll fix and upload the CursesClient after a bit.
Attached Files
File Type: zip pyAngband.zip (37.1 KB, 98 views)

Last edited by Sirridan; November 15, 2010 at 20:29.
Sirridan is offline   Reply With Quote
Old November 17, 2010, 18:43   #46
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
So I posted the source of what I have so far. The map is a 2D array of characters, (well a list of lists of characters... anyway) which I know isn't good, but it works *for now*.

Anyway, I'm thinking of implementing a (the?) DungeonCell class, which would just be the container which holds every bit of info about each 'cell' in the dungeon. So, the class would basically have this:

Code:
class DungeonCell(object):
    def __init__(self, x, y, terrain_id, flags):
        self._x = x
        self._y = y
        self._terrain_id = terrain_id
        self._flags = flags
        self._items = []
        self._monster = None
x & y are the coords of that cell

terrain_id is the key to a structure holding information on the terrain for that spot, easy enough.

flags is just that, flags which say if that cell is lit up, been lit up, trap border, etc.

Items is a list of items in that particular cell, if any

monster is the monster currently in that cell, if any

There would be a Dungeon class which holds the cells and such. Any thoughts or suggestions? Thanks for any input
Sirridan is offline   Reply With Quote
Old November 17, 2010, 18:50   #47
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,919
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by Sirridan View Post
So I posted the source of what I have so far. The map is a 2D array of characters, (well a list of lists of characters... anyway) which I know isn't good, but it works *for now*.

Anyway, I'm thinking of implementing a (the?) DungeonCell class, which would just be the container which holds every bit of info about each 'cell' in the dungeon. So, the class would basically have this:

Code:
class DungeonCell(object):
    def __init__(self, x, y, terrain_id, flags):
        self._x = x
        self._y = y
        self._terrain_id = terrain_id
        self._flags = flags
        self._items = []
        self._monster = None
x & y are the coords of that cell

terrain_id is the key to a structure holding information on the terrain for that spot, easy enough.

flags is just that, flags which say if that cell is lit up, been lit up, trap border, etc.

Items is a list of items in that particular cell, if any

monster is the monster currently in that cell, if any

There would be a Dungeon class which holds the cells and such. Any thoughts or suggestions? Thanks for any input
That's the right way to go about it, pretty much what V will look like by 3.2, I think...
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old November 21, 2010, 04:10   #48
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Edit files...

So, thinking about edit files today. Mostly because my fiance is on the other computer which has the current code. I need to remember to commit... ANYWAY

I want edit files for pyAngband to be more readable and editable. I want one to be able to read an entry and figure it out (mostly at least) without having to read and re-reference a guide at the start of the file. So here are my proposals for such things, and as always comments and suggestions are more than welcome!

Code:
object_class.txt - object classes and subclasses, 
---------------------
class: Edged
   items: Dagger, Long Sword, Short Sword, Blade of Chaos
   type: Weapon
class: Hafted
   items: Mace, Two-Handed Great Flail, Mace of Disruption
   type: Weapon
class: Scroll
   items: Phase Door, Word of Recall, *Destruction*
   type: Consumable
class Ring
   items: Speed, Resist Fire, Resist Cold, Acid, Digging
   type: Ring
class Amulet
   items: Magi, ESP
   type: Amulet
class Potion
   items: CLW, CSW., CCW, Life, etc.
   type: Consumable
   
this pretty much goes on, and of course these entries are not complete.
May or may not happen, depending on how I do objects, but it would be cool
to define them all inside a file, right?

object.txt - base items
---------------------
object: Dagger
    class = Edged
    display = '|'
    color = gray
    weight = 14
    damage = 1d4
    value = 30
    rarity = 0
    level = 0 to MAX
    desc = 'A short blade, good for opening arteries and tickling giants.'

object: PDSM
    class = Dragon Armor
    display = '['
    color = purple
    weight = 300
    ac = 30
    damage = 1d2
    value = more than you have
    rarity = you may never see it
    level = 90 to MAX
    resists = 'fire, cold, elec, acid, poison, sound, chaos, shards, pretty much everything'
    activation = BREATHE_ELEMENTS, recharge = 300 + 1d300
    desc = 'You found a PDSM? You lucky dog!'

ego.txt - ego items!
---------------------------
ego: Dwarven
     name: '%o (Dwarven)'
     classes: Armor
     subclasses: Metal Scale Mail, Splint Mail, Plate Mail, etc.
     ac = '2d4'
     value = 30000
     rarity = 1
     level = 10 to MAX
     resists = 'fire' (I know, but just an example...)
     abilities = 'Free Action, Resist Blind'
     powers = 'str + 1d2, con + 1d2, infra + 1d2'

ego: Weapon of Flame
     classes: Edged, Hafted, Polearm
     name: '%o of Flames'
     value = 2000
     rarity = 1
     level = 0 to MAX
     resists = 'fire'
     abilities = 'Brand Fire'

monster.txt - monsters!
----------------------

(this monster isn't 'real', just an example)
monster: TOWNW
     race = 'none' (actually this is omitted if no race)
     name = The One Who Never Was
     hp = 15000, sp = 3000 (sp for 4Gai, not needed if nyi)
     rarity = 0
     level = 150
     resists = 'time, plasma, gravity, force'
     immune = 'fire, acid, cold, elec, poison, sound'
     vulnerable = 'none' (omit if none, just here to show)
     drop = quality (good, excellent, normal, etc), count = num of treasures
     attacks = 'HIT: 6d6 + 20, HIT: 6d6 + 20, HIT_DEGRADE'
     spells = 'TIMEBALL, DESTRUCTION, DISINTEGRATE, GRAVITYBALL': 1 in 5,
                   'BR_TIME, BR_GRAV, BR_PLASMA': 1 in 3
     flags = 'AVOID_50' (prevent damage 50% of time)
     desc = 'A paradox of existence, it never was yet it is here.  Reality twists away as if to escape.'

(if it doesn't cast the first set of spells 1 in 5, it has a 1 in 3 chance to breathe, etc, so different spells could now have different probabilities. at least before new AI is implemented, then again, this may be scrapped for simplicity)
Otherwise edit files keep looking like that, and can be split up into different files. There would be a master file so that file parsing is done in correct order (such as object classes and subclasses being done before objects themselves)

Again, any thoughts/feelings/advice is appreciated!
Sirridan is offline   Reply With Quote
Old November 23, 2010, 06:25   #49
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,367
AnonymousHero is on a distinguished road
Wouldn't it be easier to just use a standard format such as SEXPs or YAML? Writing parsers is fun and all, but it just seems like a waste of time when such alternatives exist with (mostly) bug-free code already written .
AnonymousHero is offline   Reply With Quote
Old November 23, 2010, 08:40   #50
fph
Knight
 
Join Date: Apr 2009
Location: Berlin / Italy
Posts: 747
fph is on a distinguished road
Quote:
Originally Posted by AnonymousHero View Post
Wouldn't it be easier to just use a standard format such as SEXPs or YAML? Writing parsers is fun and all, but it just seems like a waste of time when such alternatives exist with (mostly) bug-free code already written .
His data file format already looks identical to YAML to me. Maybe I am missing a comma somewhere though.
fph 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 05:12.


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