Friday, 28 December 2012

Climb Down

Climb Down

Dear, 
I finally finished the climbdown sequence, I had to introduce a new command to see if kid has to hang or swing on the way down from the platform.





New command = IFGOTOSEQUENCE
if true parse the first parameter else the second

Example:

<Frame>
<type>COMMAND</type>
<name>IFGOTOSEQUENCE</name>
<parameter>HANGSTRAIGHT|HANG</parameter>
<stoppable>false</stoppable>
</Frame>


Wednesday, 19 December 2012

Next Step

Next Step

The next step is complete all kid movement (not combat) animations, now i'm working on ClimbDown sequence and Jump and hang movement.

I tried to look at the C source code of Apoplex (an PoP level editor), to see if I could implement saving as xml PoP.net, but I found some problems in recompile the source code..

When I am sure that the format of PoP.net I created meets the requirements to implement all the features of saving the original PoP, most likely will contact the author of Apoplex to ask him if he has time to implement my save level format.

Next days i will release a new alpha PoP.net with some new rooms and a complete Kid movement animations.

Thursday, 13 December 2012

Kid exploring

Kid exploring

Finally Kid can explore three rooms..and move all around PoP.net maze!

Try it!



Ps
Only three rooms because i will edit the first dungeon level....



Tuesday, 11 December 2012

Blueprint and Maze file format

Blueprint and Maze file format

The original PoP use a specific file format for save/load the dungeon rooms, it's a format made for the original MAC II version.

Some Pop fans have created some visual editor for modify the orginal PoP levels in their original "blueprint" format. (apoplex and other..)

I wish to ask if any of their authors who want to create the ability to save in PoP.net xml format or ask the original source for make an extra save type.

Yes i will use a simple XML format for build the maze by class reflection, like this.

---


<?xml version="1.0" encoding="utf-8"?>
<Level xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <levelName>dungeon_prison</levelName>
  <rows>
    <RoomRow>
      <columns>
        <RoomColumn>
          <RoomStart>true</RoomStart>
          <RoomIndex>1</RoomIndex>
          <FilePath>MAP_dungeon_prison_1.xml</FilePath>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
      </columns>
    </RoomRow>
    <RoomRow>
      <columns>
        <RoomColumn>
          <RoomIndex>2</RoomIndex>
          <FilePath>MAP_dungeon_prison_2.xml</FilePath>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>3</RoomIndex>
          <FilePath>MAP_dungeon_prison_3.xml</FilePath>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
        <RoomColumn>
          <RoomIndex>0</RoomIndex>
        </RoomColumn>
      </columns>
    </RoomRow>
  </rows>
</Level>


---


This open format can be simple edited by hand for build own dungeon.

Now i'm working on this file format for give to kid ability to move through the rooms...

Thursday, 6 December 2012

Flames!

Flames!

Some animated flames....


I have add some functionality :

-> animated tiles
-> xml file definition for animation sequence like kid sequence

Now it works but i will rewrite some routines for do a clean code...


Example of TORCH_SEQUENCE.XML


<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSequence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <!-- NORMAL TORCH -->
  <Sequence>
    <frames>
      <Frame>
        <type>SPRITE</type>
        <name>LOOP</name>
        <value>Tiles/FloorB_1</value>
        <stoppable>false</stoppable>
        <xOffSet>0</xOffSet>
        <yOffSet>0</yOffSet>
      </Frame>
      <Frame>
        <type>SPRITE</type>
        <name></name>
        <value>Tiles/FloorB_2</value>
        <stoppable>false</stoppable>
        <xOffSet>0</xOffSet>
        <yOffSet>0</yOffSet>
      </Frame>
      <Frame>
        <type>SPRITE</type>
        <name></name>
        <value>Tiles/FloorB_3</value>
        <stoppable>false</stoppable>
        <xOffSet>0</xOffSet>
        <yOffSet>0</yOffSet>
      </Frame>
 ...........
      <Frame>
        <type>COMMAND</type>
        <name>GOTOFRAME</name>
        <parameter>LOOP</parameter>
        <stoppable>false</stoppable>
      </Frame>
    </frames>
    <name>NORMAL</name>
    <raised>false</raised>
  </Sequence>


</ArrayOfSequence>



Tuesday, 4 December 2012

Download

DOWNLOAD

For launch and install Prince Of Persia.net you must install this :


