comp.lang.ada
 help / color / mirror / Atom feed
* Re: Ada for Game programming
       [not found] <898358420.19245.0.nnrp-08.c2de5e53@news.demon.co.uk>
  1998-06-20  0:00 ` Buffering inputted characters Joel VanLaven
@ 1998-06-20  0:00 ` Markus Kuhn
  1998-06-20  0:00   ` Tom Moran
  1998-06-21  0:00   ` Jerry van Dijk
  1998-06-20  0:00 ` Buffering inputted characters Markus Kuhn
  2 siblings, 2 replies; 6+ messages in thread
From: Markus Kuhn @ 1998-06-20  0:00 UTC (permalink / raw)



> I am attempting to write a game in Ada 95.  I am aware that this is hardly
> the most optimal platform for building a game, [...]

On the contrary! Ada is an excellent game programming langauge,
just the Ada standard library lacks the necessary functionality.

I believe that Ada95 is one of the best programming languages for
computer games, especially for video games with many different moving
objects that interact in complex ways. Ada's tasks allows such
applications to be implemented in a much cleaner and well-structured
way than other programming languages such as C++. Remember after
all that Ada has been developed for the world's largest buyer of
wargame software. Most DoD applications in the end are shoot-em-up
games, and the programming techniques used in avionics software and
in a video game are strikingly similar.

I am surprised to see how boring and without phantasy many examples
in introductory programming classes and textbooks are. Student
motivation could be increased an order of magnitude if the course
goals are tought in the form of video game programming projects.

Video games are absolutely excellent examples for teaching
object-oriented programming, concurrent programming, and real-time
programming. They also can be used as a vehicle to teach some
aspects of artificial intelligence techniques.

The Ada teaching community should put together a simple kit of Ada
packages for game programming in introductory programming classes.
This package should provide the following functionality:

  - user interface (keyboard, mouse, and joystick query)
  - graphics (procedures for loading bitmaps from files and for
    moving bitmaps efficiently around in memory, including masked
    bitblt operations)
  - sound (procedures for loading sound files into memory and
    playing them over the audio output)
  - one or two small excellently structured and documents
    example games that show how the library is used

This educational game API need and should not be very high
level, all it should do is to hide hardware dependent aspects of
video game programming from the student. Especially implementing
the concurrency aspects of games should be the student's task.

I think there is a need for a well-writen introductory
Ada95 textbook that does not try to just teach the language, but
that makes it clear to the student that the goal of the course
is to enable her to implement richly structured video games by
using the Ada mechanisms for concurrency and program structuring.

It is good practice to give students at the start of a course a
vision of what they will be able to implement as their final project
(e.g., a web browser or a video game). All material presented in
the course should them presented to the students together with
pointing out the relevance for this final project.

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Buffering inputted characters
       [not found] <898358420.19245.0.nnrp-08.c2de5e53@news.demon.co.uk>
  1998-06-20  0:00 ` Buffering inputted characters Joel VanLaven
  1998-06-20  0:00 ` Ada for Game programming Markus Kuhn
@ 1998-06-20  0:00 ` Markus Kuhn
       [not found]   ` <898426975.29878.0.nnrp-06.c2de5e53@news.demon.co.uk>
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Kuhn @ 1998-06-20  0:00 UTC (permalink / raw)



> What I would like to know is how I can get a program to look for
> (keyboard) input.  It would check to see if there has been any, and carry
> out appropriate actions depending on the input.  How can this be done
> *without holding up the rest of the program?*

Have you tried putting a call to Ada.Text_IO.Get_Immediate
into a task of its own that communicates any key presses via
entry calls to the main task of your game?

In case tasks have not yet been covered in your course, I highly
recommend you to read the tasks section of your Ada textbook before
you proceed. Tasks are an incredibly useful tool for video game
programming in Ada.

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Buffering inputted characters
       [not found] <898358420.19245.0.nnrp-08.c2de5e53@news.demon.co.uk>
@ 1998-06-20  0:00 ` Joel VanLaven
  1998-06-20  0:00 ` Ada for Game programming Markus Kuhn
  1998-06-20  0:00 ` Buffering inputted characters Markus Kuhn
  2 siblings, 0 replies; 6+ messages in thread
From: Joel VanLaven @ 1998-06-20  0:00 UTC (permalink / raw)



