Various technical articles, IT-related tutorials, software information, and development journals
Showing posts with label km-live. Show all posts
Showing posts with label km-live. Show all posts
Thursday, December 20, 2018
Mod demos on Keen Modding Live
I've been corresponding with another PCKF user about using the Keen Modding Live platform to host demos of mods. This will make it possible to embed demos on web sites like the KeenWiki. It will require some special considering from KML since uploading an entire mod doesn't fit the "user level plus standard episode package" model. I don't plan to deeply integrate the two kinds of players. The one for mod demos will probably not be linked at all on the main site; it'll just be for embedding.
Sunday, August 5, 2018
Keen Modding Live - Adjusted version tree in Abiathar Live Studio
My original rendition of the version selection dialog for Abiathar Live Studio assumed that an approved/visible version could never be derived from an unapproved/hidden one. Its call to the "get versions" API supplied the "approved versions only" switch when appropriate, so it didn't even get the hidden versions. (I might either remove that API switch or change it so that a useful tree can be constructed from its response.) I adjusted Abiathar Live Studio's tree generation code to request all versions of the level but cut hidden ones out of the lineage while keeping relationships between approved versions intact, just like the level info page on the web.
Friday, August 3, 2018
Keen Modding Live - Comments unattached to versions
I decided that it would be good to allow comments on Keen Modding Live comments unattached to specific versions, that is, comments made directly from the level page as opposed to a version player page. Once comment notifications (or any kind of notifications at all) become a thing, people will often want to reply to comments on their levels, so the page they get directed to should have reply functionality. The version player page is very heavy (several MB), so I won't want to direct users to a section of that from comment notifications.
So I tweaked the API and database schema to allow leaving the version field null. The timestamp is still recorded, of course, so attentive readers will be able to see whether a comment is obsolete (due to a new version being uploaded) by looking at the date it was posted.
So I tweaked the API and database schema to allow leaving the version field null. The timestamp is still recorded, of course, so attentive readers will be able to see whether a comment is obsolete (due to a new version being uploaded) by looking at the date it was posted.
Monday, July 30, 2018
Keen Modding Live - Level comments API
Today I started on a comment system for Keen Modding Live. For logged-in users, comments will appear at the bottom of the player page and possibly the level information page; I haven't decided yet. Comments record what version they were created on (to reduce confusion from level changes across versions) but the same set will appear for all versions' player pages, since not all changes will necessarily affect all comments. I'm currently planning on a flat chronological list of comments without any fancy threads. Replies (to notify a given comment's author) could still be possible.
So far I've written the four necessary API endpoints for comment support: add, edit, delete, and list. At the moment I'm not storing revision history, but the time of last edit or deletion is recorded.
So far I've written the four necessary API endpoints for comment support: add, edit, delete, and list. At the moment I'm not storing revision history, but the time of last edit or deletion is recorded.
Friday, July 27, 2018
Keen Modding Live - Approve/disapprove versions
Today I made the approve/disapprove toggle in Keen Modding Live's version tree actually do something. First I added an "edit version" API endpoint that currently only allows changing the approved status. Originally I was planning on having it be impossible for an approved version to be derived from an unapproved one, but then I thought it made sense to be able to hide uninteresting/broken intermediates. So I adjusted the grid preparer to show descendants of hidden versions as direct descendants of the hidden versions' parents if disapproved versions are not shown. Then, of course, I wired up the toggle link to the API endpoint.
![]() |
| An unapproved version showing in the chain leading to the current version |
![]() |
| The same chain with the unapproved version hidden |
Thursday, July 26, 2018
Keen Modding Live - Version tree
Today I wrote a bit of JavaScript to render the version tree for a given Keen Modding Live level. It's still rough from a UI perspective, but it exists:
Lower records are newer/derived versions. The two at the very bottom are both derived from the one with the green box. (Connecting lines/arrows are not yet implemented.) The green box indicates the current version. Faded out records are "unapproved" versions that only appear if "show all" is checked. The "fork" link goes to the upload-level page with that version preselected. "Set current" sets the level's current/default version to that one. "Approve"/"disapprove" toggles whether the version is approved - this is not yet implemented.
Lower records are newer/derived versions. The two at the very bottom are both derived from the one with the green box. (Connecting lines/arrows are not yet implemented.) The green box indicates the current version. Faded out records are "unapproved" versions that only appear if "show all" is checked. The "fork" link goes to the upload-level page with that version preselected. "Set current" sets the level's current/default version to that one. "Approve"/"disapprove" toggles whether the version is approved - this is not yet implemented.
Wednesday, July 25, 2018
Keen Modding Live - Starting the version tree
Today I started working on the version tree: the bit of UI on the Keen Modding Live level info page that should show the versions of the level and the derivation relationships between them. This is turning out to be quite difficult to do in HTML. The approach I've settled on is to first translate the version information into a two-dimensional array like this:
A
B b
C c
D
("A" is the base version, the main chain of work is all the capital letters, "b" is an alternative version to "B" also forked off of "A", and "c" is an alternative to "C" still derived from "B".) I think I have the grid part done; now I need to render it into an HTML table and make it look nice/understandable.
A
B b
C c
D
("A" is the base version, the main chain of work is all the capital letters, "b" is an alternative version to "B" also forked off of "A", and "c" is an alternative to "C" still derived from "B".) I think I have the grid part done; now I need to render it into an HTML table and make it look nice/understandable.
Tuesday, July 24, 2018
Keen Modding Live - More info on player page
Previously, Keen Modding Live had no way to get from a player page to the level's information page. So today I populated the player page with some useful information: level description, version comment, level owner, version author (if different than the level owner), and version creation time. While I was at it, I made the player page return an HTTP error and bail out if the level or version ID can't be found instead of spewing dozens of PHP errors. The link that goes back to the level information page reads "see other versions of this level," so I suppose the next thing to do is actually render the version tree on the level page.
Monday, July 23, 2018
Keen Modding Live - Level info page
I've recently continued fleshing out the Keen Modding Live level information page. It now shows the level's name, author, description, creation time, episode, and zone. If the current user owns the level, a "delete level" link appears that, unsurprisingly, deletes the level. Administrators have a link that sets the level's owner to the ID Software pseudo-user. I plan to use that to upload the original levels while making it clear that they're not mine. While testing, I noticed that the delete-level API endpoint is broken: it did not in fact delete the level. There was an issue with foreign key dependencies in the database; setting the level's current version ID to null before cascade-deleting it and the level versions fixed the problem.
Friday, July 13, 2018
Keen Modding Live - Player page cleanup
I've continued to tweak the design of Keen Modding Live's player page. I realized that it's not really ever useful to keep the mouse pointer around in fullscreen, so the checkbox that controls that has been removed. The difficulty and keybinding controls have been moved up next to the DOSBox widget. (I had to struggle a bit with CSS to keep the DOSBox centered and get all the controls floating where they should be.) I also made the entire game-and-controls section hidden until all downloading and initialization is finished - that way, the user won't see weird half-loaded elements jumping around.
Thursday, July 12, 2018
Keen Modding Live - Unifying player page style
I made a couple minor adjustments to Keen Modding Live's web site today:
- The player page now has the same template as all the others. There's still a lot of design that needs to go into that, since it's probably the most important page.
- Level information pages now have an "upload a new version of this level" link that goes to the upload page with the level selected.
Thursday, July 5, 2018
Keen Modding Live - URL parsing expansion
The only part of Abiathar Live Studio that needs to know about the non-API parts of the Keen Modding Live web site is the URL format of the level and version pages. The dialog for selecting a level is supposed to be able to extract level or version information from the URL on the clipboard, which it can only do if its idea of what the web site is doing matches up with reality. So today I expanded the pasted-URL parser to deal with level information pages (in addition to version player pages).
While testing, I accidentally chose a Keen 1 level and found that the level picker was happy to go ahead with it. The level search dialog filters out levels of non-Abiathar-compatible episodes, but the URL-pasting route did no such checks. I'm sure all kinds of bizarre behavior would occur if a Vorticons level was selected, so I added some logic to stop that.
While testing, I accidentally chose a Keen 1 level and found that the level picker was happy to go ahead with it. The level search dialog filters out levels of non-Abiathar-compatible episodes, but the URL-pasting route did no such checks. I'm sure all kinds of bizarre behavior would occur if a Vorticons level was selected, so I added some logic to stop that.
Wednesday, July 4, 2018
Keen Modding Live - New versions via web
A conspicuously absent feature from the Keen Modding Live web site up to this point was the ability to upload new versions of existing levels. It was possible in Abiathar Live Studio through the API, but no such program exists for Vorticons levels. Today I set to work adding that feature to the web site.
I decided that, to avoid duplicating effort, I would extend the existing level upload page to optionally take a level ID as an URL parameter. I started off with a light sprinkle of embedded PHP to pre-fill and disable the fields that were already determined at the level's creation if a level is specified. While I was at it, I added fields for version comment and level description, which weren't possible to set via the web before.
To populate the list of versions (from which to choose the base version for the new one), I embedded a larger chunk of PHP that echoes a JSON array into a JavaScript fragment that then populates the dropdown with it. I would have just used the API from JavaScript like I did with the episode and zone dropdowns, but I wanted to show the usernames of the version authors, and doing that from JavaScript would require at least one more round trip. And I would have had PHP render the <option> tags, but I didn't want to risk messing up the escaping and causing security issues.
I successfully used this new system to upload a new version of my tiny Keen 6 test level, after which I noticed that I forgot to add a way to mark the new version as recommended. So that's the next step.
I decided that, to avoid duplicating effort, I would extend the existing level upload page to optionally take a level ID as an URL parameter. I started off with a light sprinkle of embedded PHP to pre-fill and disable the fields that were already determined at the level's creation if a level is specified. While I was at it, I added fields for version comment and level description, which weren't possible to set via the web before.
To populate the list of versions (from which to choose the base version for the new one), I embedded a larger chunk of PHP that echoes a JSON array into a JavaScript fragment that then populates the dropdown with it. I would have just used the API from JavaScript like I did with the episode and zone dropdowns, but I wanted to show the usernames of the version authors, and doing that from JavaScript would require at least one more round trip. And I would have had PHP render the <option> tags, but I didn't want to risk messing up the escaping and causing security issues.
I successfully used this new system to upload a new version of my tiny Keen 6 test level, after which I noticed that I forgot to add a way to mark the new version as recommended. So that's the next step.
Tuesday, July 3, 2018
Keen Modding Live - ZXC fix
Today while poking around the Keen Modding Live site, I found that Keen 1 and Keen 4 levels were completely failing to load when the keyboard preference was Z/X/C (as opposed to Ctrl/Alt/Space). The problem was that I had mistakenly kept the CTLPANEL/CONFIG file in the game folder while packaging those episodes. When the ZXC-enabled configuration file was injected, the DOSBox JavaScript thingy I'm using complained about a duplicate file and keeled over. Deleting extra files and repackaging fixed the problem.
Monday, July 2, 2018
Keen Modding Live - Cleaning up files
With Abiathar Live Studio effectively done, it's time to give Keen Modding Live an actual web site. The pages and scripts that are there made reference to several pages that are either blank placeholders or not there whatsoever. Apparently when I first started arranging things, I had plans for a "dashboard" page for logged-in users, distinct from the homepage. Now I think it would be nicer and simpler to just have a feed of recently published levels be the homepage for guests and members, with another feed showing up on the side for members' personal events. So I went through and cleaned up all the redirects to the nonexistent dashboard page.
Tuesday, June 19, 2018
Keen Modding Live - Untag permission adjustment
Today I realized it would be good for Keen Modding Live users to be able to remove tags they own from any levels, while still not being able to affix non-private tags to others' levels. This only matters for open tags that later close. I added a bit of logic to the "tag level" API to only do the level ownership check if trying to add the tag.
Wednesday, June 6, 2018
Keen Modding Live - Personal tags
I realized after implementing tagging yesterday that letting everyone affix arbitrary tags to everyone else's levels could conceivably go poorly. Attaching a normal tag now requires owning both the level and the tag; attaching an open tag still just requires owning the level. At creation, tags can be made "personal," in which case they can again be affixed by their owner to any level, but they will not be visible to any other non-admins.
Tuesday, June 5, 2018
Keen Modding Live - Tags
Today I made it possible to control whether a version newly published from Abiathar Live Studio becomes the official/suggested one. The "upload level" endpoint now has a parameter specifying whether to try to suggest the new version, which will only work if the version creator owns the level. When publishing a new version of an existing level, Abiathar Live Studio prompts for a version description and whether to try to suggest it.
For community level packs or compilations in general, it would be neat to have a way to tag levels. There are now API endpoints for creating, editing, and deleting tags, one to apply or remove a tag on a level, and one to get tag relationships by tag or level. Tag creators can mark the tags as open for submissions, in which case level owners can apply the tag to their own levels; otherwise, only the tag creator can apply the tag.
For community level packs or compilations in general, it would be neat to have a way to tag levels. There are now API endpoints for creating, editing, and deleting tags, one to apply or remove a tag on a level, and one to get tag relationships by tag or level. Tag creators can mark the tags as open for submissions, in which case level owners can apply the tag to their own levels; otherwise, only the tag creator can apply the tag.
Monday, June 4, 2018
Keen Modding Live - Search for levels
Today I implemented the Search Levels dialog, which allows selecting a level to clone/fork. It downloads information on all levels, then allows filtering them by title, episode, and zone. Once a level is selected, the program prompts for the specific version.
I adjusted the Level Properties dialog to allow changing which version is the current/suggested/official one.
I added a database field in the level versions table to store a description, like a commit comment. Currently there isn't a way in the UI to set it, but if present it is displayed in the version selector.
I adjusted the Level Properties dialog to allow changing which version is the current/suggested/official one.
I added a database field in the level versions table to store a description, like a commit comment. Currently there isn't a way in the UI to set it, but if present it is displayed in the version selector.
Sunday, June 3, 2018
Keen Modding Live - Preload static data
A lot of information in Keen Modding Live won't change very often at all, like the list of zones or of episodes. Previously, Abiathar Live Studio would contact the API endpoint every time that information was needed. Today I adjusted it to download all the effectively-static information just once at logon/startup. This allows a couple dialogs like New Live Level to open immediately instead of after an API request.
Subscribe to:
Posts (Atom)


