flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Game::BlobDrop (WIP)

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 06 May 2008, 03:52
It's a common game I have seen in many forms:
Color Junction
PopIt!

Started programming this a couple days ago and will post my progress here as it develops. Currently, all I have to show is the game board - next I will add some basic game logic so it will be playable. Then some additional UI features will be added to provide feedback to the user (before, during, after) action has been taken: sound, animation, etc.

The display is generated algorithmically and will make adding other visual effects easier for me (and make the file small) - I'm not much of a bitmap artist. Thinking about generating the sound, too.

I'll post the source code eventually.

History:

2008.05.05 - pre-alpha playfield display (push a key for new game display)
2008.05.06 - first game logic (almost playable)
2008.05.07 - playable game (source included)


Description: playable game (source included)
Download
Filename: 2008.05.07.BlobDrop.rar
Filesize: 5.63 KB
Downloaded: 1047 Time(s)


_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup


Last edited by bitRAKE on 07 May 2008, 14:46; edited 4 times in total
Post 06 May 2008, 03:52
View user's profile Send private message Visit poster's website Reply with quote
penang



Joined: 01 Oct 2004
Posts: 59
penang 06 May 2008, 03:59
Great !
Post 06 May 2008, 03:59
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 07 May 2008, 14:48
About another hour of coding and it works. Very Happy Source code is a mess, but included to change the game parameters (add/remove colors, change board/tile size, etc). Small tweaking of the draw algorithm can produce many different effects. Also, the H_S_V_2_xRGB routine might be useful to others - unsigned fixed point fractions (Hue, Saturation, Value) are converted to packed DWORD xRGB.


Press a key to start a new game.

Object is to clear the board - this is not always possible.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 07 May 2008, 14:48
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 07 May 2008, 15:29
Good. Smile

I have a question: if board is generated randomly there could exist some games when player isn't able to win, doesn't matter what he do. Am I right?

If I guess properly, you have made structure '_PUSHAD' to save values of general purpose registers. Was it really necessary? Or you are preparing to build VM? Wink
Post 07 May 2008, 15:29
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 07 May 2008, 15:41
MHajduk wrote:
I have a question: if board is generated randomly there could exist some games when player isn't able to win, doesn't matter what he do. Am I right?
This is true - not all games are winnable. Reduce the colors for an easier game. Most all the constants can be easily changed without modification to the code. At this time there is no need for runtime options to the game.
MHajduk wrote:
If I guess properly, you have made structure '_PUSHAD' to save values of general purpose registers. Was it really necessary? Or you are preparing to build VM? Wink
The PUSHAD instruction saves the registers, but I can never remember where they are exactly (I used to guess and debug stupid one off errors, but that got old quick). The structure is to make access of the register positions easier when using PUSHAD.
Code:
pushad
...
; store return value
mov [esp+_PUSHAD.EAX],eax
popad
retn    
...etc. Do you think I should Virtual at ESP? Might save a little typing. Maybe it should be called _POPAD? No matter as AMD removed the instructions in 64-bit. Crying or Very sad

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 07 May 2008, 15:41
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 07 May 2008, 16:11
I tested different equations in Mathematica prior to coding, and have experimented with animating them:


Description: study of tile modes illumination
Filesize: 54.77 KB
Viewed: 20121 Time(s)

options_3D.png


Description: illumination contour with single neighbor
Filesize: 26.82 KB
Viewed: 20123 Time(s)

contour.PNG



_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup


Last edited by bitRAKE on 08 May 2008, 01:51; edited 1 time in total
Post 07 May 2008, 16:11
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 07 May 2008, 16:15
Idea with '_PUSHAD' structure is interesting because... looks slightly exotic for me (I never used such trick). Smile But in this particular code you use it practically only with value of ESP register:
Code:
(...)

GAME.Move:
      pushad
      mov [esp+_PUSHAD.ESP],TILE.WIDTH.PIXELS
     xor edx,edx
 div [esp+_PUSHAD.ESP]
       mov [esp+_PUSHAD.ESP],TILE.HEIGHT.PIXELS
    xor edx,edx
 xchg eax,ecx
        div [esp+_PUSHAD.ESP]

(...)
    
We could write it also this way (without declaring virtual structures):
Code:
(...)

GAME.Move:
 pushad
      mov dword [esp+12],TILE.WIDTH.PIXELS
        xor edx,edx
 div dword [esp+12]
  mov dword [esp+12],TILE.HEIGHT.PIXELS
       xor edx,edx
 xchg eax,ecx
        div dword [esp+12]

(...)
    
Post 07 May 2008, 16:15
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 07 May 2008, 16:18
bitRAKE wrote:
I tested different equations in Mathematica prior to coding, and have experimented with animating them:
Nice charts, but what common they have with 'BlobDrop' game?
Post 07 May 2008, 16:18
View user's profile Send private message Visit poster's website Reply with quote
penang



Joined: 01 Oct 2004
Posts: 59
penang 07 May 2008, 16:30
Quote:

Nice charts, but what common they have with 'BlobDrop' game?



I was scratching my head wondering the same thing.
Post 07 May 2008, 16:30
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 08 May 2008, 01:41
MHajduk wrote:
bitRAKE wrote:
I tested different equations in Mathematica prior to coding, and have experimented with animating them:
Nice charts, but what common they have with 'BlobDrop' game?
The display is generated from the same equation - which will be animated in time. Very Happy I don't like the transition to be so sudden. Change the tiles to 128x128 or larger and the same contour will appear. Algorithm is completely parallel in nature, too - so, SSE2 version possible as well. Sound generation algorithm following similar development.

Buttons can be created with the same (below), lol.

(added description to images)


Description: creating button shapes with MAP.Draw routine
Filesize: 5.17 KB
Viewed: 20085 Time(s)

buttons.png



_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup


Last edited by bitRAKE on 08 May 2008, 02:46; edited 2 times in total
Post 08 May 2008, 01:41
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 08 May 2008, 01:44
MHajduk wrote:
Idea with '_PUSHAD' structure is interesting because... looks slightly exotic for me (I never used such trick). Smile But in this particular code you use it practically only with value of ESP register: (...)
This is just me being lazy - I needed a memory spot and there it was, lol. If the tile size is run-time variable then it will be in a memory location already. CPU throws away ESP value on POPAD. Wish AMD thought to make a PUSHAQ - so very useful!

* three colors is a good beginner level

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 08 May 2008, 01:44
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 08 May 2008, 10:30
bitRAKE wrote:
The display is generated from the same equation - which will be animated in time.
OK, I understand it now. Smile I think that idea of run-time generation of images is good (no resources) in this case and it shows connections between (higher) mathematics and assembly programming. Very good.
Post 08 May 2008, 10:30
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1398
Location: Piraeus, Greece
Picnic 11 May 2008, 09:47
Very nice bitRAKE, i'll look inside your 'messy' code, see what i can get/learn/use. Much useful Smile
Post 11 May 2008, 09:47
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 11 May 2008, 11:41
I like it! but have question: why DLLs are imporded without extensions? e.g. "kernel32" "gdi" "user32" in import without extensions? and it works however! Smile Isn't extension a part of name?
Post 11 May 2008, 11:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20425
Location: In your JS exploiting you and your system
revolution 11 May 2008, 12:10
It is a feature of Windows, it will automatically assume you want and extension of .dll
Post 11 May 2008, 12:10
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.