Flight of a Dragon

Use this forum to share and discuss Uzebox games and demos.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Flight of a Dragon

Post by nicksen782 »

I'll make a point of adding each of the UCC games I find! Good catch.

I tried your link and it did fail.

Your link:
https://nicksen782.net/a_demos/Emscript ... gameid=222

Link provided by the Online Player:
https://nicksen782.net/a_demos/Emscript ... gameid=222

Your link is incorrect. See the "undefined" part along with a duplicate of the first part of the link? That's the problem with the link.

I checked:
http://uzebox.org/wiki/Flight_of_a_Dragon

And tried both of the links to the Online Player. Both worked. I did these tests in both Chrome and Firefox.

So, as far as I can determine, the Online Player is working fine but you have an incorrect link.

Here are the correct links:
UCC: https://nicksen782.net/a_demos/Emscript ... gameid=102
CURRENT: https://nicksen782.net/a_demos/Emscript ... gameid=222
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Flight of a Dragon

Post by Jubatian »

nicksen782 wrote: Sun Jan 14, 2018 9:39 pm I tried your link and it did fail.

Your link:
https://nicksen782.net/a_demos/Emscript ... gameid=222

Link provided by the Online Player:
https://nicksen782.net/a_demos/Emscript ... gameid=222

Your link is incorrect. See the "undefined" part along with a duplicate of the first part of the link? That's the problem with the link.
What generates those links? I started the Inspector, and it has this for that anchor:

Code: Select all

<a title="Flight of a Dragon (RC1)" target="_blank" href="undefined/a_demos/Emscripten_Uzebox_Gamechanger/CURRENT/?gameid=222"> Direct link:  Flight of a Dragon (RC1)</a>
I guess it is being generated with JavaScript and for some reason in my environment it fails somehow.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Flight of a Dragon

Post by nicksen782 »

I'm using Firefox 57.04 (64-bit)

So, here is the Javascript that creates that link:

Code: Select all

var gameid = document.getElementById('gameMenu_select').value;
var gamename = document.querySelector('#gameMenu_select option:checked');
if(gamename.value !==""){
	gamename = gamename.innerHTML;
}
else{
	gamename = "N/A";
	return;
}
var directLink1=window.origin +''+ window.location.pathname+"?gameid="+gameid;
document.querySelector("#serverGame_directurl").innerHTML = "<a id='gamedlink' title='"+gamename+"' target='_blank' href='"+directLink1+"'> Direct link:  "+gamename+"</a>";
So, get the selected game id, get the gamename. Create the direct link. The direct link uses window.origin and window.location.pathname. I used the Firefox inspector and found that both methods were available. Then, those values are used to create a link.

window.origin should give "https://nicksen782.net".
window.location.pathname should give "/a_demos/Emscripten_Uzebox_Gamechanger/CURRENT/"

This should work. I'm using the latest Ubuntu and I use this on Windows 10 too. I'm very curious as to why you would be getting "undefined" for window.origin.
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Flight of a Dragon

Post by Jubatian »

nicksen782 wrote: Sun Jan 14, 2018 10:01 pm window.origin should give "https://nicksen782.net".
window.location.pathname should give "/a_demos/Emscripten_Uzebox_Gamechanger/CURRENT/"
Shouldn't that be "window.location.origin? (By a quick search for me it seems like "window.origin" shouldn't even exist: https://github.com/tmpvar/jsdom/issues/1789 , I get this for "window.origin" in MDN: https://developer.mozilla.org/en-US/doc ... ope/origin , my Firefox version is 52.5.2, where it is not supposed to be supported)
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Flight of a Dragon

Post by nicksen782 »

Confirmed!

It seems that Chrome and Firefox (at least as of my versions) support it but it isn't official.

In function function "serverGameMenu_select()" I changed window.origin to be window.location.origin.

I've sent the update up to the live site. I'll update Github soon.

Thanks Jubation for discovering this bug.
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Flight of a Dragon

Post by Jubatian »

I am still getting "undefined" there. Do you really need a full path? (Wouldn't a relative path do?). Searching a little around I am getting that it is rather common that for some reason this property is undefined, so if you can avoid it, maybe you should (for example: https://github.com/tierratelematics/nin ... h/issues/6 ).
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Flight of a Dragon

Post by nicksen782 »

Odd.

Does window.location.href work for you? I've updated the Online Player again. Could you confirm?
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Flight of a Dragon

Post by Jubatian »

nicksen782 wrote: Mon Jan 15, 2018 5:40 pm Odd.

Does window.location.href work for you? I've updated the Online Player again. Could you confirm?
Only sort of. When I just start the Online Game Changer, I get a good link, but when I direct link to one and select another, I am getting it like:

Code: Select all

https://nicksen782.net/a_demos/Emscripten_Uzebox_Gamechanger/CURRENT/?gameid=129?gameid=222
This obviously wouldn't work. I also rather expected it to provide a download link, anyway, I understand what it is, but I feel it a little redundant (you have the link in the URL bar if you want to grab it).

Anyway, did anyone complete the game at last? :) (Should be easier with the added credits!)
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: Flight of a Dragon

Post by L4rry »

Jubatian wrote: Mon Jan 15, 2018 6:16 pm Anyway, did anyone complete the game at last? :) (Should be easier with the added credits!)
I certainly got farther this time :) So I'm fairly deep in the second of the dungeon levels before I ran out of credits. That was on my first go, so I'm fairly certain I'll make it through without to many tries again. I'll let you know once I have.

I didn't notice any bugs with with the credits system so far. Seems to work just fine. Just a note on a little bug I noticed elsewhere. Sometimes, when you grab the end-of-level dragon emblem, and the game starts counting down your remaining resources for points, soldiers in view can still have a full crack at you. So you actually take damage when the level is ending. Doesn't happen that often, but I thought I'd share it here.
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Flight of a Dragon

Post by Jubatian »

L4rry wrote: Tue Jan 16, 2018 11:47 amI certainly got farther this time :) So I'm fairly deep in the second of the dungeon levels before I ran out of credits. That was on my first go, so I'm fairly certain I'll make it through without to many tries again. I'll let you know once I have.

I didn't notice any bugs with with the credits system so far. Seems to work just fine. Just a note on a little bug I noticed elsewhere. Sometimes, when you grab the end-of-level dragon emblem, and the game starts counting down your remaining resources for points, soldiers in view can still have a full crack at you. So you actually take damage when the level is ending. Doesn't happen that often, but I thought I'd share it here.
Great! :)

The behavior of the end of level was taken from Jazz Jackrabbit, there it worked similarly, the screen was fixed, but you could still move around (any maybe even die). In FoaD whatever happens after you take the dragon emblem can't kill you as at that point death is disabled, your life points will restore to the value you had when taking the emblem (and the next level's bonus will add on that). The worst thing what you may suffer is a loss of score by damage taken before your remaining life is rolled into your score.
Post Reply