1) Install Microsoft Framework 4.0 or major version from Microsoft site:

Download Microsoft Framework 4.0


2) Donwload and unzip and install the OpenAll for windows at :

Download OpenAll 


3) There are two kind of setup, choose one from above:

 > The first is the simple stand alone classic setup msi, this don't have the update system


> The second is the auto update ClickOnce setup


_________________________________________________________________________________


The new repository for source code is:

https://princeofpersia.codeplex.com/


_________________________________________________________________________________


User manual and instruction how to play at

Wednesday, 28 November 2012

And finally flame...

And finally flame...

There are some Kid animation's to do, for example : climb down, jump and hang ecc
But now I'm a little bored in Kid animation, in this state he can explore the room, tomorrow i will study how to implement the torch and flame animation in the room.
Very thanks to Norbert of Prince Of Persia Comunity (http://www.princed.org/) for give me the entire Pop graphics set.

Stay tuned for the first flame in the room...
PS
the repository source is now updated....

Friday, 23 November 2012

Run Jump and Stand Jump

Run Jump and Stand Jump

Now i'm working on this sequence and for check the correct x and y offset respect the original Pop, i will used the second room for run test like this :


This is only an image for possible fonts for PoP.net, take from
http://www.norbertdejonge.nl/misc/popot/popot_possible_fonts.png


Monday, 19 November 2012

Hang and Jump fixing..

Hang and Jump fixing..

Some fixing to the hang and jump routine and sequence, very hard to grab screen of the original PoP and magnify for search to do the same in PoP.net.
Next step is fix the fall routine and start with jump-forward animation...and climb down...

Now PoP.net can be run on old windows xp with old graphic card.
Setup refresh for "Download" use the link on the right of this blog.

Finally today have fix the CLIMB routine....!! yes

Wednesday, 14 November 2012

Bump and reverse

Bump and reverse

Some days spent to found a solution for implement the BUMP sequence: when kid collide with block (wall) he bump (rewind) of 8 pixel of x axys and when kid is near a block (wall) reverse the BUMP sequence.

Now POP.net have the reverse command, this do a frame paint reverse and frame offset x,y.

For debug purpose now POP.net write on screen some usefull informaion : kid position, state, collision etc.

I have refresh the setup with this new features. (see previus post for setup link)


Tuesday, 6 November 2012

Limits


Limits

Stand 20px width for 82px height


Frame is 114px width but the real sprite is 20px



limit 46px from a plate for hangup


limit from the wall 30px


limit 26px from a plate for fall, nb 26 px is the right shift for the isometric perspective



When BUMP is wall kid decrease of 18px in X


Saturday, 3 November 2012

Jump Around

Jump Around 

Finally i have finish the freefall movement, now i am developing the jump and hang sequence.
Its a little complicated rebuild them from the original POP, kid have two type's of hang, the first is for
plates and the second is for the floor over a wall.
There's a strange climb action:
kid before jump and hang if is far from the floor plate, he teleport it for some x pixel forward for jump....
i don't understood because J.Mechner haven't used the walk forward animation, the original POP have many types of step forward from 2 pixel to x pixel.!?
Strange but true i think to adopt the step forward i don't like Kid disappear for jump and climb if he's far from the plate.
I think Monday to relase the new update for PrinceOfPersia.net... stay tuned on.

Monday, 29 October 2012

Study Free Prince

Study Free Prince

Free Prince was a project for convert Pop in unix/windows it's stop some years ago 2 ?
I'm study this c++ project for found some inspiration how to continue the POP.net developing.

 In Free Prince i found this usefull Kid schema :


Friday, 26 October 2012

Perspective isometric

Perspective isometric

The isometric system of POP is shifted to 26 pixel right on the x and 18 pixel up for the y, for the screen resolution 640x400.

The trick is draw the sprites with this isometric x/y shift but the collision, movement and other routine calculate   all without isometric shift.



Saturday, 20 October 2012

Reload

Reload

Finally i understood how to implement and continue in fast developing POP, but i need to rewrite and rebuild the program structure... (especially for the coordinate and position system..) why ? simple i started from an example of platform game in Microsoft XNA and isnt compatible with POP engine.

KID action/movement are based of an XML file KID_sequence.xml, the structure is

<sequence name><frames><frame></frames></sequence>

There are two types of FRAME : sprite and command

Sprite are definition of single frame : sprite name, texture name, stoppable bool, sound, x pixel movement, y pixel movement
Command there are two types: GOTOFRAME and GOTOSEQUECE are looping command for looping animation (run etcc)


POP structure

class PRINCEOFPERSIA -> main class load content resource
class LEVEL
class ROOM
class TILE

class SEQUENCE
class FRAME

interface iCharacther
class PLAYER


class SEQUENCEANIMATION -> draw on screen sprites based on sequences wrote in the xml

The focus is how to manage the collision and position of KID in the room, for this i will write a new class called POSITION,
In the previous the coordinate are saved in a Vector2 with help with another Vector2 origin (x y sizeof sprite focus on bottom center of this) and a Rectangle structure for save the size of
the bounding of the sprite kid. ..... too complex to manage....

The class POSITION will manage the real screen and the draw position of KID in the screen and its bounding rectangle for collision detect.

XNA consider the x=0,y=0 the upper  left corner of the screen and when draw a texture (in default parameters) taking the left upper corner of this. The Position class translate this coordinate system based on the bottom center of kid texture.
Kid on x=0,y=100 the sprite will be on the left screen with feet on x=0, half sprite on screen. Other purpose of the class is consider the real screen, POP have 640x400 resolution but the last 20 pixel are reserved for enegy bar and messages, the class position manage the sprites on 640x380 (the room size).

In next post i will post the class diagram of POP


Tuesday, 16 October 2012

New idea and future planning...

New idea and future planning...

I wish POP.net can be customizable in sprites, background, level and rooms..
I wish POP.net can be read the original DAT blueprint file, there are lot of custom level  made it by fan of the original POP
I wish POP.net can be customizable animation...
I wish POP.net can be a 2D platform construction game...
I wish POP.net can be an android game...

I will write a letter to Santa Claus..

Monday, 15 October 2012

Climb Up & Setup

Climb Up & Setup

Now i'm developing the "Climb Up" routine the animation is done, now i can think how to climb the floor.

Setup "have some problems...please patient i will fix it, in some days..."

(updated 2012/12/03) For anyone would  install it and have POP.net everytime updated, use this link


Thursday, 11 October 2012

New features and release

New features and release

Now kid can step and jump in the screen, download the alpha version from previous post..

SHIFT + Left or Righe -> step forward
UP = Jump
DOWN
DOWN + Left or Right -> for crouch

I had little trouble to understand the "Step Forward" movement, the orignal PC version use a various step lenght, when KID is near the left wall use the step of 52 pixel and normally use a step of 50px, the orignal program use some different step lenght..

For now i have used only the 52px movement.

Wednesday, 10 October 2012

Repository sources

Repository Source

(updated 2012/12/03) The repository of source code is now public is on


If anyone want help me for collaborate in this project please contact.. i will refresh the project every week stay tuned.....

Friday, 5 October 2012

Alpha version release

Alpha version release


I am very hesitant to release this alpha version, the functionalitis are few since I had to rewrite several routine.

In the coming days I will try to improve the movement of "KID" on the x axis then proceed along the y axis (jump, ...)

For who want to try... download here :

not avaible use the setup... look in recent post.


Require Microsoft Dot net 4 download from here :

http://www.microsoft.com/en-us/download/details.aspx?id=17851


Friday, 28 September 2012

Semplicity and rewrite

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


CLASS ANIMATIONPLAYER

Proprieties

int currentFrameIndex
bool stoppable

Method

Play(Animation animation)

CLASS ANIMATION

Proprieties

List<Frame> frames

Methods

Count
GetFrameIndex(string framename)


CLASS FRAME

Proprieties

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, ...}


XML

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>
<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>
<animation name=STAND>
<frame value=1 type=Sprite stoppable=true/>
<frame value=Goto type=Command parameter=STAND stoppable=true/>
</animation>



Source repository and preview

Source repository and Preview

Now, i have a repository for the source code of PrinceOfPersia.net 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

TRANSITION

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
*-------------------------------
startrun
 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

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)
                    {
                        continue;
                    }
                    if (tileCollision == TileCollision.Passable)
                    {
                        continue;   
                    }

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

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

                        default:
                            Position = new Vector2(Position.X, tileBounds.Bottom + Tile.Ground);
                            bounds = BoundingRectangle;
                            break;
                    }
                    
                }
            }
            //???
            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..

Today

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..