Fresh beer! or QUESTION!!!
ZXNet echo conference «real.speccy»
From Nikolay Maslennikov → To All 26 August 2002
Who can explain how to calculate the shortest path in a 2D array?
Who has a description of kempston-mouse ports...?
How to make an RND generator?
Who tried to write AI?
Who writes plots?
From the bottom of my heart Ciao, All. [I ZX] [SHADOW MAD]
From Kirill Frolov → To All 26 August 2002
26 Aug 02 11:46, Nikolay Maslennikov wrote to All:
NM> Who can explain how to calculate the shortest path along a 2D
NM> array?
Wave algorithm... the principle is like this (wave), maybe confused with the name.
See ZX-FORMAT #6 - there is an article Mednonogova with an example. But this is not the fastest option. Mednonogov wrote that in CV, for the sake of speed, it was necessary to
sacrifice the actual calculation of the path; instead, the direction of going around the obstacle was simply chosen randomly. Look at the ZX.SPECTRUM
archives on Google - maybe you'll find...
NM> Who has a description of the Kempston-mouse ports...?
by the author of the diagram, Michael Kondratyev: 2:5030/362.1@FidoNet So, now
let's explain how to work with the Kempston Mouse Interface
to the programmer. There is nothing difficult to understand, since
the interface is quite simple and understandable. There are three ports, here are their addresses:
#FADF, #FBDF, #FFDF; The width of each is 8 bits, i.e. byte. #FADF -
button port, the significant three bits in it are: 0 bit -
state of the right button; 1 bit - left button state; 2 bit -
state of the middle button. When the buttons are not pressed, all bits are `1'. When
the button is pressed, the corresponding bit is set to `0'. According to
an ancient tradition, the left button is used as a choice(Fire), right
- as cancellation (Cancel). The middle button is usually used for
additional functions. #FBDF - X-coordinate port; #FFDF - port
Y-coordinates. As the mouse moves, the values in the ports
change, and also cyclically, i.e. upon reaching #FF and
further increase, they become zero again and grow further, again up to
#FF. When moving in the other direction, the picture is similar, only
changes occur in the opposite direction. The following picture will help to visualize this matter
: [kempston-coord.jpg] Thus,
it is necessary to read the values of the ports, and the direction of moving the mouse is determined by the difference between the current and
previous value. If very precise manipulations are required, the driver is written taking this into account
and the arrow is moved by one point when the value read from the port changes
by 2, 3, 5, or more units. Recently
Recently, a smarter driver has become fashionable, which at the beginning waits for a button
to be pressed, and the first pressed button on the mouse becomes (for the driver)
the left one. This applies only to the two outer buttons, the middle button is the middle button in Africa too. This is useful for people who are used to holding the mouse
in their left hand...
NM> How to make an RND generator?
piece from the library:
(((randx = randx*1103515245 +12345)>>16) & 077777);
NM> Who tried to write AI?
(c) Copper Feet '99 (for ZX-Format#9)
Computer intelligence in real-time strategies.
----------------------------------------------------
Although I love long and moralizing introductions, this time
let's get straight to the point :).
In my opinion, the intelligence of a computer in real-time strategy games should consist of four levels, described below:
Level 1. Instinct of self-preservation.
-----------------------------------
The name of this lowest level is arbitrary, but quite accurately reflects its purpose. It defines how a unit should
behave if it is attacked. Usually, two
lines of behavior are possible - respond to the attack or, if this is not possible, try to avoid the attack. In both cases, a large number of nuances are possible.
For example, when responding to an attack, it is checked whether the warrior is already attacking another target and whether there is a need to switch to a new target. Units that do not know how to conduct close combat (tanks, catapults, ...) must first try to retreat to the required distance for shooting. In most games, a warrior can try to call his closest neighbors for help if they haven't yet thought to do so.
Retreat is usuallynecessary for units not adapted to waging war (peasants, builders, workers). Here
you need to decide whether you need to simply run away from the enemy to a safe
distance, or seek salvation in the nearest settlement or detachment. Sometimes in games where there are different types of troops (infantry, aviation, navy), even a combat unit has to retreat if, due to its design features, it is not designed for all types of possible combat (for example, a tank must avoid fighters, etc.).
Level 2. Scanning the area.
----------------------------------
In essence, this level simply expands the instinct of self-preservation - the unit not only responds to the one who attacked it, but also
tries to predict a possible attack by examining the area
around itself in search of enemy warriors.
The depth of inspection usually depends on the units' firing range, although for computer-controlled warriors it is recommended to make it equal to the maximum firing range. In this case,
a far-firing catapult or helicopter will not be able to get close
unnoticed to a close-attacking swordsman or infantryman. However, this point is implemented differently in different games.
There are quite a lot of scanning algorithms - pairwise comparison of unit coordinates, spiral inspection of the area,sector-by-sector
inspection, preliminary division of the area into squares
(hashing). A detailed overview of them was presented in ZX Format#8
in the article "Epic".
The basic levels of intelligence described above are usually implemented for both computer-controlled warriors and
human-controlled warriors. Although the option for computer warriors should
be made more flexible and provide as many different
options as possible.
Level 3. Tactical.
-----------------------
Here the basic actions of the unit are determined, depending entirely on its skills and properties. Therefore, this level can rightfully be given another name - professional.
For each type of computer heroes, their own tactical (professional) unit is usually developed. The most
often used are three types of such blocks:
- for units engaged in the development and extraction of resources;
- for units standing guard;
- for units going on the attack.
In the first case, the block of rules describes where to deliver
the extracted resources, what to do if the extraction of resources in a given place
has been exhausted or was previously interrupted (for example, by a sudden attack by human troops). Special rules regarding the repair of damaged buildings and the construction of new buildings may also be described here (although oftenThese tasks are dealt with at the strategic level, which will be discussed further).
The block of rules for security prescribes actions to protect
the entrusted territory. Usually it boils down to the following: “stand still and do nothing.” Indeed, almost all security tasks are solved by the two lower levels of intelligence. The only
additional rule determines the method of returning to the place
after repelling an attack.
The actions of attacking units are usually divided into two
phases. The first is “go to the collection point.” The second is “go on the attack.” Conditions for retreat can be added to this block (for example, from cowardice, from wounds, or if there are no people nearby), if, again, the strategic block does not deal with this.
In addition to the most common sets of rules described above, in any game there are usually a number of special tactical rules for less common types of units:
- for wizards and magicians (priorities are usually determined here when choosing one spell from many and when choosing the object of application of the spell);
- for patrolling units (generally similar to guards);
- for transport ships (who and how to pick up on board, and who and how to land. Naturally, only attacking units are taken on board, not guardsor employees. The place of landing is determined by the next level of computer intelligence - strategic);
- for repairmen (although in most games the rules of such
units are a subset of the rules of resource miners);
- for the main characters or bad guys, if there are any
at the level (what your imagination will tell you here);
- and so on...
Level 4. Strategic.
--------------------------
This level actually controls all units of the computer. Ideally, a computer should do this no worse than a human player. The implementation of the rules of this level determines how smart and interesting your game will be. Unfortunately, there are no ready-made recipes here (otherwise all games would be smart and interesting :).
Let's at least consider what needs to be implemented here.
First, the computer must manage the production of warriors for future attacks. In addition, if the game allows it,
it must produce new units that will replace dead guards or dead workers.
Secondly, the computer must deal with upgrades and research.
Third, it must organize attacks. To
this, he must first choose a place for preliminary gathering
(unless, of course, his warriors go into battle immediately after they
are produced). Then, byafter a certain time or when the required number (strength) of the detachment is accumulated, the computer must send it into battle. You must first select an object or target location. Here it is also necessary to manage transport
(if any).
Fourthly, the computer must monitor the condition of its
buildings and the health of its units in order to carry out repairs and
treatment in a timely manner. However, these functions can be independently performed at the third level by the appropriate types of units (healers, repairmen). If necessary, the computer can be able to build
new buildings - to replace destroyed ones or to increase its
power.
Needless to say, all of the listed actions
(especially organizing attacks) should be performed as varied and non-trivial as possible in order for the game to be truly exciting.
It is convenient that the computer at this level should only make
general, strategic decisions. The computer units choose specific
options for implementing such decisions independently, guided by the three lower levels of intelligence.
In fact, the computer here simply indicates the task number for
each unit (plus related parameters, for example, the coordinates of the scene of action or the target of the attack) and does not care about its
further execution.
Third andThe fourth level of intelligence is usually programmed
only for a computer. However, in our world of lazy people and mental
degenerates, apparently, it won't be long to wait until game authors begin to implement these levels for human units (to one degree or another). So that the player does not strain his only gray brain too much :).
Why did I accept exactly this division into levels for the AI
computer? It’s very simple - the practice of creating the games “Black Raven I
and II” shows that it is in this order that it is easiest to develop and debug intelligence programs. Consistently implementing the listed levels, you get approximately the following:
Level 0 (without intelligence). Computer units stand still and do not move.
Level 1. Same as level 0. Computer units do not
react to your combat units until they strike first.
Level 2. Same as level 1. In addition, computer units react to the approach of your soldiers and try to attack them.
Level 3. The same as level 2. However, there is active
extraction of resources, wizards are trying to cast spells and spoil things for you,
the computer guards are returning back after repelling your
attack. But the computer does not take any active actions against you.
Level 4. FULL GAME!
Here,in fact, that’s all I wanted to tell you...
Always yours, Vyacheslav Mednonogov.
(Fido: 2:5030/675.30)
(ZxNet: 500:812/1.30)
07.17.1999.
From Yuri Potapov → To All 27 August 2002
Once Monday August 26, 2002 at 11:46:56, Nikolay and All were arguing about
Fresh beer! or QUESTION!!!
NM> Who can explain how to calculate the shortest
NM> path in a 2D array?
wave algorithm or for RTS obstacle avoidance algorithm
From Nikolay Maslennikov → To All 28 August 2002
YP> wave algorithm or for RTS algorithm for avoiding obstacles
algorithm for turn-based strategy in the style of heroes 3 avoiding obstacles and
finding the shortest path
YP> Mednonogov, Slip
Who is Slip?
NM>> Who writes stories?
YP> so can I :)
Starting info: 5 clans are fighting to conquer the old land empire "Thor"
Elves, Dwarves, Empire, Devil, Necromancer.
Elves - neutral
Dwarves - good
Empire - defenders of the oppressed, that's why they get into all the holes, even when it's
not at all necessary, but in general not bad.
Devil - bad, destroy everyone and everything, complete world peace domination.
The Necromancer is the same as the Devil, but plus personal gain, don’t care about everything, can
enter into alliances with anyone to achieve the goal.
From the bottom of my heart Chao, Yuri. [I ZX] [SHADOW MAD]
From Andrey Lysenko → To All 28 August 2002
NM> Reply-To: nika_...@mail.ru
NM> Hi dear, All!
NM> Who can explain how to calculate the shortest path using a 2D
NM> array?
NM> Who has a description of Kempston-mouse ports...?
From Yuri Potapov → To All 29 August 2002
NM> Starting info: 5 clans are fighting to conquer the land
NM> of the old empire "Thor"
NM> Elves, Dwarves, Empire, Devil, Necromancer.
NM> Elves - neutral
NM> Dwarves - good
NM> Empire - defenders of the oppressed, this is why they interfere all
NM> holes, even when it
NM> is not at all necessary, but in general they are not bad.
like usa? :)
NM> The Devil is bad, destroy everyone and everything, complete world
NM> domination.
NM> The necromancer is the same as the Devil, but plus personal gain, don't care
NM> about everything, maybe
NM> make alliances, be with someone to achieve
NM> the goal.
ooo you don't need a plot... you need a script :-/ that's already more difficult
From Nikolay Maslennikov → To All 29 August 2002
One Thursday, August 29, 2002 at 5:46:23 pm, a conflict occurred
Yuri Potapov and Nikolay Maslennikov were arguing on the topic Script for "Deadly
threat"
I decided to argue too
NM>> Who is Slip?
YP> 8th department and Empire 2000 this is from Slipa it seems :-/
What is this?
YP> ooo you don’t need a plot... you need a script :-/ this is more complicated
Have you read the subject? That’s what I said about the script!
From Denis Ignatov → To All 29 August 2002
and now 26 Aug 02 Nikolay Maslennikov` I am afraid of losing such a rare gift...
as time wrote All:
NM> Reply-To: nika_...@mail.ru
NM> Who can explain how to calculate the shortest path along 2d
NM> massive? Does anyone have a description of Kempston-mouse ports...? How to make RND
You know Mednonogov... he has it, but what kind of game...
if RTS then in my opinion the “law of the right hand” if TBS then “wave”
it is more economical and has fewer moves.
NM> generator?
And what about the chaos generator not working???
From Dima Bystrov → To All 29 August 2002
27 Aug 02 00:55, Kirill Frolov wrote to Nikolay Maslennikov:
KF> #FADF -
KF> button port, the significant three bits in it are: 0 bit -
KF> state of the right button; 1 bit - left button state; 2 bit -
KF> state of the middle button. When the buttons are not pressed, all the bits are in `1'.
let's still have D0 - the left button.
- Alone Coder [ZX-Guide#4.5=100%] [ACE0.63] [PT3.57] [Chip1.3]
From Yuri Potapov → To All 31 August 2002
YP>> more complicated
NM> Have you read the subject? I was talking about the script!
Who reads the subject these days? :)
but of course you can think... although I'm more into coding and graphics
I can write a tracer for the wave method
From Kirill Frolov → To All 31 August 2002
KF>> - state of the right button; 1 bit - left button state; 2
KF>> bit - state of the middle button. When the buttons are not pressed, all
KF>> bits are in `1'.
DB> let's still have D0 - the left button.
My mouse had a right one. There are two "standards". Therefore, auto-detection
on the first click is better than any standard. It would also be nice to emulate
pressing the middle button while simultaneously pressing the left and right - there are
mice with only two buttons.
From Dima Bystrov → To All 2 September 2002
KF> My mouse was right-handed. There are two "standards". Therefore
KF> auto-detection on the first click is better than any standards.
it is, of course, good, but imagine this situation. you launch
a program, for example, a magazine. She gives a window with help. It is known that in the magazine there is an auto-detection of mouse buttons, the left button is fire, the right button is cancel. Which one will you press to close the window?
...for me this is usually a random factor :(
so it’s better to decide on the button.
KF> Also
KF> it would be nice to emulate pressing the middle button while simultaneously
KF> pressing the left and right - there are mice with only two buttons.
yes, yes.
From Yuri Potapov → To All 4 September 2002
One Sunday September 1, 2002 at 01:58:44, Kirill and Dima were arguing about
Fresh beer! or QUESTION!!!
KF> My mouse was right-handed. There are two "standards". Therefore
KF> auto-detection of
KF> on the first click is better than any standards. It would also be nice
KF> to emulate
KF> pressing the middle button while simultaneously pressing the left and
KF> right button - there are
KF> mice with only two buttons.
Double blow to the mouse kidneys?
And in general, some mice have the 1st button, let's use only one ;)
IMHO, two are enough for me :)
From Kirill Frolov → To All 5 September 2002
04 Sep 02 22:46, Yuri Potapov wrote to Kirill Frolov:
YP> And in general, some mice have a 1st button, let's use only
YP> one ;)
I've never seen such live ones, only in pictures in books.
YP> IMHO two are enough for me :)
In the program some function can use the 3rd button.
The question is what to do if this button is not there.
From Yuri Potapov → To All 7 September 2002
Once Thursday September 5, 2002 at 23:59:22, Kirill and Yuri were arguing about Fresh
beer! or QUESTION!!!
YP>> IMHO two are enough for me :)
KF> In a program, any function can use the 3rd
KF> button.
KF> The question is what to do if this button is not there.
Fix a function
The 1st button is Select is the priority function
The 2nd button is usually Reject this is less important, if something happens, you can also press Esc on the
keyboard and Click the 1st button with the mouse
Not everyone has the 3rd button, so it’s hardly worth putting something important on it
There is no need to emulate it either