Blocks of Persia

Threads about other remakes and ports.
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Blocks of Persia

Post by Alberto »

Oh bother! after reading through the thread I'm starting to chicken out, so here goes nothing.

My name is Alberto and this is my first post, currently I'm studying to become a game developer so obviously I decided to remake Prince of Persia because it made an impact back when I was little and the game seems like a doable challenge for a beginner. But as I have read, the challenge is more on the difficult side. So just to keep my spirits up I will take all your advices and take this slowly.

As of right now (and as a non-serious disclaimer) I would consider myself a hobbyist, I know just the basics of programming (currently using C#), I don't have an artistic background and most of my solutions come from playing the game, observation and trying to recreate the behavior to the best of my abilities.

Whoa, what a way to introduce myself lol. Anyway long story short, since last December I started a project to recreate the DOS version of Prince of Persia. Because of the rough boxing method I used, my project shall from this day forth be known as... Blocks of Persia. (sorry I couldn't resist).

So without further ado (drum roll) the first iteration of the project can be found here: https://alberto-luviano.itch.io/blocks-of-persia

Pretty, isn't it? lol.

Being serious now, I would like to have the opinion of the community and receive honest feeback in order to improve. I'm looking forward to learning from you all and tap into the collective experience of the community. For this first post I didn't want to include more detailed info (code, room logic, tiles etc.) so as not to bore you to death, but if you feel interested in the "how" just ask and I'll be happy to share. I'm also willing to rewrite code from scratch if that is what it takes to improve the quality/efficency of the game.

That's it for now, if you experience any difficulties downloading or running the files please do let me know to try and help you.
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: PoP Unity - A remake in the Unity Engine

Post by Norbert »

Alberto wrote: February 13th, 2019, 11:15 amAnyway long story short, since last December I started a project to recreate the DOS version of Prince of Persia.
Hi Alberto.
Going by the screenshots, you did a lot of work in only a couple of months!
Any chance you could allow playing via WebGL, as you did with your other itch.io work?
(I'm on Linux and Wine appears to be unable to run your Mono executable.)
[Edit: I've mentioned your first iteration here and here.]
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Re: PoP Unity - A remake in the Unity Engine

Post by Alberto »

Hi Norbert,
Thank you very much for the mentions, it really boost my confidence and enthusiasm in the project :D

About that WebGL version, Unity is playing the "I'm going to annoy you" card at this moment. Some weird stuff is happening with the IL2CPP compiler, which is messing up my loops for the Map Generator... argh! frustation is on the rise.

Anyway, I was able to create a Linux build for both x32 & x64 and uploaded them to my itch.io, I'll keep my fingers crossed for that to work. I'll be so mad at Unity if it doesn't.
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: PoP Unity - A remake in the Unity Engine

Post by Norbert »

Alberto wrote: February 14th, 2019, 1:10 amAnyway, I was able to create a Linux build for both x32 & x64 [...]
Thanks, that works for me.
I playtested the 64-bit version.

When levels start, it appears the camera tries to focus on the area where the prince is, but this fails for most levels.
I used the "n" key to go to level 11, where the camera did focus on the prince, which allowed me to try that level.
Maybe on the Configuration window that shows up before the game starts, try to modify what's on the Input tab.
You could mention "n" and "p" there, and remove some unused keys.

Either way, I'm quite impressed with what you've put together.
Hopping on the ground, for example, works, even under a closing gate.
Loose floors break, jumping and grabbing ledges works, animation for turning around while running, etc.

It's unclear to me whether guards and exit doors should appear (and work) or not.
I didn't see a guard where one should be, and the exit door showed up as a gate.

My primary suggestions right now are these:
- try to make the camera focus on the player on level-start,
- change (what you call) the 'context action button' from space bar to Shift, (optionally make space bar an alias of Shift), and
- don't require the use of Shift (space bar) when jumping up to grab ledges.

I look forward to giving your next iteration a go.
Don't rush yourself, I/we will be patient. :)
Attachments
exit.jpg
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Re: PoP Unity - A remake in the Unity Engine

Post by Alberto »

Oh what a bummer, that is the exact same behaviour as the webGL version. That's it, this is Unity's second strike.

I didn't want to go into details but maybe someone could help me find a way to overcome this problem. Currently each level is generated at the start from plain text files and separated by layers. Layers 1 & 2 create the tiles and backgrounds, then layers 3, 4 & 5 are in charge of finding the position of switches, gates and guards. And finally, the last loop is in charge of creating all those switches, gates and guards. Something is preventing that last loop from doing it's job, how disappointing.

Well I feel better now and thank you very much for being patient, I'll find I solution. In the meanwhile, can I ask how does the original or SDLPoP handle the level creation? I have read this blog http://popc64.blogspot.com/2011/10/par ... ngeon.html, but still can't quite understand how does it change screens.
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: PoP Unity - A remake in the Unity Engine

Post by Norbert »

This weekend David will probably find this thread's recent posts.
He may have some insightful things to add, for example regarding SDLPoP.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: PoP Unity - A remake in the Unity Engine

Post by David »

Moved posts to a new topic.
Norbert wrote: February 13th, 2019, 2:13 pm Any chance you could allow playing via WebGL, as you did with your other itch.io work?
(I'm on Linux and Wine appears to be unable to run your Mono executable.)
I can't run the game on Windows or Linux.

On Windows I get the "not a Win32 application" error, which actually means that the EXE requires a newer OS. (I have Windows XP.)
And if I bypass this by hex-editing the expected Windows version in the PE header then it says "can't find InitializeCriticalSectionEx in KERNEL32.dll", so it really needs a newer version of Windows.

On Linux (in Wine) I get this:
Failed to initialize graphics.
Make sure you have DirectX 11 installed, have up to date
drivers for your graphics card and have not disabled
3D acceleration in display settings.
InitializeEngineGraphics failed
I used the BlocksOfPersiaWinx32.zip version in both cases.
Norbert wrote: February 14th, 2019, 8:58 pm
Alberto wrote: February 14th, 2019, 1:10 amAnyway, I was able to create a Linux build for both x32 & x64 [...]
Thanks, that works for me.
I playtested the 64-bit version.
Where can I find these Linux builds? The download page shows only BlocksOfPersiaWinx32.zip and BlocksOfPersiaWinx64.zip for me.
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Re: Blocks of Persia

Post by Alberto »

Hi David!
That is horrible, I guess Unity has been lying to me all this time, right now I'm pretty disappointed at the quality of the builds. I have a game that no one else can play :(

As an update to the project, I've deleted the Linux files as Norbert confirmed that the game was also not playable there. However I've worked on the problem and I think I have solved it (need confirmation) and created a WebGL version that is already available. For the record, on previous builds some of my level-start loops were generating an empty non printable character that messed up the code, I believe that that invisible character was being ignored in the Unity Editor.

With luck the new version works. Let me know if you were able to play it.

Here is a preview of what is supposed to happen:

Last edited by Alberto on February 18th, 2019, 3:19 am, edited 1 time in total.
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Blocks of Persia

Post by Norbert »

Alberto wrote: February 18th, 2019, 1:07 amThat is horrible, I guess Unity has been lying to me all this time, [...]
On 2 May 2018 - as of Unity 2018.1 - they dropped support for Windows XP (source).
Given XP's market share I wouldn't worry too much about it.
I don't know if WebGL will work on Windows XP, maybe in Chrome with --ignore-gpu-blacklist (source).
Alberto wrote: February 18th, 2019, 1:07 amHowever I've worked on the problem and I think I have solved it (need confirmation) [...]
The WebGL version works for me, and thanks for allowing Shift and climbing up without it; that helps a lot.

Here's a bit of text about spikes. One thing that is actually possible in DOS, is passing spikes without using Shift. Once the spikes are out, the prince can run through them without a problem. Roughly speaking it's like this: if the player has the left or right arrow down while the spikes move upward, the player dies. This means the player can initiate movement that will end inside the spike area, but let go of all keys before that area; the spikes will then come out but not kill the prince. The spikes remain out if the prince hasn't left the spike area for more than about a second. This means that, once the spikes are out and the prince didn't die, the prince can simply run through them. And even run back and forth through them endlessly, as long as he doesn't leave the spike area for too long.

I'm trying to find the gameplay elements that are least like the DOS version, which, if changed, should have the biggest impact on how players familiar with the original will experience your remaster. :) Being able to use Shift is already a major plus for me. I'll try to go through the entire game tomorrow, to give more feedback.

Are you already keeping track of the number of hit points for the guards and the player? If so, maybe show basic indicators somewhere on the screen?
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Re: Blocks of Persia

Post by Alberto »

Thank you very much for the good news & the spikes logic/behaviour explanation, I'll sure add it into my next revision.
Norbert wrote: February 18th, 2019, 2:22 amAre you already keeping track of the number of hit points for the guards and the player? If so, maybe show basic indicators somewhere on the screen? [...]
There is a health variable for the kid and each of the guards, sadly, because of the bad fighting logic it's not working really well (sometimes the kid ends up dying in one hit). I'm planning to add the UI elements after the logic is more stable.
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Blocks of Persia

Post by Norbert »

I've played through the game, only skipping some small sections.

First the funny thing: in level 4 when I drank the big life potion, the prince actually picked up and used the chomper! :lol:
I could then kind of move around with the chomper attached to the prince. :)

Eventually, the character got stuck there, as seen in the attached screenshot.
In another section, see the attached screenshot of the level 2, I got stuck in a similar fashion.

Notes, in random order:
- In the original, the sword on the floor has a distinct orange handle. While (un)sheathing/using the sword, the handle is more or less gone. This means you should feel free to style the sword on the floor a bit more. Currently it's a bit of a white stick.
- In the original, potions and the sword cannot be picked up by using the down arrow key. Only with Shift. In your remaster, it's currently the reverse.
- The movement of the prince is a bit too slow. There are roughly two reasons for this. First off, some animations take too much time. Climbing down should be twice as fast, going up faster, the 'pause' right before the actual jump from a standing position should be shorter. The second reason is that, except for some cases, the remaster does not register new arrow presses when an animation is taking place. For example, if the prince steps left, and the player holds down left+up to jump, the prince will just stop after stepping left.
- I'm glad the remaster is very forgiving when it comes to grabbing ledges after a jump.
- I see Jaffar has an epic pimp hat. :P
- No skeletons on the floors yet.
- The very first guard in level 8 should not move forward. He's special (annoying, for most players). :)
- The float potion in level 7 works, nice.
- The balcony needs better graphics.
- The death animation of guards is pretty good.
- Potion bubbles still slowly disappear after switching screens, which means random bubbles disappear where no potions exist.
- It's nice that the remaster helps with alignment when climbing up, like the original does.
- In the original, when taking small steps, there's always one final step to end up right in front of the chomper. Basically, the original helps the player, and shortens the small step if necessary.
- The mirror appears, can be jumped through; no shadow yet in the remaster.
- In the original, the screen flashes when picking up the sword (yellow), when the prince gets hit (red), and when the prince fills up/loses/increases hit points with potions (red).
- Even walking up the stairs is properly animated, nice.
- Gates should be open a bit longer. I noticed this in particular in level 3 and level 9. Even if it's the same as the original - I don't think it is - then it should still be longer, just to be more forgiving.
- In the attached screenshot of level 7, you can see a gate above a gate. In the original, gates have gate tops above them. Basically tapestries instead of bars.
- I wonder if it's difficult to give the palace levels their distinct yellowish color. Might be easy, I don't know how you're drawing the graphics.
- In level 13, loose floors indeed fall instantly. But only if the prince is in the room, and only in two of the rooms. Probably you were still getting to this.
- In level 9, approaching the top right guard from the bottom causes problems. The same problem occurs with the second guard in level 10. Make sure they don't hear you (don't turn towards where you will climb up), then you can see what happens.
- In level 8, there's a problem with the far right guard. When you approach him, the screen does not switch to give him focus, and he insta-kills you when the screen does switch. The prince instantly dies even if he is in fighting mode and has several hit points left.

All in all, the remaster is solid, and already enjoyably playable.
I think if you keep polishing and improving it, it will become even better.
Nice work.
Attachments
level_7_gate_top.png
level_4_LP.png
level_2_stuck_near_end.png
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Re: Blocks of Persia

Post by Alberto »

Nice, this list is super useful. I'd noticed some of the issues like the insta-kill while fighting the guards and the bubbles of the potions but your detailed descriptions will definitely help shorten the production time by at least a month, and all that just after one day of playing it. Your knowledge of the game is incredible, thank you very much for sharing it :)

This week I'll be working on the style for the palace levels and fixing some of the bugs you mentioned.
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
User avatar
Alberto
Sheikh
Sheikh
Posts: 48
Joined: February 13th, 2019, 6:55 am
Contact:

Re: Blocks of Persia

Post by Alberto »

Just a weekly update:

-Dungeon tileset was reworked.
-Palace tileset was added.
-The sword now has an orange handle. (sword on the floor)
-Potions & sword can be picked up with Shift.
-Improved the speed of animations.
-Potion bubbles do not remain after a screen switch. (now I need to get rid of them while drinking the potion)
-Guards bug #1 fixed: After entering fight mode, they turn around to face you. (so they don't end up walking like mindless zombies lol)
-No more insta-death while fighting guards.
-Improved the jump distance so the kid can make those tricky 3-tile jumps.(still needs more refinement)
-Traps now have a separate layer meaning there is no chance to grab them if there is a bottle nearby (awww)

Tell me what you think about the new v 0.2, I would love to read your comments/ideas/suggestions.

I believe next week I'll be working on the UI (health display, time, level number).
Attachments
L12.PNG
L5.PNG
If you have some spare time come and play Blocks of Persia,
a 3D remaster with real time physics of the original Prince of Persia I'm making :)
https://alberto-luviano.itch.io/blocks-of-persia
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Blocks of Persia

Post by David »

Norbert wrote: February 18th, 2019, 2:22 am
Alberto wrote: February 18th, 2019, 1:07 amThat is horrible, I guess Unity has been lying to me all this time, [...]
On 2 May 2018 - as of Unity 2018.1 - they dropped support for Windows XP (source).
Given XP's market share I wouldn't worry too much about it.
I don't know if WebGL will work on Windows XP, maybe in Chrome with --ignore-gpu-blacklist (source).
Last time I checked, Google Chrome wouldn't even install on Windows XP.

WebGL usually works for me in Firefox.
However, Blocks of Persia shows me an error message:
The browser could not allocate enough memory for the WebGL content. If you are the developer of this content, try allocating less memory to your WebGL build in the WebGL player settings.
So my 2 GB of RAM is not enough.

I am going to try this on Linux as well; although the amount of installed RAM will be the same there as on Windows, so I'm not sure it if will work there.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Blocks of Persia

Post by David »

David wrote: February 23rd, 2019, 2:55 pm I am going to try this on Linux as well; although the amount of installed RAM will be the same there as on Windows, so I'm not sure it if will work there.
This is what happens on Linux:

In Firefox, I don't get the error message about memory.
Instead, the area where the game would appear turns magenta, and I get a bunch of errors in the developer console:
Error: WebGL warning: <SetDimensions>: Failed to create WebGL context: WebGL creation failed:
* tryNativeGL
* Exhausted GL driver options.

Warning: Unsupported graphics API WebGL 2.0

Note: Creation of internal variant of shader 'Sprites/Default' failed.
-------- GLSL link error: Statically used varyings do not fit within packing limits. (see GLSL ES Specification 1.0.17, p111)
[There is a lot of these, one for every shader...]

Note: Creation of internal variant of shader 'Legacy Shaders/VertexLit' failed.
WARNING: Shader Unsupported: 'Legacy Shaders/VertexLit' - Pass '' has no vertex shader
ERROR: Shader Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Legacy Shaders/VertexLit' - Setting to default shader.
Chromium is relatively better.
The game eventually starts, but it's so slow that it's unplayable. (around 1 fps)

Here are some error messages (from the terminal window from where I started Chromium):
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
[4464:4464:0223/173656.721766:ERROR:gl_context_glx.cc(227)] Couldn't make context current with X drawable.
[4464:4464:0223/173656.728019:ERROR:gpu_info_collector.cc(68)] gl::GLContext::MakeCurrent() failed
[4464:4464:0223/173656.728232:ERROR:gpu_info_collector.cc(186)] Could not create context for info collection.
[4464:4464:0223/173656.728366:ERROR:gpu_init.cc(61)] gpu::CollectGraphicsInfo failed.
[4464:4464:0223/173656.863866:ERROR:viz_main_impl.cc(184)] Exiting GPU process due to errors during initialization
[4347:4485:0223/173706.076874:ERROR:udev_watcher.cc(63)] Failed to begin udev enumeration.

[4495:4495:0223/174001.278268:ERROR:buffer_manager.cc(491)] [.WebGL-0xf60f0b0]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
[4495:4495:0223/174001.285604:ERROR:gles2_cmd_decoder_autogen.h(1991)] [.WebGL-0xf60f0b0]GL ERROR :GL_INVALID_OPERATION : GetTexParameteriv: <- error from previous GL command
[4495:4495:0223/174001.300539:ERROR:gles2_cmd_decoder_autogen.h(1991)] [.WebGL-0xf60f0b0]GL ERROR :GL_INVALID_OPERATION : GetTexParameteriv: <- error from previous GL command
[etc...]
I tried --ignore-gpu-blacklist (and its equivalent in chrome:flags), but then chrome:gpu still said "WebGL: Software only, hardware acceleration unavailable".

My hardware is clearly too old for this game...
Post Reply