* New Ada ANSI console/X terminal game @ 2005-11-08 10:19 David Trudgett 2005-11-08 17:38 ` Pascal Obry ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: David Trudgett @ 2005-11-08 10:19 UTC (permalink / raw) Hi everyone, For those who may be interested, I've just posted to my website a first release (version 0.99) of my "High Seas Battleship" network game. You can find the source code for it at: http://www.zeta.org.au/~wpower/dkt/programs/high-seas-battleship.tar.gz It's a full-screen colour text-based application written for Linux console or xterm, but should work on most ANSI compatible terminal devices. My program makes use of Samuel Tardieu's AdaSockets, which I doubt works on Windows (the manual seems to mention only Unix and OpenVMS), so I likewise doubt that High Seas will work as it is under Windows, even assuming that there is a suitable ANSI terminal available for Windows. It should be easy, however, to adapt the comms layer to use a different sockets library, if desired. For non-GNAT users, I should probably mention that the program uses a GNAT specific library (in the main procedure, battleship.adb) to access environment variables, so you'll probably want to replace this with the relevant vendor-specific library, or perhaps Ada.Command_Line.Environment (I didn't use it myself because GNAT warned me that this is an internal GNAT package that therefore shouldn't be used). Besides AdaSockets and GNAT.OS_Lib just referred to, there are no other dependencies except that you'll probably want a C compiler to compile a couple of utility routines (which could probably be omitted, though). To compile under Linux/Unix, assuming you have GNAT and libadasockets installed, you will probably just need to edit the Makefile and run make. The project was pursued simply as an Ada learning exercise, so comments would be appreciated, if you have any. Regards, David -- David Trudgett http://www.zeta.org.au/~wpower/ Most of the major ills of the world have been caused by well-meaning people who ignored the principle of individual freedom, except as applied to themselves, and who were obsessed with fanatical zeal to improve the lot of mankind-in-the-mass through some pet formula of their own. The harm done by ordinary criminals, murderers, gangsters, and thieves is negligible in comparison with the agony inflicted upon human beings by the professional do-gooders, who attempt to set themselves up as gods on earth and who would ruthlessly force their views on all others - with the abiding assurance that the end justifies the means. -- Henry Grady Weaver (author), (from The Mainspring of Human Progress) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-08 10:19 New Ada ANSI console/X terminal game David Trudgett @ 2005-11-08 17:38 ` Pascal Obry 2005-11-08 21:50 ` David Trudgett 2005-11-09 6:53 ` Ross Higson 2005-11-12 9:05 ` David Trudgett 2 siblings, 1 reply; 11+ messages in thread From: Pascal Obry @ 2005-11-08 17:38 UTC (permalink / raw) To: David Trudgett David, > It's a full-screen colour text-based application written for Linux > console or xterm, but should work on most ANSI compatible terminal > devices. My program makes use of Samuel Tardieu's AdaSockets, which I > doubt works on Windows (the manual seems to mention only Unix and No problem. AdaSockets does work on Windows we have been using it for AWS. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-08 17:38 ` Pascal Obry @ 2005-11-08 21:50 ` David Trudgett 0 siblings, 0 replies; 11+ messages in thread From: David Trudgett @ 2005-11-08 21:50 UTC (permalink / raw) Pascal Obry <pascal@obry.net> writes: > David, > >> It's a full-screen colour text-based application written for Linux >> console or xterm, but should work on most ANSI compatible terminal >> devices. My program makes use of Samuel Tardieu's AdaSockets, which >> I doubt works on Windows (the manual seems to mention only Unix and > > No problem. AdaSockets does work on Windows we have been using it > for AWS. Good stuff! Thanks, Pascal. Cheers, David -- David Trudgett http://www.zeta.org.au/~wpower/ It's sociologically interesting, though scary, that you can be inside an evil system and be somehow unaware of it. -- Actor Anthony Sher on growing up in apartheid-South Africa, interviewed by John Walsh, The Independent, 1 May, 2000 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-08 10:19 New Ada ANSI console/X terminal game David Trudgett 2005-11-08 17:38 ` Pascal Obry @ 2005-11-09 6:53 ` Ross Higson 2005-11-09 8:34 ` David Trudgett 2005-11-12 9:05 ` David Trudgett 2 siblings, 1 reply; 11+ messages in thread From: Ross Higson @ 2005-11-09 6:53 UTC (permalink / raw) David Trudgett wrote: > For those who may be interested, I've just posted to my website a > first release (version 0.99) of my "High Seas Battleship" network > game. You can find the source code for it at: > > http://www.zeta.org.au/~wpower/dkt/programs/high-seas-battleship.tar.gz > > It's a full-screen colour text-based application written for Linux > console or xterm, but should work on most ANSI compatible terminal > devices. My program makes use of Samuel Tardieu's AdaSockets, which I > doubt works on Windows (the manual seems to mention only Unix and > OpenVMS), so I likewise doubt that High Seas will work as it is under > Windows, even assuming that there is a suitable ANSI terminal > available for Windows. It should be easy, however, to adapt the comms > layer to use a different sockets library, if desired. > ... > To compile under Linux/Unix, assuming you have GNAT and libadasockets > installed, you will probably just need to edit the Makefile and run > make. > David, Nice. Since you already use some GNAT-specific packages, you could also use the package GNAT.Sockets. Then you wouldn't need AdaSockets. It is easy to modify your program to use GNAT sockets. I can email you the source changes if you want - it took me about 15 minutes to convert, since nearly all the changes are in the class_comms package. Either way, once you have a native windows executable you could use my redirect program to run it. For example, instead of entering your commands: battleship player_1 wait battleship player_2 connect localhost you would execute the programs under redirect: redirect /noedit /uself /mode=vt100 battleship player_1 wait redirect /noedit /uself /mode=vt100 battleship player_2 connect localhost The redirect options ("/noedit /uself" etc) tell redirect how to emulate the mode your program appears to expect - especially the keyboard emulation. Redirect is part of the Ada Terminal Emulator package. It uses GWindows and compiles under GNAT 3.15 or GNAT GPL 2005. But you don't need to compile it - just download the compiled version from: http://www.members.optusnet.com.au/~rosshigson/ Ross. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-09 6:53 ` Ross Higson @ 2005-11-09 8:34 ` David Trudgett 2005-11-09 8:55 ` Ross Higson 2005-12-01 0:29 ` Randy Brukardt 0 siblings, 2 replies; 11+ messages in thread From: David Trudgett @ 2005-11-09 8:34 UTC (permalink / raw) Ross Higson <rossNOSPAMhigson@optusnet.com.au> writes: > David Trudgett wrote: > >> For those who may be interested, I've just posted to my website a >> first release (version 0.99) of my "High Seas Battleship" network >> game. You can find the source code for it at: >> http://www.zeta.org.au/~wpower/dkt/programs/high-seas-battleship.tar.gz > > Nice. Hope you like it! :-) I take it you got it working on Windows, then? > > Since you already use some GNAT-specific packages, you could also use > the package GNAT.Sockets. Then you wouldn't need AdaSockets. Actually, the only GNAT-specific package I used was the GNAT.OS_Lib one, and that was purely for access to environment variables which, at a pinch, could easily be removed from the program. On the other hand, sockets are kind of essential for a network game! ;-) I tried to avoid GNAT-specific packages mainly for portability to other compilers. However, it could be a possibility to have two versions: a GNAT.Sockets and an AdaSockets version. How much mucking around that would be in practice I'm not sure at the moment. Clearly, though, if the code is already written for me, then that's already a bit less mucking around! :-) > It is easy to modify your program to use GNAT sockets. I can email > you the source changes if you want - it took me about 15 minutes to > convert, since nearly all the changes are in the class_comms > package. Hey, 15 minutes, that's pretty good going! Yes, I'd love to see your mods, if you would like to email them to me. I may be able to make use of them, as I indicated above. > > Either way, once you have a native windows executable you could use my > redirect program to run it. For example, instead of entering your > commands: > > battleship player_1 wait > battleship player_2 connect localhost > > you would execute the programs under redirect: > > redirect /noedit /uself /mode=vt100 battleship player_1 wait > redirect /noedit /uself /mode=vt100 battleship player_2 connect localhost That sounds great! I was wondering how I might accomplish that little feat! Does the noedit switch also suppress local echo? You probably noticed my "no echo" routine was Unix specific. I don't think it's absolutely essential to suppress local echo in any case. Unfortunately, I don't have a Windows box that I can easily use to try all this, and to build a Windows executable. The kids have a very old machine that might be sufficient, but it has got like about 50Mb free disk space, and they swear! that there's nothing much that can be got rid of! There are some really important games on there, you see! :-) Little do they know that I have a really, *really* important game to put on it. ;-) I'll conduct a proper inspection, I think, when I get a few minutes. > > The redirect options ("/noedit /uself" etc) tell redirect how to > emulate the mode your program appears to expect - especially the > keyboard emulation. Sounds pretty funky! > > Redirect is part of the Ada Terminal Emulator package. It uses > GWindows and compiles under GNAT 3.15 or GNAT GPL 2005. But you don't > need to compile it - just download the compiled version from: > > http://www.members.optusnet.com.au/~rosshigson/ OK, muchas gracias. I'll probably be doing that sometime soon, after I pay a visit to the kids' museum piece! David -- David Trudgett http://www.zeta.org.au/~wpower/ The recognition or non-recognition of a certain truth depends not on external causes, but on certain other causes within the man himself. So that at times under external conditions apparently very favorable for the recognition of truth, one man will not recognize it, and another, on the contrary, under the most unfavorable conditions will, without apparent cause, recognize it. As it is said in the Gospel, "No man can come unto me, except the Father which hath sent me draw him." That is to say, the recognition of truth, which is the cause of all the manifestations of human life, does not depend on external phenomena, but on certain inner spiritual characteristics of the man which escape our observation. -- Leo Tolstoy, "The Kingdom of God is Within You" ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-09 8:34 ` David Trudgett @ 2005-11-09 8:55 ` Ross Higson 2005-11-09 22:09 ` David Trudgett 2005-12-01 0:29 ` Randy Brukardt 1 sibling, 1 reply; 11+ messages in thread From: Ross Higson @ 2005-11-09 8:55 UTC (permalink / raw) David Trudgett wrote: > Hope you like it! :-) I take it you got it working on Windows, then? Yes. I'm not saying it's a great porting job, but but I'll email you the modified source. It's mostly simple name changes. > That sounds great! I was wondering how I might accomplish that little > feat! Does the noedit switch also suppress local echo? You probably > noticed my "no echo" routine was Unix specific. I don't think it's > absolutely essential to suppress local echo in any case. I simply removed your unix-specific echo manipulation. I have a separate "/[no]echo" option in redirect, but it is off by default, so I didn't need to specify it. > Unfortunately, I don't have a Windows box that I can easily use to try > all this, and to build a Windows executable. I'll include a Windows executable in the mail so you can try it with redirect. BTW, I notice the "help" command seems to lock up the game. Haven't had time to investigate in detail yet. > OK, muchas gracias. I'll probably be doing that sometime soon, after I > pay a visit to the kids' museum piece! If you want museum pieces, you've come to the right news group :) Ross. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-09 8:55 ` Ross Higson @ 2005-11-09 22:09 ` David Trudgett 0 siblings, 0 replies; 11+ messages in thread From: David Trudgett @ 2005-11-09 22:09 UTC (permalink / raw) Ross Higson <rossNOSPAMhigson@optusnet.com.au> writes: > David Trudgett wrote: > >> Hope you like it! :-) I take it you got it working on Windows, then? > > Yes. I'm not saying it's a great porting job, but but I'll email you > the modified source. It's mostly simple name changes. Thanks for the email, Ross, much appreciated. I've had a look through all the places you changed (made easy by the diffs you supplied), but I'll have a closer look when I get a chance. > >> Unfortunately, I don't have a Windows box that I can easily use to try >> all this, and to build a Windows executable. > > I'll include a Windows executable in the mail so you can try it with > redirect. BTW, I notice the "help" command seems to lock up the > game. Haven't had time to investigate in detail yet. I had a problem like that during development, but fixed it (seemingly). It doesn't happen on Linux any more. My guess is that there is a threading issue somewhere that is only showing up on the Windows version. > >> OK, muchas gracias. I'll probably be doing that sometime soon, after I >> pay a visit to the kids' museum piece! > > If you want museum pieces, you've come to the right news group :) Did I tell you about the time when I was a wee lad... David -- David Trudgett http://www.zeta.org.au/~wpower/ ... it is easy to be blinded to the essential uselessness of them by the sense of achievement you get from getting them to work at all. In other words... their fundamental design flaws are completely hidden by their superficial design flaws. -- The Hitchhiker's Guide to the Galaxy, on the products of the Sirius Cybernetics Corporation. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-09 8:34 ` David Trudgett 2005-11-09 8:55 ` Ross Higson @ 2005-12-01 0:29 ` Randy Brukardt 2005-12-02 2:30 ` David Trudgett 1 sibling, 1 reply; 11+ messages in thread From: Randy Brukardt @ 2005-12-01 0:29 UTC (permalink / raw) "David Trudgett" <wpower@zeta.org.au.nospamplease> wrote in message news:m3r79qmd8h.fsf@rr.trudgett... ... > Actually, the only GNAT-specific package I used was the GNAT.OS_Lib > one, and that was purely for access to environment variables which, at > a pinch, could easily be removed from the program. For Ada 200Y, you should use Ada.Environment_Variables instead. That will be supported on all Ada 200Y compilers. For Ada 95, well, you'll have to depend on system specific stuff. Randy. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-12-01 0:29 ` Randy Brukardt @ 2005-12-02 2:30 ` David Trudgett 2005-12-02 6:46 ` Martin Dowie 0 siblings, 1 reply; 11+ messages in thread From: David Trudgett @ 2005-12-02 2:30 UTC (permalink / raw) "Randy Brukardt" <randy@rrsoftware.com> writes: > "David Trudgett" <wpower@zeta.org.au.nospamplease> wrote in message > news:m3r79qmd8h.fsf@rr.trudgett... > ... >> Actually, the only GNAT-specific package I used was the GNAT.OS_Lib >> one, and that was purely for access to environment variables which, at >> a pinch, could easily be removed from the program. > > For Ada 200Y, you should use Ada.Environment_Variables instead. That will be > supported on all Ada 200Y compilers. For Ada 95, well, you'll have to depend > on system specific stuff. > Thanks, Randy, I'll keep it in mind. I'm not sure how long it will be, though, before the new standard gets widespread support. Wait and see, I guess. Not that it really matters that much for a little console game, I suppose. David -- David Trudgett http://www.zeta.org.au/~wpower/ It's sociologically interesting, though scary, that you can be inside an evil system and be somehow unaware of it. -- Actor Anthony Sher on growing up in apartheid-South Africa, interviewed by John Walsh, The Independent, 1 May, 2000 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-12-02 2:30 ` David Trudgett @ 2005-12-02 6:46 ` Martin Dowie 0 siblings, 0 replies; 11+ messages in thread From: Martin Dowie @ 2005-12-02 6:46 UTC (permalink / raw) David Trudgett wrote: > "Randy Brukardt" <randy@rrsoftware.com> writes: > > >>"David Trudgett" <wpower@zeta.org.au.nospamplease> wrote in message >>news:m3r79qmd8h.fsf@rr.trudgett... >>... >> >>>Actually, the only GNAT-specific package I used was the GNAT.OS_Lib >>>one, and that was purely for access to environment variables which, at >>>a pinch, could easily be removed from the program. >> >>For Ada 200Y, you should use Ada.Environment_Variables instead. That will be >>supported on all Ada 200Y compilers. For Ada 95, well, you'll have to depend >>on system specific stuff. >> > > > Thanks, Randy, I'll keep it in mind. I'm not sure how long it will be, > though, before the new standard gets widespread support. Wait and see, > I guess. Not that it really matters that much for a little console > game, I suppose. If you're running on Windows there is an Ada95 version available from www.afraidof.co.uk Cheers -- Martin ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: New Ada ANSI console/X terminal game 2005-11-08 10:19 New Ada ANSI console/X terminal game David Trudgett 2005-11-08 17:38 ` Pascal Obry 2005-11-09 6:53 ` Ross Higson @ 2005-11-12 9:05 ` David Trudgett 2 siblings, 0 replies; 11+ messages in thread From: David Trudgett @ 2005-11-12 9:05 UTC (permalink / raw) David Trudgett <wpower@zeta.org.au.nospamplease> writes: > For those who may be interested, I've just posted to my website a > first release (version 0.99) of my "High Seas Battleship" network > game. You can find the source code for it at: Those who have downloaded the initial release may like to know that I have posted a small bugfix to my High Seas Battleship game. The updated version is at: http://www.zeta.org.au/~wpower/dkt/programs/high-seas-battleship_v0.99a.tar.gz This fixes a bug whereby it was possible to change the position of one's fleet mid-game by typing the caret symbol. Oops... ;-) Cheers, David -- David Trudgett http://www.zeta.org.au/~wpower/ Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity. -- Martin Luther King, Jr. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-12-02 6:46 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-11-08 10:19 New Ada ANSI console/X terminal game David Trudgett 2005-11-08 17:38 ` Pascal Obry 2005-11-08 21:50 ` David Trudgett 2005-11-09 6:53 ` Ross Higson 2005-11-09 8:34 ` David Trudgett 2005-11-09 8:55 ` Ross Higson 2005-11-09 22:09 ` David Trudgett 2005-12-01 0:29 ` Randy Brukardt 2005-12-02 2:30 ` David Trudgett 2005-12-02 6:46 ` Martin Dowie 2005-11-12 9:05 ` David Trudgett
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox