I have updated ge.cpp because there were some errors in DoHead(). Centipedes move correctly now, but there's still some bugs in the ReverseCentipede() code which I will have to fix after my holiday. I've decided to leave the laptop at home, so there'll be no more updates for about 2 weeks.
wep
Hi,
It's been a long time since my last post. I haven't been able to do much work. I've spent some of it thinking about how to move centipedes though.
This morning I wrote an important part of the movement code. There are still some bugs to iron out and I have to make sure that all zzt's quirks are included as well. So there will be a lot of testing to do.
I will upload the latest code in a minute, but I wouldn't build any houses on this. Meaning that stuff may still change. I know there have been a lot of different changes to the code, but this subject turned out to be a lot more difficult than I imagined it to be at the start.... read more
I had a thought today. An important one I think...
While thinking about centipede movement, I have really been worrying about two problems at the same time. I have been researching how zzt updates heads and segments so deeply that I forgot to take a step back. I have taken that step now and here's what I saw.
ZZT does not update objects in a linear fashion. That would make object movement obvious and predictable: not much fun in a game. So Tim came up with a way of pseudo-randomly updating objects, using what I have come to know as the "cycle speed" parameter that is contained in each object. I now think that whoever came up with that term (cycle speed) was mistaken. Certainly, increasing the cycle speed setting slows things down. But I think that is just a side effect of the real or at least more important use for the parameter. How ZZT exactly manages to update a subset of all creatures in every game loop, but still to update them all over the course of time is not yet clear to me. That this way of working causes problems when animating objects that are related to eachother (centipedes) is obvious to me.... read more
The research into how centipedes move has resulted in a rather extensive project in itself.
To be clear on the situation: I have the code for linking segments to heads. Animating them shouldn't be very difficult. But the way I have come up with does not exactly match the zzt works. On the surface it will be very difficult to detect, but under water there would be major differences. I'll expand a little.... read more
On Centipedes
Heads are always on the move and never stop unless there is no room to move.
Heads normally only change direction when they are at a player axis
or when they hit an obstruction. Intelligence determines the odds of
whether it will move towards or away from the player.
Deviance will influence the number of times a head will change direction
for no reason at all.
A head with the lowest intelligence will mostly just go forward until
it hits a wall and then change direction.
A higer deviance will determine how often a head will change direction.
When a head with segments cannot move in any direction but towards
its segments, the last segments becomes the head and the head becomes
the last segment.
Segments that are not part of a list will become heads.
When a centipede's head is boxed in, but there is room behind the last segment,
all segments become heads.
When a centipede's head is surrounded by segments, all segments also become
heads.
When a centipede is boxed in and there is no room to go anywhere, it just sits
there without changing. Under water, the segments aren't linked to the head.
When you save a game a split second after starting it (with centipedes on the
board), you can catch zzt setting up the centipedes. This can be seen by
looking at the "next segment" and "previous segment" pointers. Right after
saving a new board, all these segment pointer have the value 0xFFFF. But, if
you save at exactly the right moment, you will see segments with "previous
segment" pointers with a value of 0xFFFE. After the centipede has taken a single
step, this is no longer visible. This proves that zzt sets up the centipedes
at the first move of the head.
When setting up centipedes, zzt uses clock wise and counter clock wise methods:
1. a head sitting half way and to the left of a column of segments,
will link the segments in the lower half of the column (clockwise)
2. a head sitting half way and to the right of a column of segments,
will link the segments in the upper half of the column (clockwise)
3. a head sitting half way and above of a row of segments,
will link the segments in the right half of the row (counter clockwise)
4. a head sitting half way and below a row of segments,
will link the segments in the left half of the row (counter clockwise)
Regardless of these directions, a segment adjacent to a linked centipede,
will sometimes be linked at the end of the centipede and sometimes go on
as a head.
How zzt probably handles centipedes
When a board is loaded and the player presses P for Play and has moved out
of the Pausing position, zzt starts setting up the centipedes. Not before.
There are several reasons that support this assumption. First, when starting
a board, centipedes may not always be connected in exactly the same way. In
certain configurations, a trailing segment will sometimes become an unlinked
head and sometimes the last segment. Second, when analysing games that were
saved very shortly after they are started (even before a centipede moves) I
saw that the segments are linked together relatively late after starting play.... read more
After thinking about it some more, I rewrote the code for centipede movement.
I have now created a base upon which I can build the rest of the routine. All that remains now is building in some decision moments at which the head decides to change direction. Also, there are some special situations to take care of, like reversing direction when a head moves into a place it can't move out of.
Basically centipedes always move forward, left or right. In no other option is left, backwards is an option. Normally a head will keep moving clockwise or counter clockwise. ... read more
Centipede movement is harder that I had anticipated. My assumption that a centipede head moved like any other creature without a tail appears to be dead wrong. Centipedes like to walk in straight lines a lot more, so calculating their next move based on the player's current position, intelligence and deviance values is pretty hard to do, when all I have is original zzt to look at.
Anyway, I figure that centipedes need to think ahead a lot more. They need to be able to plan not just one move (like normal creatures) but several, in order to know that they'll be travelling in a straight line for a while.... read more
I added a routine today which links centipede segments to heads. This happens each time before a board opens. The segments placed on the board using the editor are actually linked into centipedes by zzt++ using this routine. Original zzt does this in a very specific way which I've been able to recreate using a recursive routine. Initial testing appears to indicate that I got it right. Next, I shall be adding the (rather simple) routine of having the centipedes move. I will be going over some of the weirder issues like this: a head surrounded entirely by segments, causes all the segments to be turned into heads.
Also, I'll have to write something to make lost segments (without a head) to be turned into heads.
last night's code contains a bug which messes up memory and causes zzt++ to crash.
the error was in the new unpacking routines used for checking characters in boards not currently displayed on screen. i reserved a bit of dynamic memory which was too small. i've now introduced a static piece of memory large enough to hold the contents of the entire screen.
the new sources are on cvs...
please note that the binary releases of zzt++ are (for now) demonstrations of how to use the code. the code being the more important part of this project right now.
as zzt++ gains functionality, the binaries will start to become more meaningful.
i programmed the routines necessary to properly move between boards. it requires the ability for BM to do GetChar_Coded() for boards that are not being shown at this moment. therefore i wrote a set of "unpack" routines for BM in order to temporarily unpack a board into memory and getting characters from it.
moving between boards now also saves the state of the board the player leaves.
also updated the moment at which the player is drawn. DrawBoard no longer does this, because the player's position can change according to the way the player enters the board.
i will not be releasing the source code specific to version 0.8.47. the closest match you will find is by going to the cvs source tree and selecting the 0.8.47 branch, although some source files may be different from the ones i used to compile the binary.
The latest binary has been released for download.
Source files to be found on CVS.
the latest changes to the source code of zzt++ 0.8.46 have been added to the CVS source tree.
in the source code release of zzt++ 0.8.46 the file zconst.hpp is missing and zzt++ will not compile.
earlier versions of zconst.hpp are not compatible with 0.8.46. since i hadn't gotten around to putting the new sources in the cvs tree, the correct version cannot be found there either.
a new release will be prepared tonight.
wep
zzt++ 0.8.46 has been released. major update is the new Object Program Editor.
it looks and feels exactly like the original zzt editor, but the editor options in the right-side menu haven't been added yet.
get the files off sf.net or from http://www.planetzztpp.com/downloads.html
wep
i have solved a few prolems with the editor. scrolling works now. as well as a couple of other things. the cvs sources aren't up to date yet.
next is positioning the cursor after an UP or DOWN, but i already have an idea of how to solve it.
work on the object program editor is going well. i have merged the bits of code i had into zzt++ and am rewriting some stuff. the editor can benefit from some of zzt++'s base functions.
right now i am working on getting the screen cursor synchronised with the memory cursor which is pretty nasty stuff. after that i'll do some work on memory management as well as the editing functions.
last but not least i will work on displaying borders, scrolling and animation.
i've been out of the air a lot. sorry about that, but it cannot be helped unless i make zzt++ a full time effort.
i've fought my way back to health and changed employers in the last few months, so my life has turned upside down and back again.
i'm now in the 0% activity percentile, which hurts because i was quite high up there before the big lapse. i promise to better myself this year. honest.
wep
hm, i've noticed that the way i name my project files does not comply with the standard. where my project is now called:
zztpp0.8.45.tar.gz
it should have been called:
zztpp-0.8.45.tar.gz
seems like a minor thing, i know, but i don't want to piss anyone off. i'll be working on some of the text files that come with the distrbution as well.
i've been working on a design for zzt++'s program editor. you know, the thing you use to program your zzt objects. it doesn't look like much, but since i've never written an editor it seems like quite a job.
i've installed a new 30Gb harddisk and a cd burner yesterday. yay! not that is has much to do with zzt++, but i thought i'd mention it.
haven't updated for a while basically because there wasn't anything to update with. i'm still trucking, don't worry.
i've estimated that in order to finish zzt++ a total of 6 months development time is needed. of course that doesn't mean i expect to be finished by the end of this year, because i can't work for 6 months straight.
anyway, i'm still in the race here.
i have been diagnosed with a serious illness for which i shall be treated for at least 6 months. i am doing well and i expect to do so for as long as the treatment lasts. there may be periods, though, where will be unable to work, or spend time developing zzt++. however, since i expect to spend more time at home progress may even benefit from my illness.
wish me luck. i will need it.
wep
the most recent code of zztpp0-8-45pre is available on the CVS repository.