Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.forth

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 03-19-2006, 10:48 PM
Colin MacIntyre
Guest
 
Posts: n/a
Default a roguelike for Forth

My second ever program is the beginnings of a roguelike game. Currently it
features random terrain and a little guy you can walk around the screen. Let
me know if you have any suggestions on how to improve the code (currently
written in RevaForth)

executable: http://china.clanmacintyre.ca/caravan (append with .exe for
windows)
source: http://china.clanmacintyre.ca/caravan0.05

Haven't tested it under Linux, sorry.


Colin MacIntyre




*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 03-20-2006, 01:28 PM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Colin MacIntyre wrote:
> My second ever program is the beginnings of a roguelike game. Currently it
> features random terrain and a little guy you can walk around the screen. Let
> me know if you have any suggestions on how to improve the code (currently
> written in RevaForth)
>
> executable: http://china.clanmacintyre.ca/caravan (append with .exe for
> windows)
> source: http://china.clanmacintyre.ca/caravan0.05
>
> Haven't tested it under Linux, sorry.
>
>
> Colin MacIntyre


Great job Colin! Keep up the good work.

Whats the plan for whats coming up next? Do you have a list of things
to do or are you just going with the flow?

Regards
Jean-Francois Michaud

Reply With Quote
  #3 (permalink)  
Old 03-20-2006, 01:51 PM
Colin MacIntyre
Guest
 
Posts: n/a
Default Re: a roguelike for Forth

"Jean-François Michaud" <cometaj@comcast.net> wrote in message
news:1142864915.220097.298710@u72g2000cwu.googlegr oups.com...
> Great job Colin! Keep up the good work.
>
> Whats the plan for whats coming up next? Do you have a list of things
> to do or are you just going with the flow?


Thank you. I've already made it so when the player exits the edge of the
map, a new map is drawn and the player starts at the correct relative
position. I'm just going with what strikes me as interesting right now, but
I think the next major jobs will be:

1. populating it with creatures. It's easy enough (now) to make ascii
characters move around, but to give them each personal data is the part I'm
not quite sure about.
2. making some items.
3. get some kind of sight radius going, a big one for day and smaller for
night.
4. random name generator for people, maybe some kind of family maker.

If you or anyone else has a mind to help, you're more than welcome!


*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
Reply With Quote
  #4 (permalink)  
Old 03-20-2006, 06:28 PM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Colin MacIntyre wrote:
> "Jean-François Michaud" <cometaj@comcast.net> wrote in message
> news:1142864915.220097.298710@u72g2000cwu.googlegr oups.com...
> > Great job Colin! Keep up the good work.
> >
> > Whats the plan for whats coming up next? Do you have a list of things
> > to do or are you just going with the flow?

>
> Thank you. I've already made it so when the player exits the edge of the
> map, a new map is drawn and the player starts at the correct relative
> position. I'm just going with what strikes me as interesting right now, but
> I think the next major jobs will be:
>
> 1. populating it with creatures. It's easy enough (now) to make ascii
> characters move around, but to give them each personal data is the part I'm
> not quite sure about.


There are different ways of doing this but basically, for each
character, you'll have to create a data structure that contains
characteristics that are specific to it. Health, strenght, speed,
cleverness, etc. Things that you will use in your AI engine to
determine how the creature will act. You can have a base structure that
all creatures share and add a few extras depending on the type of
creature. Or they can all share the same base structure populated with
different values.

These data structures will be updated whenever, for example, associated
creature are wounded (i.e. affecting its speed and strenght as it
looses health). You could also add information concerning location on
the map if you were to allow for users to save their game. You dump the
datastructures in a flat file and when you load the game you repopulate
the data structures from the flat file.

This would also imply saving the current state of the world so you can
recover it too.

> 2. making some items.
> 3. get some kind of sight radius going, a big one for day and smaller for
> night.
> 4. random name generator for people, maybe some kind of family maker.


Sweet, sounds great.

I was wondering if you were planning on going with a level based game
by keeping track of randomly generated screens (so you can walk back to
them later if you want for example). Either pregenerate the levels
before play or generate them on the fly as you go along but keeping
track of what was created before so you can go back to it?

Regards
Jeff

Reply With Quote
  #5 (permalink)  
Old 03-21-2006, 01:29 PM
Colin MacIntyre
Guest
 
Posts: n/a
Default Re: a roguelike for Forth

"Jean-François Michaud" <cometaj@comcast.net> wrote in message
news:1142882929.766988.7920@v46g2000cwv.googlegrou ps.com...
There are different ways of doing this but basically, for each
character, you'll have to create a data structure that contains
characteristics that are specific to it...

I figured as much, but I'll let you know if I run into problems.

>This would also imply saving the current state of the world so you can
>recover it too.


This is the part where I really get lost, and to be honest I'll probably
leave till much later. I haven't even tried using the file-io words in Forth
yet. :-)

>I was wondering if you were planning on going with a level based game
>by keeping track of randomly generated screens (so you can walk back to
>them later if you want for example). Either pregenerate the levels
>before play or generate them on the fly as you go along but keeping
>track of what was created before so you can go back to it?


I thought briefly about this, and I'd probably favour the latter. Generating
on the fly is my kind of style :-). Also, maybe when the player exits a
screen, terrain info is saved, so the next screen will have a n% chance of
generating similar terrain, along with extending to a random length any
river or road encountered at map edge.

Let me know if you have any other (short-term) ideas. I'm afraid if I start
thinking long-term, I run the risk of getting bogged down and disappointed.

Btw, I know you're not a hockey fan, but your Canadiens' man Koivu really
tore it up at the Olympics. I was rooting for the Finns to go all the way to
gold, but them's the breaks...


*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
Reply With Quote
  #6 (permalink)  
Old 03-22-2006, 08:55 PM
Doug Hoffman
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Colin MacIntyre wrote:

> I think the next major jobs will be:
>
> 1. populating it with creatures. It's easy enough (now) to make ascii
> characters move around, but to give them each personal data is the part I'm
> not quite sure about.


Sounds like a job for objects.

Regards,

-Doug

Reply With Quote
  #7 (permalink)  
Old 03-23-2006, 12:15 AM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Doug Hoffman wrote:
> Colin MacIntyre wrote:
>
> > I think the next major jobs will be:
> >
> > 1. populating it with creatures. It's easy enough (now) to make ascii
> > characters move around, but to give them each personal data is the part I'm
> > not quite sure about.

>
> Sounds like a job for objects.


Not really. The object paradigm is just a way of thinking about the
problem and also a way of coding it.

Regards
Jean-Francois Michaud

Reply With Quote
  #8 (permalink)  
Old 03-23-2006, 12:45 AM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Colin MacIntyre wrote:
> "Jean-François Michaud" <cometaj@comcast.net> wrote in message
> news:1142882929.766988.7920@v46g2000cwv.googlegrou ps.com...
> There are different ways of doing this but basically, for each
> character, you'll have to create a data structure that contains
> characteristics that are specific to it...
>
> I figured as much, but I'll let you know if I run into problems.
>
> >This would also imply saving the current state of the world so you can
> >recover it too.

>
> This is the part where I really get lost, and to be honest I'll probably
> leave till much later. I haven't even tried using the file-io words in Forth
> yet. :-)


Shouldn't be too much of a problem . Basically, you have to save
everything. The levels that have been generated so far (drop the
matrices in a files), the creatures and their current status. Your
character. Items. (Drop their data structure in a file)

You'll have to keep track in each creature's data structure, and your
own character's data structure, which level you are in and which
coordinate in the level you are at. Thats the minimal information you
need to localize a creature anywhere in your world according to what
I've seen.

> >I was wondering if you were planning on going with a level based game
> >by keeping track of randomly generated screens (so you can walk back to
> >them later if you want for example). Either pregenerate the levels
> >before play or generate them on the fly as you go along but keeping
> >track of what was created before so you can go back to it?

>
> I thought briefly about this, and I'd probably favour the latter. Generating
> on the fly is my kind of style :-).


Nice!

Also, maybe when the player exits a
> screen, terrain info is saved, so the next screen will have a n% chance of
> generating similar terrain, along with extending to a random length any
> river or road encountered at map edge.


Sounds like a plan!

> Let me know if you have any other (short-term) ideas. I'm afraid if I start
> thinking long-term, I run the risk of getting bogged down and disappointed.


Right now, do you save the content of the world somewhere? In a
matrixlike format? The next big step I see as far as world and creature
integration goes will be creating the engine that makes your creatures
(and yourself) evolve in the world according to established limitations
(walls, water, traps, rocks, etc.) to keep the world coherent at all
times.

A simple way to do this is to have the "AI" engine decide where the
creatures want to go and have the "World" engine test those decisions
against the world to see if they are coherent according to the rules
you set down for your world. The risk with this is that creatures might
end up doing silly things

Another way would be for the world to feed possible moves only, given
creatures positions, to the AI engine and let it decide what to do
next. The latter is probably best since creatures will always be
choosing from a set of possible moves (they won't waste time trying
things that are not possible).

I'm sorry, I get carried away. I love those kinds of projects. I'm
always burried in my own projects so I know how fun they can be.

> Btw, I know you're not a hockey fan, but your Canadiens' man Koivu really
> tore it up at the Olympics. I was rooting for the Finns to go all the wayto
> gold, but them's the breaks...


Doh! I didn't really follow the Olympics. I had other things going on
at the time. And if I had followed them, I definately wouldn't have
paid attention to hockey > hehehe.

Regards
Jean-Francois Michaud

Reply With Quote
  #9 (permalink)  
Old 03-23-2006, 03:36 AM
Colin MacIntyre
Guest
 
Posts: n/a
Default Re: a roguelike for Forth

"Jean-François Michaud" <cometaj@comcast.net> wrote in message
news:1143076559.693615.197960@t31g2000cwb.googlegr oups.com...
>
> Doug Hoffman wrote:
> > Colin MacIntyre wrote:
> >
> > > I think the next major jobs will be:
> > >
> > > 1. populating it with creatures. It's easy enough (now) to make ascii
> > > characters move around, but to give them each personal data is the

part I'm
> > > not quite sure about.

> >
> > Sounds like a job for objects.

>
> Not really. The object paradigm is just a way of thinking about the
> problem and also a way of coding it.
>
> Regards
> Jean-Francois Michaud


I should probably learn that. Have a slight idea from reading Thinking in
Java, but I put it down as the scope was too broad for me to see clearly.
Right now the dirtying of hands is more fun than theory.


*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
Reply With Quote
  #10 (permalink)  
Old 03-23-2006, 12:28 PM
Doug Hoffman
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Jean-François Michaud wrote:
> Doug Hoffman wrote:
> > Sounds like a job for objects.

>
> Not really. The object paradigm is just a way of thinking about the
> problem and also a way of coding it.


For *you* the answer may be "not really". For others the answer will
be "Absolutely!". It is largely a matter of personal preference. I
would not be so quick to dismiss the technique. It is, as you say, "a
way of thinking about the problem and also a way of coding it.".

Regards,

-Doug

Reply With Quote
  #11 (permalink)  
Old 03-23-2006, 01:48 PM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Doug Hoffman wrote:
> Jean-François Michaud wrote:
> > Doug Hoffman wrote:
> > > Sounds like a job for objects.

> >
> > Not really. The object paradigm is just a way of thinking about the
> > problem and also a way of coding it.

>
> For *you* the answer may be "not really".


I said not really because you brought it as something necessary. I was
simply pointing out that it is not. We both know this is true. The
object paradigm trend is also a way to lift the "burden of thought"
from the programmer as far as basic data structures and algorithms go.
It accelerates work at the cost of not understanding the basics when
simply thrown into the paradigm.

I think it is a good idea for him to explore the foundation first to
get a clear understanding of those more basic concepts. Implementing a
binary tree to then use it as opposed to just grabbing one so it can be
tossed it in the program.

Objects are important to accelerate work, but they should not be given
the right of way simply because it is the latest trend.

Regards
Jean-Francois Michaud

Reply With Quote
  #12 (permalink)  
Old 03-23-2006, 04:03 PM
Ed Beroset
Guest
 
Posts: n/a
Default Re: a roguelike for Forth

Jean-François Michaud wrote:
> Doug Hoffman wrote:
>
>>Jean-François Michaud wrote:
>>
>>>Doug Hoffman wrote:
>>>
>>>>Sounds like a job for objects.
>>>
>>>Not really. The object paradigm is just a way of thinking about the
>>>problem and also a way of coding it.

>>
>>For *you* the answer may be "not really".

>
> I said not really because you brought it as something necessary. I was
> simply pointing out that it is not. We both know this is true.

[...]
>
> Objects are important to accelerate work, but they should not be given
> the right of way simply because it is the latest trend.


You seem to have a severe case of "object allergy." I think Doug
mentioned that it seemed like a job for objects because that's a useful
way of framing, understanding and coding the solution and not because
anybody suggests that it's "trendy." If there are multiple
computer-controlled characters in the game, it's a rational design
choice to encapsulate those characters' behavior and attributes as
objects. Technically, it's a good fit.

If it's foolish to adopt a practice just because it's the latest trend,
I suspect that it's equally foolish to reject one for the same reason.

Anyway, if he or the original poster were worried about "trendy" we
wouldn't all be discussing it here in comp.lang.forth which is decidedly
not a trendy language.

Ed
Reply With Quote
  #13 (permalink)  
Old 03-23-2006, 04:15 PM
Colin MacIntyre
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


"Ed Beroset" <beroset@mindspring.com> wrote in message
news:sxAUf.9477$sL2.2720@newsread2.news.atl.earthl ink.net...
> Anyway, if he or the original poster were worried about "trendy" we
> wouldn't all be discussing it here in comp.lang.forth which is decidedly
> not a trendy language.


*sob* sad, but true.

As a kind of cross-cultural gesture, I posted a mini-tutorial on how to make
a map, or 2-D array in Forth to rec.games.roguelike.development. I'm curious
to see if anyone at least wants to try it out. Next I'll get into what I've
learned so far about factoring and vectoring.


Colin


*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
Reply With Quote
  #14 (permalink)  
Old 03-23-2006, 10:05 PM
Stefan Schmiedl
Guest
 
Posts: n/a
Default classless OOP, was Re: a roguelike for Forth

On Wed, 22 Mar 2006 13:55:37 -0800, Doug Hoffman wrote:

>> 1. populating it with creatures. It's easy enough (now) to make ascii
>> characters move around, but to give them each personal data is the part
>> I'm not quite sure about.

>
> Sounds like a job for objects.
>


.... which reminds me that I wanted to ask:

Is a basic library for classless OOP in Forth
available somewhere?

s.

Reply With Quote
  #15 (permalink)  
Old 03-24-2006, 01:01 AM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: a roguelike for Forth


Ed Beroset wrote:
> Jean-François Michaud wrote:
> > Doug Hoffman wrote:
> >
> >>Jean-François Michaud wrote:
> >>
> >>>Doug Hoffman wrote:
> >>>
> >>>>Sounds like a job for objects.
> >>>
> >>>Not really. The object paradigm is just a way of thinking about the
> >>>problem and also a way of coding it.
> >>
> >>For *you* the answer may be "not really".

> >
> > I said not really because you brought it as something necessary. I was
> > simply pointing out that it is not. We both know this is true.

> [...]
> >
> > Objects are important to accelerate work, but they should not be given
> > the right of way simply because it is the latest trend.

>
> You seem to have a severe case of "object allergy."


How do you guys come up with this stuff? Because I'm not pro object in
this situation doesn't mean I'm object allergic. The Aristotelian era
should be over by now. Lets move on to more evenly distributed scheme
of thought shall we.

I think Doug
> mentioned that it seemed like a job for objects because that's a useful
> way of framing, understanding and coding the solution and not because
> anybody suggests that it's "trendy." If there are multiple
> computer-controlled characters in the game, it's a rational design
> choice to encapsulate those characters' behavior and attributes as
> objects. Technically, it's a good fit.


What I'm saying is that this isn't the case. Its no more a good fit
than not. The same can be accomplished just as easily through the use
of basic data structures. If you don't agree, thats fine, you don't
have to.

Anything and everything can be described as being an object, that
doesn't mean that its appropriate to do so in every situation. You can
and you will see a fit for an object EVERYWHERE whenever you consider
whatever it is that you consider by filtering it through the object
standpoint.

Why should he add complexity when it can be so simple?

In any case, Forth is natually Hierarchically inclusive. An artificial
"Object" implementation is not needed.

Regards
Jean-Francois Michaud

Reply With Quote
 
Reply

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 04:41 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.