Adventure Creator feature discussion thread

Tips, techniques and tutorials about creation tools.

Re: Adventure Creator feature discussion thread

Postby tlaero » Mon, 16Apr11 01:06

I've spent a fair amount of time over the last few weeks trying to bolt single htm mode onto Adventure Creator. I've basically got it working, but I've come to the conclusion that the AC codebase has grown too organically from its initial humble beginnings. The concept of >1000 page games written in multiple languages just wasn't in my mindset when I started on this thing so many years ago. If you remember the first version, it let you place hit targets and then made you copy and paste the html into your editor.

I'm toying with the idea of going scorched earth with it and starting over. If I do that, I'll need to make AC bridge over to the new version, since I'll want to be able to convert my games to it and don't want to put support for all the old stuff into the new tool. We'll see.

At the moment, I've got to make sure I didn't totally break the old version...

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Adventure Creator feature discussion thread

Postby tlaero » Wed, 16Apr20 07:45

After a lot of investigation and playing around, I've decided that this is the format of games that future versions of AC will create.

http://www.mediafire.com/download/e57ol ... single.zip

This is a pretty large departure from what AC does now, and it's a large departure from what I had planned on keeping AC doing. Before I go into the changes, let me explain why I'm doing this.

Virtual Date With Keeley was around 200 pages. Redemption for Jessika was over 1300. BEW is over 1800. What made sense at the start of all this doesn't necessarily work anymore. The 1300 pages add up to like a megabyte of space, but they take forever to unzip. Uploading them takes a long time too. Filesystems don't do all that well with thousands of tiny files. Then, to make matters worse, I added localization to RfJ, with each language adding another 1300 pages. At this point, it takes a ridiculous amount of time to unzip it, and that was annoying me.

So I'm switching to storing the pages in two files instead of 2000. I know that I've said that I want to keep things simple for non-coders, and this hurts that. It's considerably harder to figure out what you did wrong in a single file situation than individual HTMs. But, at the same time, there aren't a lot of non-coders using AC anymore. I'm the primary user, Wolf and Kexter do their own thing with it, and I'd walk barefoot through broken glass to help Mortze. So we're pretty well covered. And as always, I'll help anyone here who has difficulty.

So, I set out to make AC read and write the above format. And, damn it, that codebase needs a mercy killing. The best architected code frays over time as you add stuff to it. And AC started as a quick hack that I didn't even architect very well. At this point, making it work at the scale that these games are becoming is just too complicated. I spent a while optimizing it, but it still takes 4-7 seconds to open gameView on RfJ, and opening and closing locView still crashes the app when it runs out of system handles. So I'm going to start over.

And while I'm starting over, I'm thinking boy, wouldn't it be nice to make it tight for one style, not try to cover all the old things? And, I've always been pissed at myself for screwing up the consistency of the functions in _functions.js (readVar and varPlus1? Really? And I didn't even capitalize them right.) So I thought, "Hey, if I'm going to break from tradition, why not make it clean?"

So here we are. Highlights:
1) One htm file (okay, 2, but who's counting?).
2) All non-text for the files in a single pages.js
3) All text for the game in text.en.js
4) Other languages in text.<loc>.js
5) AC will no longer write HTMs, so it doesn't need the HTM template anymore. Game developers are free to lay out the single htm file however they'd like. Or use the default one. Whatever you want to do.
6) _functions.js has been broken into two parts, engine.js and helpers.js. The idea being that the core engine just needs engine.js, but some of the other stuff that I use in my games is available in helpers.js.
7) AC will only be writing pages.js and text.<loc>.js. Most people will use the defaults, but if someone like Kexter wants to rewrite engine.js, it's not really going to get in the way of AC development.
8) Hit targets are percentage based, rather than pixel based. This means that, if you want, you can have the image scale to the browser window and the hit targets will work correctly. I still feel that it's important to have fixed sizes, because everything I've seen that tries to do it automatically does it wrong, but at least you'll have the option to change it now.
9) For people who want to do fixed sizes (like me) I simplified the way its done. You can have as many sizes as you want now, and they're based on numbers not words like "SuperDuperExtraLargeSize"

A few downsides:
1) Like I said, this format makes it much harder to debug issues. I'll be teaching you folks how to use the debugger built into various browsers, where before you could muddle through without it.
2) I've stripped out a number of things, including sound support. Overwhelmingly, people don't really want that in our games. Maybe I'll put it back in the future.
3) Wolf and Kexter, I'm currently not planning to do Page Comment support or subfolder support. Both things are doable, but you're pretty far down the path of using your own stuff. I'm guessing you're going to stick with the current AC and not switch to this. If you decide to move to this, we'll talk about me adding those features back in.
4) I changed readVar to "ReadVar" and "varPlus1" to "AddToVar." It makes me stop cringing when I see the code, but it means you've got to unlearn what you know and switch to the new functions (though I provided a few translation functions to ease the transition). I know that this is actually the part that will cause you pain, but, really it's better this way. (-:
5) I haven't actually started rewriting AC yet. So this is down the road a ways.

A few things I could use from you folks:
1) Since I'm starting over, is there anything about the basic AC game that we should change? I've written more HTML based erotic games than anyone, and I've never needed more than 3 says, for instance, but are you guys thinking, "I wish I had 4"? Etc.
2) While the above format works fine in IE, Chrome, and Firefox, there appears to be a race condition in Edge. If you click the says quickly the buttons stop working. (Easiest way to do it is go to the achievements and click "Next" rapidly.) Hitting F5 fixes the problem, but it kind of sucks. If anyone can think of a workaround for Edge, I'd love to hear it.
3) Is there anything fundamentally off with what I'm doing, such that I should change it now before I rewrite AC? Specifically I'm talking about the format of pages.js and text.en.js, but I'll listen to suggestions if you folks want to make them.

I plan to release a version of AC that can do some of the heavy lifting in translating an existing game into this new format. And I'll keep the last multi-html version of AC on Mediafire indefinitely if people hate the new format and want to stick with the tried and true. But future development will go into the new, not the old.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Adventure Creator feature discussion thread

Postby Mortze » Wed, 16Apr20 13:37

I've given it a try. I followed the test and everything worked out as instructed.
(there is a duplication of the word "above" at the page where we have to read 3 Tlaeros)

I won't say my opinion on the fact that you changed AC because I can't have any. Would someone ask me the difference between and Audi RS6 and a Porsche Carrera 4 I'd start making comments on the confort, design, space, and none on the engine, suspension, gear box, because I am clueless on those departments. But I blindly trust your insticts and expertise on this. It is your baby afterall.

My question is, where and how do I write the pages, insert picture, etc?

If I need to correct say page elsa23 how do I do it? With the previous AC I just had to open elsa32.htm in AC. How's it going to work now?

A small but simple tutorial like the one AC had could be very helpfull for the noobs that use this engine. Even if I'm the sole noob. [img]images/icones/icon18.gif[/img] [img]images/icones/icon18.gif[/img]
User avatar
Mortze
legend of the South Seas
 
Posts: 560
Joined: Wed, 14Oct29 02:34
sex: Masculine

Re: Adventure Creator feature discussion thread

Postby tlaero » Wed, 16Apr20 16:00

The actual interface is going to be really similar. You'll just open pages from game view instead of file->open. While the code in ac is a mess, I'm extremely productive with the interface. I don't plan to change what isn't broken.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Adventure Creator feature discussion thread

Postby Mortze » Wed, 16Apr20 21:16

Oh, my bad. I was under the impression that the Single file was the final product. Dumb me.
User avatar
Mortze
legend of the South Seas
 
Posts: 560
Joined: Wed, 14Oct29 02:34
sex: Masculine

Re: Adventure Creator feature discussion thread

Postby kexter » Wed, 16Apr20 23:04

Tlaero wrote:Wolf and kexter, I'm currently not planning to do Page Comment support or subfolder support. Both things are doable, but you're pretty far down the path of using your own stuff. I'm guessing you're going to stick with the current AC and not switch to this. If you decide to move to this, we'll talk about me adding those features back in.
Yeah, I'm pretty sure we are going to stick with the current version of AC, we are too far down on a different path with our own things to do this switch. I was against the subfolder stuff from the get-go, that's Wolfschadowe's baby, and even though I can see some benefits of it during development for our special case, I'm still not too fond of it. So I'd say, there's no need for it. Regarding the page comments, I don't think we actually used it for anything (yet). So, no tears lost there either.

Tlaero wrote:I changed readVar to "ReadVar" and "varPlus1" to "AddToVar."
A popular convention in js is to only capitalize constructors. If you look at the built-in functions/methods then you'll see that those are camelCase. So by this convention, these should be readVar() and addToVar() [or incVar()?].

Tlaero wrote:While the above format works fine in IE, Chrome, and Firefox, there appears to be a race condition in Edge. If you click the says quickly the buttons stop working.
Instead of setting the onclick attribute of the elements, try adding an event-handler to the element. So instead of el.onclick = "doStuff()"; try el.addEventListener("click", function () { doStuff(); }); - this might solve the above mentioned issue.

Tlaero wrote:Is there anything fundamentally off with what I'm doing, such that I should change it now before I rewrite AC?
I only have a few quick notes since I haven't had the time to look at your spec in-depth:
1) Not a big deal since it can be worked around, but your "text.*.js" spec doesn't support partial translations; US and UK specific locales for example which would only have small changes here and there; not requiring all text for all pages to be altered.
2) Still in the "text.*.js" files, the var gt* = "..."; stuff could grow out of control over time, spamming the global namespace. I'd do something like this:
Code: Select all
// This is defined in engine.js (which should dynamically load the locales in my opinion)
var strings = {};  // I'm not married to the name but couldn't come up with something better at the moment.

// Then in "text.en.js", the string could be defined as:
strings["CurrentScore"] = "Your current score is ";
strings["Need"] = ". You need ";
strings["ToOpen"] = " to open the door.";
strings["Earned"] = "You've earned ";
strings["OutOf"] = " out of ";
strings["Achievements"] = " Achievements.";

// An added bonus I see with this is that it looks similar to the `pts["_begin.htm"] = {}´ stuff, so it might be easier for translators - or not, I might be wrong.

3) Speaking of pts["_begin.htm"] = {}, I hope it's just an artifact of the conversion and the ".htm" extension will be gone in the final version.
4) All document.write() should be weeded out from the final product. An when I say should, I mean must. If you need help with this then I'm glad to help.
5) I'd do away with the href-stuff and would require all page jumps to be explicitly defined using GotoPage() or similar functions. My reasoning is twofold, on one hand it would save up screen space in the editor if there's only an onclick event to specify, and on the other hand it would be easier to add navigation related debug stuff. Also as I said above, I'd recommend switching to addEventListener() instead of setting the onclick attribute.
6) Just throwing this in for consideration:
Code: Select all
// Take the following:
pages["page4.htm"] = function (pt)
{
    SetTopText(pt.t);
    SetImage("files/images/animb.jpg");
    AddSay("say1_1", "#", "_begin.htm", pt.s[0]);
};

// I don't particularly like the `function (pt)´ part at the top. If you modify LoadPage() a bit then this can be reworked as:
pages["page4"] = function ()
{
    SetImage("files/images/animb.jpg");
    AddSay("say1_1", "#", "_begin");
};

// The modifications to LoadPage would look something like this:
function LoadPage(page)
{
    ClearPage();
    SaveCurrentPageName(page);
    pages[page]();
    SetPageText(page);  // <- This is the new stuff. Yet again, not married to the name.
    PerPageInit();
}

// And the pseudo-code for SetPageText() would be something like this:
function SetPageText(page) {
  var i,
    pt = pts[page],
    areas = document.getElementsByClassName("area"),  // <- This is truly just pseudo-code.
    says = document.getElementsByClassName("say"); // <- Same here too.
  SetTopText(typeof pt.t === "undefined" ? "" : pt.t);  // No need to explicitly define it for all pages in "pages.js".
  for (i = 0; i < areas.length && i < pt.a.length; i++) {
    areas[i].innerHTML = pt.a[i];
  }
  for (i = 0; i < says.length && i < pt.s.length; i++) {
    says[i].innerHTML = pt.s[i];
  }
}

7) AddSay("say1_1", "#", "_begin.htm", pt.s[0]); This could be further trimmed:
Code: Select all
// First the `pt.s[0]´ part could be removed, see 6)
// Then the "say1_1" is completely unnecessary, it is not required for styling or anything, so we are at:
AddSay("#", "_begin");
// If you merge the "href" and "onclick" stuff then this could become:
AddSay("GotoPage('begin')");
// Or better yet, if you use addEventListener, then it could be:
AddSay(function () { GotoPage("begin"); });

// The same also goes for AddArea().

8) The storage system could be reworked to store all data in a single cookie (or single localStorage entry). BEW has been storing all its data in a single entry, all game variables and all system variables are stored together. This means that technically readVar() can directly access the saves as well. You could check BEW's unified variable system for inspiration, if you haven't done so already.

I hope this is helpful.
@kextercius
User avatar
kexter
Moderator
 
Posts: 208
Joined: Sun, 13Dec29 11:01
sex: Masculine

Re: Adventure Creator feature discussion thread

Postby tlaero » Thu, 16Apr21 03:47

Thank you, Kexter. It's definitely helpful. I like some of your suggestions, and dislike some of the others, but I'll think about them all. You can probably tell I got a lot of inspiration for what I'm doing from BEW. I took what I liked there.

Page comments would certainly be easy to add, but I'll never use them, so if you folks don't switch to this, I'll leave them out. The subfolder stuff is much more ... invasive. If you folks go to this, we'll discuss it again.

Yeah, you definitely don't need to name pages "foo.htm" but I wrote that in normal AC and then converted it. I assume people working from scratch in the new thing wouldn't have .htm in their names.

To put it mildly, I'm not a fan of JavaScript casing and bracket conventions...

I'll play around with the event listener stuff this weekend. Thanks! The one thing that really concerns me about this transition is the current race problem.

My current thinking on locales is the reverse of what I'm currently doing. I currently start with a blank locale and have AC flag places where the text isn't in the translated side. I'm thinking that this time I'll start with the primary locale and have AC flag places where the text is identical. So it'll be pretty easy to do a UK version. That said, I don't think I'd ever have one of my games "translated" to UK. That's just not worth the time.

ACs not going to do anything with the gt stuff other than preserve it. Your suggestion is good. AC won't get in the way of using it.

I thought I got rid of all the document.write stuff. I'll go look through it again.

I swear I had a reason for the say1_1, but I'll go back and look at it.

I remember a single cookie being too small in the past. Maybe those browsers aren't used anymore, though. You've got a mechanism to output saves to a file that the user can take to another machine, don't you? I'd like to do that.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Adventure Creator feature discussion thread

Postby tlaero » Thu, 16Apr21 03:49

Mortze wrote:I was under the impression that the Single file was the final product.