PantsMaster <dougie@drumkit.demon.co.uk> wrote:

: I am attempting to write a game in Ada 95.  I am aware that this is hardly
: the most optimal platform for building a game, but nevertheless I am giving
: it a go.  What I would like to know is how I can get a program to look for
: (keyboard) input.  It would check to see if there has been any, and carry
: out appropriate actions depending on the input.  How can this be done
: *without holding up the rest of the program?*

Text_io.get_immediate is your answer.  Note that this will also return
control characters like new-lines and such (as opposed to get).

Note that simce this is a new Ada95 feature that requires new ways of
doing things some implementations might not get it completely right :)
However, I think that new features like this have firmed up alot since
the first Ada95 compilers.

Here is A.10.7 (11-12) from the Ada95 LRM:

procedure Get_Immediate(File      : in  File_Type;
                        Item      : out Character;
                        Available : out Boolean);

procedure Get_Immediate(Item      : out Character;
                        Available : out Boolean);

f a character, either control or graphic, is available from the specified
File or the default input file, then the character is read; Available is
True and Item contains the value of this character. If a character is not
available, then Available is False and the value of Item is not
specified. Mode_Error is propagated if the mode of the file is not
In_File. End_Error is propagated if at the end of the file. The current
column, line and page numbers for the file are not affected. 


Note that there is a get_immediate without the available parameter.  This
will cause the program to await input in the same way the get procedure
will.

-- Joel VanLaven




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada for Game programming
  1998-06-20  0:00 ` Ada for Game programming Markus Kuhn
@ 1998-06-20  0:00   ` Tom Moran
  1998-06-21  0:00   ` Jerry van Dijk
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Moran @ 1998-06-20  0:00 UTC (permalink / raw)



As an extremely simple example of using Ada tasks for a 'video
game'-like display on MS Windows, take a look at my "ad_agency" demo
in the Claw demo at www.rrsoftware.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Thanks - now another query
       [not found]   ` <898426975.29878.0.nnrp-06.c2de5e53@news.demon.co.uk>
@ 1998-06-21  0:00     ` Markus Kuhn
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Kuhn @ 1998-06-21  0:00 UTC (permalink / raw)



PantsMaster wrote:
> I am now seeking something that will return the time elapsed since a
> particular event (e.g. power on, or starting a program).

If you do not have a book copy of the Ada95 reference manual (something
every Ada programmer should have on the desk), then check the online
version on

  http://wuarchive.wustl.edu/languages/ada/userdocs/docadalt/rm95/index.htm

You'll find what you need in Annex D.8 (Real-Time Systems, Monotonic
Time).

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada for Game programming
  1998-06-20  0:00 ` Ada for Game programming Markus Kuhn
  1998-06-20  0:00   ` Tom Moran
@ 1998-06-21  0:00   ` Jerry van Dijk
  1 sibling, 0 replies; 6+ messages in thread
From: Jerry van Dijk @ 1998-06-21  0:00 UTC (permalink / raw)



Markus Kuhn (Markus.Kuhn@cl.cam.ac.uk) wrote:

: The Ada teaching community should put together a simple kit of Ada
: packages for game programming in introductory programming classes.
: This package should provide the following functionality:

:   - user interface (keyboard, mouse, and joystick query)
:   - graphics (procedures for loading bitmaps from files and for
:     moving bitmaps efficiently around in memory, including masked
:     bitblt operations)
:   - sound (procedures for loading sound files into memory and
:     playing them over the audio output)
:   - one or two small excellently structured and documents
:     example games that show how the library is used

Which platform would you aim at ? Win32, DOS, Unix, ... ?

Jerry.

-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-06-21  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <898358420.19245.0.nnrp-08.c2de5e53@news.demon.co.uk>
1998-06-20  0:00 ` Buffering inputted characters Joel VanLaven
1998-06-20  0:00 ` Ada for Game programming Markus Kuhn
1998-06-20  0:00   ` Tom Moran
1998-06-21  0:00   ` Jerry van Dijk
1998-06-20  0:00 ` Buffering inputted characters Markus Kuhn
     [not found]   ` <898426975.29878.0.nnrp-06.c2de5e53@news.demon.co.uk>
1998-06-21  0:00     ` Thanks - now another query Markus Kuhn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox