Friday, 28 September 2012

Semplicity and rewrite


New ideas for reduce the complexity and speed up the development of reengineering the original POP.

Below are some notes about rewriting some classes and use a xml file for animation sequence configuration



int currentFrameIndex
bool stoppable


Play(Animation animation)



List<Frame> frames


GetFrameIndex(string framename)



string name
string sound
string value
TypeFrame type
string parameter
Texture2d texture
Sound sound
bool stoppable
int xOffSet
int yOffSet

Enum TypeFrame {Sprite, Command}
Enum TypeCommand {Goto, Flip, ...}


For fill the List<Frame> in Animation class i will use an XML file like this :

<animation name=TURN>
<frame name = startturn value=10 type=Sprite stoppable=false/>
<frame value=11 type=Sprite stoppable=false/>
<frame value=12 type=Sprite stoppable=false/>
<frame value=13 type=Sprite stoppable=false/>
<frame value=Flip type=Command parameter=-1 stoppable=false/>
<frame value=Goto type=Command parameter=STAND stoppable=false/>
<animation name=RUNNING>
<frame name = running value=20 type=Sprite stoppable=true/>
<frame value=21 type=Sprite stoppable=true/>
<frame value=22 type=Sprite stoppable=true />
<frame value=23 type=Sprite stoppable=true />
<frame value=Goto type=Command parameter=running stoppable=true/>
<animation name=STAND>
<frame value=1 type=Sprite stoppable=true/>
<frame value=Goto type=Command parameter=STAND stoppable=true/>

Source repository and preview

Source repository and Preview

Now, i have a repository for the source code of and in the next post i will release a little beta preview....the Kid can run and stand in the first level room without some action like jump and climb, it's only a little beta with some collision detection like fall ecc

like this .....

Wednesday, 26 September 2012

Player Grid

Player Grid

The player grid is 16px for the x, i have two type of player proprieties :



ACTION = action wich can be changed. For example STAND, RUN
TRANSITION = action wich can be done/complete for change. For example STARRUN, ENDRUN

This past days i will spend to study and test some player movement routine for copy the original Kid movement.

The Goal is near, but for complete the "base" movement routine i'm search the correct implementation... this can be end about 1 day or 1 week or 1 month ?


Wednesday, 19 September 2012

MAC II source code

MAC II source code

I'm study the sequence from original MAC II source code, (i dont know assembler..) i have notice for example the "STARTRUN animation": 

* s t a r t r u n
 db act,1
runstt1 db 1
runstt2 db 2
runstt3 db 3
runstt4 db 4,chx,8
runstt5 db 5,chx,3
runstt6 db 6,chx,3

runcyc1 db 7,chx,5
runcyc2 db 8,chx,1
runcyc3 db tap,1,9,chx,2    *tap is play the tap sound while running??
runcyc4 db 10,chx,4
runcyc5 db 11,chx,5
runcyc6 db 12,chx,2
runcyc7 db tap,1,13,chx,3
runcyc8 db 14,chx,4
 db goto
 dw runcyc1

Total animation = 6 + 8 (startrun and rucyc1)

db act,1 -> load the image table number 1 ? act = -7

db 1  -> frame number 1
db 4,chx,8 -> frame number 4 and "chx,8" is a draw frame position x + 8
In pc version this chx is different for screen resolution but i don't found the x relation why?!!

My animation consist in two image : startrun and next run in infinite loop, total frame 6+8

Tuesday, 18 September 2012

Kid's Animation


The collision algorythm is not complete but now i can write the kid's animation routine (walk, run, turn etc.)

It's very hard i will study the original Mac II source code and the original compiled PC version

Good Luck

Friday, 14 September 2012

Handle Collision

Handle Collision

Study and study how to handle collision detection, now finally i have took the right path!

This is a preliminary code for detect the collision between Kid  and  tiles ("floor" ,"wall") :

  // Reset flag to search for ground collision.
            isOnGround = false;

            // Get the player's bounding rectangle and find neighboring tiles.
            Rectangle bounds = BoundingRectangle;
            //Find how many tiles are near on the left
            int leftTile = (int)Math.Floor((float)bounds.Left / Tile.Width);
            int rightTile = (int)Math.Ceiling(((float)bounds.Right / Tile.Width)) - 1; //tile dal bordo sx dello schermo al bordo dx del rettangolo sprite
            int topTile = (int)Math.Floor((float)bounds.Top / Tile.Height);
            int bottomTile = (int)Math.Ceiling(((float)bounds.Bottom / Tile.Height)) - 1;

            // For each potentially colliding Tile,
            for (int y = topTile; y <= bottomTile; ++y)
                for (int x = leftTile; x <= rightTile; ++x)
                    TileCollision tileCollision = room.GetCollision(x, y);
                    TileType tileType = room.GetType(x, y);

                    //interseco ?
                    Rectangle tileBounds = room.GetBounds(x, y);
                    Vector2 depth = RectangleExtensions.GetIntersectionDepth(bounds, tileBounds);

                    if (depth == Vector2.Zero)
                    if (tileCollision == TileCollision.Passable)

                    //Verifico se mi trovo sul terreno
                    if (IsGround(bounds.Bottom, tileBounds.Bottom, Tile.Ground) == false)
                    isOnGround = true;

                    switch (tileType)
                        case TileType.Wall:
                            Position = new Vector2(Position.X + depth.X, Position.Y);
                            bounds = BoundingRectangle;

                            Position = new Vector2(Position.X, tileBounds.Bottom + Tile.Ground);
                            bounds = BoundingRectangle;
            previousBottom = bounds.Bottom;

Wednesday, 12 September 2012

The Beginning

Two weeks ago

The idea was in my brain, now i found an example of paltform game in C#, i will start to modify...and search some information about the original game of Prince Of Persia..


Finally i have finish to create the algorithm for draw the correct tiles in a room, this algorith calculate the room  
on the left and on the up for draw the correct left border and upper border.
The kid can move (in differnt ways respect the original POP...) on the room in left.right direction and jump but don't climb..