Sorry I wasn't clear. Single.zip is what the output of AC will look like. The program itself will be really familiar to what you use today. It'll just hopefully be a lot faster and better written. (-:

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Adventure Creator feature discussion thread

Postby kexter » Thu, 16Apr21 08:49

tlaero wrote:I remember a single cookie being too small in the past. Maybe those browsers aren't used anymore, though.
IE and Edge don't have localStorage available for files accessed through the file:// protocol, so one has to revert to using document.cookie to store data. The limit for the length of document.cookie is around 4000 characters for IE/Edge. And that is the limit for all cookies combined. Also note that the names of the individual cookies take up space too. I'm actually entertaining the idea of utilizing some sort of compression for the saves (and all other stored data) for this reason.
@kextercius
User avatar
kexter
Moderator
 
Posts: 208
Joined: Sun, 13Dec29 11:01
sex: Masculine

Re: Adventure Creator feature discussion thread

Postby tlaero » Sun, 16May15 19:25

Just a quick update. I've decided to call the rewritten version of AdventureCreator "AC2", and I'm pretty far along with it. I've just about gotten back to parity with AC, and am using AC2 to write Finding Miranda. I've also been using a converted Redemption for Jessika to test perf, and the new version is nice and fast. It used to take 12 seconds to open GameView for RfJ. Now it takes under 3 (under 2 if you choose not to use bolds and italics and colors in GameView). And loading an alternate language used to take just short of forever and crash a lot. Now it's under 5 seconds total. I'm pretty happy with how things are turning out.

I'll keep working on it, and use development of Finding Miranda as a test bed. When I'm sure I've worked out the bugs and have time to write new tutorials, etc, I'll release the new version. I'll also release a final version of the original AC that helps you translate your game to AC2 if you so choose.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Adventure Creator feature discussion thread

Postby Mortze » Sun, 16May15 23:30

Good to hear all that. I'm glad you're excited and happy with your results.
User avatar
Mortze
legend of the South Seas
 
Posts: 560
Joined: Wed, 14Oct29 02:34
sex: Masculine

Re: Adventure Creator feature discussion thread

Postby tlaero » Thu, 16May26 05:12

tlaero wrote:2) While the above format works fine in IE, Chrome, and Firefox, there appears to be a race condition in Edge. If you click the says quickly the buttons stop working. (Easiest way to do it is go to the achievements and click "Next" rapidly.) Hitting F5 fixes the problem, but it kind of sucks. If anyone can think of a workaround for Edge, I'd love to hear it.


I got someone with a newer version of Edge to try this and the problem appears to be fixed. Yay! I suspect that the small number of people using Edge now are the type that will upgrade when the new version is released, so I'm going to stop worrying about this. That was my last big concern with this format. (Well, that and the one that Kexter just fixed for me in the other thread.) I've been writing Finding Miranda in AC2 and it's rocking for me. I also had John use it to translate a short story for me, and he gave me a lot of good feedback. It's coming along.

I assume no one is actually dying to use the new version, so I'll keep working with it and iron out any other issues I find before I release it.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

:(

Postby Niauropsaka » Thu, 16May26 05:52

You guys are making me sad that I've been away from HTML/JS for so long.
User avatar
Niauropsaka
lagoon predator
 
Posts: 144
Joined: Fri, 13Mar08 02:31
sex: Female

Re: Adventure Creator feature discussion thread

Postby tlaero » Tue, 16Nov01 01:37

I've now spent a bunch of months writing Finding Miranda in AC2, and it's working extremely well for me. A few simple things have just radically sped up my game development workflow.
1) Ctrl+N puts the cursor in the "name" box, making it easy to make a new page.
2) Ctrl+I takes applies the current image in ImageViewer to the page and moves ImageViewer to the next image.

With these two things, I blast out pages, never having to touch the mouse.

Another simple feature that makes my life easy is "Alt+Left Arrow" and "Alt+Right Arrow." That jumps to the next and previous page in the gameview. I use this when walking through a scene. Again, quick and easy way to switch between pages without using the mouse.

I wish I had thought of this stuff earlier. I don't think I could make a game in AC1 without this functionality now.

Anyway, I was wondering about a feature. Does anyone think I should add a "Recently games" list to the File Menu? The idea is that it would store the last 4 or so files you've opened so you can easily open what you want to work on. It kind of naturally opens the last one you were working on, so if people are focused on one game, this probably wouldn't help much. I'm toying with the idea because I tend to work on multiple things in parallel (Finding Miranda, various short stories, etc). I just added Drag and Drop for opening the game, and that may make me not care about a "recent" list, but I'm interested in hearing what other people think.

Of course, I may be the only person actively using AC2. If that's the case, I guess this doesn't matter. (-;

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1649
Joined: Thu, 09Jun04 23:00
sex: Female

Previous

Return to The workshop of creators

Who is online

Users browsing this forum: No registered users and 1 guest

eXTReMe Tracker