New tile idea: teleports

Open-source port of PoP that runs natively on Windows, Linux, etc.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

New tile idea: teleports

Post by David »

Shauing wrote: September 26th, 2021, 10:02 am Perhaps for the teleporter one, it can be just like going upstairs to finish a level but instead of that, the tile sends you to a different room from the same level.
Here is my attempt on a new branch: https://github.com/NagyD/SDLPoP/commit/ ... f3dff9ee04

Each balcony (whose left half has a non-zero modifier) will behave as a teleport to another balcony with the same modifier.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: New tile idea: teleports

Post by Norbert »

David wrote: September 26th, 2021, 12:47 pm
Shauing wrote: September 26th, 2021, 10:02 am Perhaps for the teleporter one, it can be just like going upstairs to finish a level but instead of that, the tile sends you to a different room from the same level.
Here is my attempt on a new branch: https://github.com/NagyD/SDLPoP/commit/ ... f3dff9ee04

Each balcony (whose left half has a non-zero modifier) will behave as a teleport to another balcony with the same modifier.
Hey, it's fun to see you've worked on this.

Small bug though, when continuously pressing the up arrow key:
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: New tile idea: teleports

Post by David »

Norbert wrote: September 26th, 2021, 2:57 pm Small bug though, when continuously pressing the up arrow key:
Thank you for testing!

Fixed: https://github.com/NagyD/SDLPoP/commit/ ... a606e6e12d
User avatar
Shauing
Calif
Calif
Posts: 431
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: New tile idea: teleports

Post by Shauing »

Awesome! But how do I use them for my levels?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: New tile idea: teleports

Post by Norbert »

Shauing wrote: September 27th, 2021, 9:09 pmBut how do I use them for my levels?
It depends on how quickly you need to use them; how patient you are willing to be.
Most likely, in the long term, things will look better and work easier.
Below, I'll explain how to use teleports in the short term, and how to use them in the long term.
While reading the explanation, keep the following in mind.
On apoplexy's tiles screen, the balcony left+right are the two tiles to the right of the sword.
By default, these tiles don't (really) work in the dungeon environment.

Short term:

You'll need an SDLPoP binary (executable file) that provides the teleports. Currently, this functionality is only available in David's teleports branch. You could ask someone to create a binary package for you using that branch. Once you have this suitable SDLPoP, move it into apoplexy's SDLPoP/ directory.

Next, use apoplexy to add teleports. First, place a balcony left. Click the balcony left. This will take you to the tiles screen. On the tiles screen, click the gear icon in the lower right. This will take you to the custom tiles screen. On the custom tiles screen, set the "Modifier" code to 1 or higher, and then press "USE". You have now changed the balcony left to a teleport. Add another teleport with the same "Modifier" code. Save, playtest, etc.

Long term:

Teleports may get added to the official (master; main) SDLPoP branch. This would mean future SDLPoP releases will have the teleports build in. You would no longer need to get a binary package by compiling the teleports branch code.

If SDLPoP officially includes teleports, then I will add them to apoplexy's native tiles screen. This is the screen where you can pick SDLPoP/MININIM tiles, which is accessible by Ctrl+clicking a tile (or by pressing "x").

For the above long-term inclusion to happen, we'll likely need three things:
1. Graphics for the teleports. We could combine the DOS level exit stairs with the SNES teleports found in the green (palace) environment, to create balcony left+right tiles suitable to function as teleports.
2. We would need to decide how many bits (of 8 total) of the balcony left will be reserved as legacy combos for the teleports. The most logical amount might be 3 bits, because excluding the default balcony left that gives us 7 teleport sets per level, and leaves 5 bits for possible future use. The 7 teleports match SNES' 7 different teleport marker icons above the teleport openings. Other choices are using 4 bits (for 15 teleport sets), 5 bits (for 31 teleport sets), or 6 bits (for 63 teleport sets), etc. The consideration here is: we want enough teleport sets, but it's handy to keep enough bits free for possible future use.
3. David has to sign off on (approve) inclusion of the teleports in future (official branch) SDLPoP releases.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: New tile idea: teleports

Post by Norbert »

David, your current teleports code is confusing for other programmers such as myself because of the way you appear to rely on existing exit door code. This is also why you find yourself forced to tell the program to 'don't do this, don't do that', e.g. don't play end level music, don't go to the next level. Probably, up_pressed() should have been your starting point. Because all you really need, unless I'm overlooking something, is the stairs climbing animation.
Norbert wrote: September 28th, 2021, 1:32 am1. Graphics for the teleports. We could combine the DOS level exit stairs with the SNES teleports found in the green (palace) environment, to create balcony left+right tiles suitable to function as teleports.
There are 12 stairs climbing frames. David's current implementation shows just the first 7. The last 5 are skipped because the kid teleports away at the moment the end level music would normally start playing. I get that this speeds up the teleports, but attaching any of this to an unrelated audio event seems weird and a bad idea.

Regardless, it's necessary to know whether or not the partial animation is here to stay - is what we really want - before we can start working on graphics for the teleports. Because graphically, we'll either need full, level exit-like stairs, or just the first couple of steps.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: New tile idea: teleports

Post by David »

Norbert wrote: September 29th, 2021, 6:03 pm David, your current teleports code is confusing for other programmers such as myself because of the way you appear to rely on existing exit door code. This is also why you find yourself forced to tell the program to 'don't do this, don't do that', e.g. don't play end level music, don't go to the next level. Probably, up_pressed() should have been your starting point. Because all you really need, unless I'm overlooking something, is the stairs climbing animation.
The stairs climbing animation includes the end level music (SND_LEVEL) and going to the next level (SEQ_END_LEVEL).

