Inferno #08
30 ноября 2005
  Игры  

Gamedev - Tips for writing an arcade game.

<b>Gamedev</b> - Tips for writing an arcade game.
   Writing arcade game

   After assembling the 16-color devaysa on ne
ntagone (sm.statyu) I decided to fix this
success writing toys under 16 tsvetov.By
we chose the idea of ​​the game Pang. At first I Scone
struiroval balls (in Photoshop with the use of
vaniem transformation of Cartesian coordinates
to polar) and wrote vyvodilku sprites
(To see how these balls jump
against the background of the picture). Vyvodilka sprites and
stiralka sprites alternately called in
cycle LOO (as in the program and now). Until
updated 2-d screen shows a second, and vice versa
(And now).

   Sprites are converted from a 16-color
. Bmp (palette for conversion can draw
vat themselves, it is very simple: first neyar
Kie, then bright, in a standard manner ,0-th
color will be transparent) annexed the outcome
nick bmpTOspr.H. Source bmpBKspr.H de
barks the same thing, but turns the sprite
face to the left if it was the right person (and
vice versa).

   Then I asked Shiru Otaku pull
colorful character sprites and other objects
Comrade of the game with first got Bailiff
ki. Shiru Otaku works very quickly,
Besides the necessary sprites were extracted for 3 days.
They are (in the SNES version) drawn under 32,768
colors (16 colors on the sprite, 256 colors on
screen). To translate all those colors in the 15 mill
dard was very easy - just be
Lo put all the sprites in one image
(Got about 60 different colors) and from
edit the colors in this palitre.Pri yes
have survived virtually all tsvetopere
hody.Blagodarya fact that in the SNES-version again
decision to 256x224, it was not necessary scaling
vat sprites.


   In parallel, I have added to the program (to
Thoraya as you remember, she could only show
sprites), the following things:



  1. Intelligence, which works on the Prairie
Vania (sm.statyu pro gaming cycle in IG # 6).
This intelligence operates with 11-byte description
satellite units (type of character, its phase,
coordinates, speed, time and energy). Ene
rgiya in Pang is not needed, this field book it
Vano for Games "shooter". It is double-byte,
because Wolf2004 barely missed one
bytes, although Wolf2004 no bosses with a lot of
energy (the way Hitler's killing based
not on energy, and the trick). By the way,
Wolf2004 not yet been velocities
sprites. Instead of organizing a temporary
(!) Buffer directions of movement for personnel
nazhey close to the player. Since the village had
rebate due to the fact that the monster / object
Wolf2004 since ancient times, described by 8 basis
ytami and razbaytovka these bytes protruded If
SHKOM in many areas of the program (not through
index registers) - remake would be
very difficult. In Wolf2004 had to be separated
pour animate and inanimate characters in different
lists in various formats (live longer
bytes, lifeless less). But it was not ETS
lano.Uvelichit generic descriptor of 8
bytes to 9 and above was impossible - not enough
memory, for example, at the level of L. However, in
Wolf2004 there are several free KBytes
at the top of memory, there supposed size
Stith work with the network (LAN).



  2. Pereschityvalka coordinates of the characters in the
coordinates on the screen, sent to the list
SPRS (which uses the procedure for deriving
sprites). At the same time type of character and the phase 
transition reschityvayutsya to the sprite. And in general,

transfer to the terminal is required for at
reliability - because if the chain was removed
one character (and removed it to interrupt
Niya, t.k.intellekt hangs on the interruption!), then
vyvodilka may accidentally skip over
end of the list, or may take half of data
GOVERNMENTAL from one character (and here by chance -
Butz - interrupt!) And the second half - from
drugogo.Tak if perekidyvalka learns
that during its execution occurred pre
on closing, she starts throwing, we first
la. In Wolf2004 characters were not removed (ka
zhuscheesya "disposal" - is just entering
in the Y-coordinate of special numbers) and not
added, so do not require copying
existence of a list of characters before the cycle conclusions
 Yes.

   To completely get rid of glitches, and later
I organized: 2.I. Check the case ne
repolneniya buffer for sprites. 2.II. You
the course of the cycle of artificial intelligence to
following removal operations, whether any
more characters (it was possible to do otherwise:
shift the current pointer unit, if it was
removed a piece of the list, which lay in the memory below
this unit).



  3. Lists of the phase for conversion phases person
zhey to address sprites.



  4. For each character address list
phases (Section 3) and the address of a procedure of processing 
the first  sonazha (for the cycle of intelligence).


   First, the sprites do not have the title, and their
sizes were otdelno.Zagolovok I did
later. Length in bytes of sprite I made in a
heads at the last moment, before
this length was calculated. Therefore, in the source
a genuine download sprites - Th
sharp macro iNCBIN. This macro substitutes
in the title of the sprite that same field length.
The macro looks confusing because
for he must know the current bias
of the compilation (because sprites are loaded inside
three flare DISP .. ENT!).


   Background screens, I initially
Georgia simply from bmp, lying on the disk
ones. But it's uncomfortable and ugly. Therefore, I
organized packing. If, for example, the stagnation
WKU to Pang packing in the form of 4bit bmp, then
rar size obtained in 2790. And if Paco
vat decomposed by columns, we obtain
rar size of 2254. XOR between the lines, and XOR
between the columns is not helping.

   Unpacking savers (DEPKS16) occurs
 leads as follows:

  1. includes 1 st screen (could be included
 2-nd).

  2. clear the 2 nd screen, includes the 2 nd screen.
(Option: 2.ochischaem # 5800 .. # 5aff; include
 6912 mode.)

  3. bmp, packed rar'om (without Headers
ka), is placed in the tail page # 14. (It is convenient
jibe from a different page after 2
 LDIR'a using the domain # a000 ... # bfff.)

  4. called smallunr.H (with parameter
RARS = # 6000) - unpacking rar address bit
below # a000 (eg, # 9f00). We call this
 address "addr".

   Now the data in addr .. addr + # 5fff (almost
 before the end of memory) is included # 14 page.

  5. Expand screen # 4000 (from
 addr +192, after skipping the column 3 * 192).

  6. Expand screen # 6000 (from
 addr + (3 * 192)).

  7. kill each 2-th column in the block
Data (192 bytes copied, 192 skipping
 etc.).

   Now the data in addr .. addr + # 2fff (almost
 to # d000).

  8. Expand screen # e000 (from
 addr +192, after skipping a column 192).

  9. kill each 2-th column in the block
 data.

   Now the data in addr .. addr + # 17ff (almost
 to # b800).

  10. Expand screen # c000 (take ba
 yty with addr, row).

  11. includes 1 st screen (or includes 16tsvetny mode when 
turned off). 

   As you can see, using only 2 action
interaction treatments ("maximize" and "ubi
vat) and does not use the extra area
memory (except for the balance of one of the screen
pages - page # 14)! (The ATM Page
others.) Memory # a000 .. # bfff - buffer IMAGE
expression under the sprites, and it is quite possible
spoil, while sprite engine did not cause
is. And he invoked only inside the loop
LOO.

   Then there was just adding programs
IOC podprogrammok artificial intel
Lecta. These applets rather drab
Ny. All used the same solution
Giustra: IX (the address of the descriptor of the character), BC
(Y), DE (X). Made a first procedure
RSA check collisions, and then another dve.Odna
checks the collision of the hero with enemies (vyzy
is called the hero of the handlers and fingers
enemies, although there could be cause of about
rabotchikov enemies and nothing to touch -
hero is one). Another collision checks
harpoon enemies (similar observation).
The third - a conflict with the hero's prize.

   There were odd moments slap protsedurki
output accounts, and time, signs of levels and
Other stuff.

   In the end, pull out of storage were
scheny small muzonchiki (which I wrote
in 2002-2004.) and inserted into the game. Was
the modulus of sound effects from the old
good Wolf2004, the sounds of little change
Ny parametry.Etot module is not universal,
He can play only a small class
sounds (for example, during playback
effect can not be varied periods of tonal
source and noise).

   Assembling the game during its writing Loss
zvodilas many times (at least before the spacecraft
zhdym testing for real-Pentagon)
and did not cause any problems, t.k.eto automobile assembly.
The main unit plus sprites are packed in Bay
Sik-file. Music files and pictures le
lie separately and loaded (in pages)
through # 3d13 after the start of the game. Program
executed so that you can peresobi
host at least 100 times a day. I am surprised
Some programmers, who at every
build their programs to manually start the
packer and just manually paste App
Chick (manually typing the file sizes, etc.).

   The program was written by Unreal Speccy
