Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old April 30, 2010, 15:27   #1
ClaytonAguiar
Scout
 
Join Date: May 2009
Posts: 40
ClaytonAguiar is on a distinguished road
Angband borg-friendly?

Hi,

After reading the borg-related recent posts, I thought about it:

Does exist any standard approach/implementation/technique/feature like Windows DDE that can be used the same way in the Linux, Windows and Mac ports of Angband?

This could lead to an interesting feature: borgs, bot players, etc., created by users as separate, plugin software. What would be necessary:
- Add code to "listen" and "answer" the bot process, which would be another application. A protocol would be, probably, needed. No privileged information here, just an equivalent to the information shown in the screen (perhaps the simple screen dump would be enough and easier to implement).
- Adjust the user-input code to accept input from keyboard or from this secondary input source.

It would be funny to see a character played by a "ghost" player (like the 3.0.9 borg), and the developers hurrying to annouce: "My borg implementation is better", "Mage-optimized borg" or even "The best angband borg ever"
ClaytonAguiar is offline   Reply With Quote
Old April 30, 2010, 23:57   #2
fph
Veteran
 
Join Date: Apr 2009
Location: Pisa / DL0
Posts: 1,019
fph is on a distinguished road
You mean something like a pipe, or a simple TCP server+client?
fph is offline   Reply With Quote
Old May 1, 2010, 02:02   #3
ClaytonAguiar
Scout
 
Join Date: May 2009
Posts: 40
ClaytonAguiar is on a distinguished road
Quote:
Originally Posted by fph View Post
You mean something like a pipe, or a simple TCP server+client?
Both could be used. The TCP/IP approach would add undesired side effects: a network-ready O.S. with TCP/IP protocol installed. I think almost every machine that runs angband today has TCP/IP installed (except NDS, I guess). This would lead to two different releases. Some people here wouldn't be happy

Pipes: I know Windows has support to named pipes for interprocess communication. But what about Linux and Mac? The implementation for these OS'es would be similar?
ClaytonAguiar is offline   Reply With Quote
Old May 1, 2010, 09:10   #4
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,725
Donated: $40
Pete Mack will become famous soon enough
Pipes (and named pipes) are an original UNIX feature dating back to 1972. Windows borrowed them much, much later.
Pete Mack is offline   Reply With Quote
Old May 1, 2010, 11:21   #5
fph
Veteran
 
Join Date: Apr 2009
Location: Pisa / DL0
Posts: 1,019
fph is on a distinguished road
Quote:
Pipes: I know Windows has support to named pipes for interprocess communication. But what about Linux and Mac? The implementation for these OS'es would be similar?
This is a bit like when an American woman asked me if we do have pizza in Italy... baby, we basically invented it

I suppose the biggest issue now is whether the Nintendo DS has them (pipes, not pizza). But even if it doesn't, I guess it wouldn't be hard to #ifdef out all the related stuff from the DS port.
fph is offline   Reply With Quote
Old May 2, 2010, 05:09   #6
Zikke
Veteran
 
Join Date: Jun 2008
Location: Los Angeles
Posts: 1,069
Zikke is on a distinguished road
Quote:
Originally Posted by fph View Post
This is a bit like when an American woman asked me if we do have pizza in Italy... baby, we basically invented it

I suppose the biggest issue now is whether the Nintendo DS has them (pipes, not pizza). But even if it doesn't, I guess it wouldn't be hard to #ifdef out all the related stuff from the DS port.
There's a difference between invented and perfected
__________________
A(3.1.0b) CWS "Fyren_V" NEW L:50 DL:127 A++ R+++ Sp+ w:The Great Axe of Eonwe
A/FA W H- D c-- !f PV+++ s? d P++ M+
C- S+ I- !So B ac++ GHB? SQ? !RQ V F:
Zikke is offline   Reply With Quote
Old May 2, 2010, 05:21   #7
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,725
Donated: $40
Pete Mack will become famous soon enough
I don't think the input is a problem--after all, you can redirect standard input. The difficulty is how do you do the map? Right now, the borg works by screen scraping. To do that over a pipe, you basically need to implement another terminal interface, (maybe main-borg.c)
Pete Mack is offline   Reply With Quote
Old May 2, 2010, 06:46   #8
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,724
PowerDiver is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
I don't think the input is a problem--after all, you can redirect standard input.
The game does not read standard input, at least on the linux boxes I use. It grabs the keyboard directly. I tried to "tee" standard input to save keystrokes to log for movie action and it did not work.

Is there an easy way to make it read from stdin?
PowerDiver is offline   Reply With Quote
Old May 2, 2010, 16:52   #9
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 42
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by PowerDiver View Post
The game does not read standard input, at least on the linux boxes I use. It grabs the keyboard directly. I tried to "tee" standard input to save keystrokes to log for movie action and it did not work.

Is there an easy way to make it read from stdin?
So first of all, I assume we're only talking about the main-gcu port. Most of the other ports are not using anything like STDIN to get their data (e.g. they are reading X events, or SDL events, or whatever).

In the terminal, the input is coming from the controlling terminal, which isn't just a file descriptor but is actually a PTY. The different is that the curses code uses various ioctls and stuff to change the input between blocking/non-blocking IO, as well as various other things that curses does. So if you want to be in the middle logging input, you can't just use tee but you have to actually allocate your own pseudoterminal, set it up, etc.

I started writing a script to try to "wrap" angband, passing the data back and forth asynchronously so you could have a log of input and/or output while still playing the game. I'm not optimistic about how well it will work given the potential buffering issues and the fact that curses does a lot of pty-level hackery that you'd have to make sure to actually intercept and pass off to the "real" terminal.

I guess the short answer was "no".
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old May 2, 2010, 19:32   #10
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Quote:
Originally Posted by fph View Post
This is a bit like when an American woman asked me if we do have pizza in Italy... baby, we basically invented it

I suppose the biggest issue now is whether the Nintendo DS has them (pipes, not pizza). But even if it doesn't, I guess it wouldn't be hard to #ifdef out all the related stuff from the DS port.
http://akkit.org/dswifi/

I'm not too keen on nds coding, (and I don't have the adapter yet to try) but here's a lib that should do tcp-ip
Sirridan 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
Angband Borg 3.0.9 and windows Zappa Vanilla 38 October 27, 2010 21:31
Any recommended variants that are fairly noob-friendly? BlackFlame Variants 15 October 10, 2009 08:41
Towards an eco-friendly 3.1 Donald Jonker Vanilla 22 January 27, 2009 15:29
APW angband borg halts? chief Vanilla 1 December 1, 2008 22:21
Angband and the Borg on Linux wastedyouth Vanilla 20 July 23, 2008 01:08


All times are GMT +1. The time now is 05:24.


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