To clean up code I'd need to add a new animation (sequence) without those, which I didn't want to do yet in the first implementation.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: New tile idea: teleports

Post by Norbert »

David wrote: October 2nd, 2021, 1:11 pmTo clean up code I'd need to add a new animation (sequence) without those, [...]
I see you've done this; thank you.

Could you make it such that all the kid's stairs frames show up in-game?
[Edit: Actually, it's probably better to show 2 fewer frames than are shown now, so the kid is not walking up (stairs) at all... They a teleports, after all.]
I'll then attempt to create suitable dungeon and palace graphics for the teleports.
My plan is to, locally, temporarily take out your if(pickup_obj_type)-check and modify res210-213.
This should work, right? That you could later give the teleports their own res numbers.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: New tile idea: teleports

Post by David »

Norbert wrote: October 13th, 2021, 5:11 pm [Edit: Actually, it's probably better to show 2 fewer frames than are shown now, so the kid is not walking up (stairs) at all... They a teleports, after all.]
Done: https://github.com/NagyD/SDLPoP/commit/ ... 7ce32cf71e

I took out more than two frames, because frames 224..228 were already hidden by clip_char() here: https://github.com/NagyD/SDLPoP/blob/te ... 1692-L1696
So I took out the hidden frames and the last two visible frames.

(By the way, editing seqtbl.c in its current form is not ideal: the compiler won't compute the address of labels for us, so they have to be explicitly specified as the number of bytes from the previous frame. See the long list of #defines at the beginning of seqtbl.c.)
Norbert wrote: October 13th, 2021, 5:11 pm I'll then attempt to create suitable dungeon and palace graphics for the teleports.
My plan is to, locally, temporarily take out your if(pickup_obj_type)-check and modify res210-213.
This should work, right? That you could later give the teleports their own res numbers.
res214-229 are unused in both dungeon and palace. We can put teleport graphics at for example res214-217.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: New tile idea: teleports

Post by Norbert »

Palace attached, inside palace.zip.
palace.png
palace.png (2.05 KiB) Viewed 6145 times
Dungeon should be done tomorrow.
Attachments
palace.zip
(1.94 KiB) Downloaded 89 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: New tile idea: teleports

Post by Norbert »

Norbert wrote: October 19th, 2021, 5:29 pmDungeon should be done tomorrow.
Dungeon attached, inside dungeon.zip.
dungeon.png
dungeon.png (1.88 KiB) Viewed 6140 times
As for the symbols above the teleports, it should be possible to show the variant (modifier) number as a text character.
I've suggested the numbers 1-7 (i.e. limit to 3 bits).
Attachments
dungeon.zip
(1.87 KiB) Downloaded 80 times
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: New tile idea: teleports

Post by David »

Thank you!

I added the graphics to SDLPoP, and added code to show these graphics instead of the balcony graphics if the modifier of the left half is not zero.
https://github.com/NagyD/SDLPoP/commit/ ... ff19151909
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: New tile idea: teleports

Post by dmitry_s »

How do you add new graphics into VPALACE.DAT using PR?

I tried adding the following resource into the "resources.xml" file but the "id + 4" logic does not draw it. Balcony has values 1210-1213. The file did get larger.

Code: Select all

  <folder name="test" path="test">
   <item value="1214" path="lower left.bmp"/>
   <item value="1215" path="upper left.bmp"/>
   <item value="1216" path="lower right.bmp"/>
   <item value="1217" path="upper right.bmp"/>
  </folder>
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: New tile idea: teleports

Post by David »

dmitry_s wrote: October 24th, 2021, 7:09 am How do you add new graphics into VPALACE.DAT using PR?

I tried adding the following resource into the "resources.xml" file but the "id + 4" logic does not draw it. Balcony has values 1210-1213. The file did get larger.

Code: Select all

  <folder name="test" path="test">
   <item value="1214" path="lower left.bmp"/>
   <item value="1215" path="upper left.bmp"/>
   <item value="1216" path="lower right.bmp"/>
   <item value="1217" path="upper right.bmp"/>
  </folder>
You are on the right track, but SDLPoP needs to be changed if you are using these resource numbers.

Images with resource numbers above 1000 are loaded separately by load_more_opt_graf().

These arrays tell it what resources to load:

Code: Select all

byte optgraf_min[] = {0x01, 0x1E, 0x4B, 0x4E, 0x56, 0x65, 0x7F, 0x0A};
byte optgraf_max[] = {0x09, 0x1F, 0x4D, 0x53, 0x5B, 0x7B, 0x8F, 0x0D};
The last elements specify the balcony images, from 1200+0x0A=1210 to 1200+0x0D=1213.
You need to change the last element of optgraf_max[] from 0x0D to 17 to make SDLPoP load the new images.
(But see below for another solution.)

"opt" refers to the fact that these images were loaded optionally in the original game, based on the "allowed resources" flags.
(These flags appear in CusPop, but it enables all of them by default. You can find the original values here, under "tile incompatibilities".)
SDLPoP does not have these flags and always loads these images.

Additionally, in the data folder, I changed the resource IDs of optional images from 12xx to 2xx, so they are loaded together with the non-optional sprites (by load_chtab_from_file() called from load_lev_spr()).
So load_more_opt_graf() is has effect only when loading from DAT files.

Alternatively, you could add the new images with resource numbers 214..217.
This way you don't need to change optgraf_max[].
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: New tile idea: teleports

Post by dmitry_s »

That worked. Thanks!
Post Reply