v0.32b8 and between times tested for Rhea
flax Pentagon. SMT promptly organized
shaft support 16-color device
emulator, allowing drag and drop u
py on the Pentagon to test had not
too often. From the moment of request sprites
prior to release of the game, ie, showing its stakeholders
vannym persons (two assemblies: the Pentagon
and the ATM!) was 17 days. For me, this solution
cord. Stairs and blocks I do not become -
game and now has a good playability, yes
and the project was originally conceived as Nedolya
nologies.


        On the acceleration of this engine.


   The program was created as krossplatfor
mennaya - easily altered, in addition,
training - easily understood (note
attention to the number of comments in the initial
hodnikah). Therefore, the trick was not applied
are satisfied.



  1. ATM can be placed on the page boundary
graphs in the ROM area and LDIR'it sprites
before output. The same can be achieved by
Pentagon, if we put the most popular
sprites (ie, balls and rope - Total 4
sprite) into the lower memory and insert the sky
greater inspection before LDIR'om. Try
source code. Gain should be small
- 21 t / B (now ў130 t / B, including
RESPR). Moreover, this gain is from
processor time remaining after
subtracting time for music (5% to 70,000
t), intellect (10% estimated to 70,000 t) and
output figures (5%?). Ie Win-win is possible
estimate in (21 t/130 t) * (100% -10% -5% -5%) <
<13% of the time. The Pentagon in the neck of the non-turbo
grysh less - somewhere in 11% (45,000 t since
instead of 70,000 t, which is why music and intellectual
Lecta take about 30%).



  2. If you use a large amount of parameters
myati can store images raspakovanny
mi, and a font - in the form of letters at once sprites
nye coloring. But now we can not decompose
kovyvat the same picture in front of each
smoke entering the same level, but about
one hundred to wipe off her sprites (with both screening
electrons). Try to source code.



  3. If there is a copy of the background can be
not to keep the background under the sprites, and rebelled
pour it directly from a copy of the background.
The Pentagon irrelevant (working screen and
copy of the background do not fit into one
address space), will only work on
ATM. Winning is not more than 16 t / B (as
exactly - it is not clear t.k.dolzhen be fully
rewritten RESPR). And two problems: 3.I.
output figures slows and a half times (ec
I take it that they are already deployed on recommendations
recommendations 2); 3.II. when writing games with
scrolling scrolling slows Polt
pa-fold, and he should be so terribly slow
lenny (withdrawal of two screens, that is 48k!). To
Of course, some games do not need
remember the background and restore
it under the sprite - you can simply tunable
ivat entire background (on a single screen,
ie 24k) at the beginning of each cycle, the output
sprites.

Alone Coder




Other articles:

Inferno - The authors of the magazine.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

Inferno - On the shell.

Iron - CD-ROM - a device and Tricks connection.

For Coderz - CD video on the ZX. How to write a video player with CD-ROM.

Softinka - Technical Reference disk system DISCiPLE / + D.

For Coderz - Small programmers' tricks.

Mathematics - The history of the solution of Fermat's theorem.

Gameland - Game Shestnashki.

Softinka - a description and history of the program to work with hard disk HDDoctor v0.9.

Secrets - The X button in different applications: Wolfenstein'2004, IG # 5, ACEdit, DNA OS, Wild Disk Copier.

Softinka - Improved graphics converter Gigascreen.

Sound - tube amplifier. Stereo lampochnik 2x5 Tues of old TVs.

Iron - Overview of cassette players.

Inferno - Letters to the Editor.

Gamedev - The history of the game Pang.

Gamedev - Tips for writing an arcade game.

Advertising - Ads by Roman Chuunin.

Advertising - Ads by Alexei Zhabina.

Advertising - Ads by V. Bogdanovich.

Interview - Interview with Nikolay Rodionov, author of popular books for the ZX Spectrum

For Coderz - The calculation of trigonometric and algebraic functions in a high-level languages.

DIY - scheme of 16-color video mode v1.1 for the Pentagon.

Iron - Description of Products K555TL2.

For Coderz - Programming device sound generation Turbo Sound.

Softinka - 384x304 viewer. program allows you to view color pictures, is larger than the screen.

Softinka - ZX Spectrum emulator for ZX Spectrum.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Interview - intimate conversation with the author of one of the most popular games: the quest "Homer Simpson in Russia."
News - an overview of new products: Deja Vu 7, ZX Format 8, Black Raven, The Mirror, Monster Land, Stalker.
Presentation - Shadow Debugger "Alasm 128/512 v2.8" & "STS v4.2".
News - On the latest news from Gomel.

В этот день...   21 November