zzt on the web

NOTE: I HATE A LOT OF YOUR ZZT GAMES, SO WATCH OUT!

Moderators: Commodore, Zenith Nadir

steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

zzt on the web

Post by steveg22 »

a while ago i noticed a github repository, someone actually tried to make a zzt clone on the web that was also...an MMO. i dont know what the purpose was for that, but the fact it was mostly written in javascript got my attention. then i saw how he was handling the zzt levels and i was like...uhhhh. no

basically he was converting the zzt world file into something javascript compatible. which is ok, and understandable considering javascripts lame lack of support for handling binary streams in some sort of intelligent way

but recently i came across a nice little library that takes advantage of the canvas abilities almost every browser on the planet supports now, and it is safe to say most modern browsers CAN handle binary formats, in javascript, pretty easily. getbyte, getint16, 32, float, etc..all handled very nicely and...i can load a zzt file via ajax request, parse it and display a board very properly on a webpage ;) already got world, board and stats records going, tile data looks perfect (couple glitches here and there, still working on the element list), terminal emulation looks fantastic too, and seems to run pretty quick considering im on a laptop. will have to test on a mobile device, see how an ipad handles the screen ;) its a 540x400 pixel area, so most portables/mobile devices should have no problems rendering this

so i ask this: would it be worthwhile to see a wonderful clone of the most awesome game ever made, running on a webpage? complete with ascii graphical wonkiness? and that it can load a proper .zzt file unmodified without any conversion process in between? the only thing i dont know how to do is handle the play commands, and im considering superzzt support...but...lets slow down and get the basics down first ;)

github or it never happened: https://github.com/MaudDibb/zzt-js

the codebase right now is strictly load a world and show boards. you can navigate the screens with buttons and see all the boards in a world, see some things are moving, but not much else. currently you should be able to grab the code, load index.html in your browser and hit one of the 4 world buttons on top, and you should see the title screen of the world. use the prev/next buttons to move between boards. you will need a web server (just something to serve files, other languages/databases not needed) and an alias to the directory you installed the files to so the directory where the file index.html is in is the document root

things working right now:

loading and parsing of world, board and stats records
displaying of all zzt elements (lines are properly connected, on edges and to adjacent neighbors)
conveyors and spinning guns are spinning
blink walls and rays doing their thing
transporters play their proper character sequences based on their direction
scrolls flashing their awesome color sequences
timing seems to be correct based on what i see in the original ZZT in DosBox
terminal emulation with blink attributes, water blinks!
Last edited by steveg22 on Mon Aug 11, 2014 3:30 am, edited 4 times in total.
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

apparently javascript can run the pc speaker just like the old days...gonna have to work on my chiptuning ;)
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: zzt on the web

Post by Commodore »

Yes, Yes and more Yes. Ideally it should open zip files to a temporary folder so it could be attached to the archive. Getting super-serious, integrated with PHP, z2 users could have their own folder where they could edit and store their own worlds.

But cloning ZZT is a rabbit-hole, it looks simple on the surface, but some the the object behaviours are not so intuitive (centipedes!), and since some games take advantage of bugs (black holes), the original bugs have to be maintained.

He is another attempt: viewtopic.php?f=9&t=3320

peek at the code here: https://github.com/SaxxonPike/Roton/
*POW* *CLANK* *PING*
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

Thanks for the links, will give a view when I get off work. Ya I know some of the 'behaviors' some of the objects have, not my first try at this. I have the mystical winds encyclopedia on hand to help me out with the dirty details. As for zips, I will have to play with that. For now I want to keep this simple, perhaps if I find a host wiling to let me share a few gigs I could php a front end and just upload files to play. We shall see.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: zzt on the web

Post by Commodore »

Some time ago I remember someone saying PHP (or maybe MySQL) could open zips. Anyhow, here's more file format info, not sure how up-to-date MW's is:

http://zzt.org/zu/wiki/File_Format
http://www.shikadi.net/moddingwiki/ZZT_Format

If you get something workable we can host it here, but would it really need a few gigs?
*POW* *CLANK* *PING*
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

well not really. id assume people would want to upload files. i was hoping to do one better: this site already has a massive collection. how hard would it be to access that collection so all my app had to do was connect, authenticate, download and play...all without ever touching your hard drive. its kinda the point of the project...to be able to download a zzt file directly into your browser and playing it right then and there. no plugins, no crazy flags or setups. just hit the button and go.

i understand the zip part, most files are zipped. php can handle that easily, i can write php in my sleep. but i wasnt going for a backend. i just wanted to directly load a zzt file and go.

i guess somewhere down the road we could work something out. lots of stuff to do in the meantime. ;)
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

man im going crazy trying to find info on this....

everywhere i see the word 'cycle'...what exactly is a cycle? how is it measured in time? i cant find a single note anywhere mentioning how fast things get updated inside zzt

for now, ill assume tim used the old timer interrupts used in old pcs back them, which ticked about 18 times a second (18.2 to be exact..trying to go from experience messing around with that in the old vga days ;)
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: zzt on the web

Post by Commodore »

saxxon wrote:I'm putting in an INT 21h service provider class. Am I working on too low of a level? :x I figured out ZZT's actual timing mechanism and it relies on constantly calling INT 21h,2C to query the system time in 100ths of a second.
*POW* *CLANK* *PING*
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

heh i figured he was doing something off the dos interrupts, which were based on the 18.2 tick timer i mentioned earlier ;) i saw a few youtube vids, the timing im doing now looks perfect...good enough to get a few tiles animated already ;)
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: zzt on the web

Post by Commodore »

Also I think (don't quote me on this) the cycles are like counters. Each main loop the cycle is decremented, and if = 0, the object's code (or where ever it was in the code when it last stopped) is executed. So cycle 1 objects run every time the board is updated, and cycle 2 objects every other time, etc.
*POW* *CLANK* *PING*
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

oh hoh...i might be going too fast then. see the logic i assumed is: use a value in the objects stats to track the counter. like p3 for a spinning gun. initially its at 0, increment on tick. if p3 > cycle, set p3 to 0, do something (like spin the gun) and resume...so far transporters and spinning guns look great doing this...but i might be going too fast, or im not timing it right. im using javascripts setInterval at 1000/18.2 delay (which is something like 55 millisecs) and that seems to do allright. i have to get dosbox set up and run the actual game...its been a while since ive actually ran zzt, but this just looks right...i guess ill find out later when bullets, ai's and oop come to life
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

ok. timing i *think* is good now...i believe a cycle was a 10th of a second, which lines up pretty nicely with what im seeing in true zzt.

conveyors, duplicators, transporters, spinning guns all animated now...blink walls next

cleaned up the code something fierce, using a hex code -> tile reference list so the case statements use proper names, not hardcoded hex values. javascript just introduced a const, so not many browsers support it yet. ;)

ill give the code some more readability as i go, i just want to get things done
User avatar
bitbot
Official Clamp School Defender
Posts: 328
Joined: Thu Mar 01, 2012 3:00 am
Location: earthbound
Contact:

Re: zzt on the web

Post by bitbot »

Sounds cool! Though, we oughta pickup where Sweeney left off...
Beyond ZZT

Tell me about Super ZZT. Were there any improvements in the engine that were substantial over ZZT?

Tim Sweeney: Super ZZT was the same basic engine, but I extended it to scroll, so now you had these boards that were -- I don't remember the size -- several thousand by several thousand, so you could go for several boards at a time just scrolling smoothly through the environment.

I thought that was a big improvement. It was kind of the ideal I was heading for. I really love the Ultima style of game where you had this expansive, seemingly-limitless landscape that you can go through.

But I never really got to that point with Super ZZT. I had this idea from the very beginning that it was going to be a streaming game world, where you could have unlimited board sizes -- you know, millions by millions if wanted -- and it would just load parts of it on demand as you go through. But I was constrained for time. I wanted to ship something, and be able to release a lot of games, so I didn't put the effort into it.

The other thing I would have really loved to do but just didn't have the time for was make it a BBS-based game, so ideally, you could have a bunch of users dialing in and playing together, each user moving independently.

I always wished for a multi-user ZZT -- like a MUD where you could build stuff in ASCII graphics and just have other people interact through that.

Tim Sweeney: Yeah, even better: keep it live, right? You'd be able to build things in the MMO environment while people are playing through it.

While they're playing, yeah, just like on MUSHes. I don't know if you've ever been on MUDs or variants of them where you can program in a "softcode" -- a language written within the language.

Tim Sweeney: I saw a MUD in the late 1980s at one point, and it was astonishing to me. I'd never had any idea that you could create a multiplayer game like that with lots of players playing together -- and this one probably had 10 or 20 playing together at a time. It was just astonishingly cool.

From that point on, I could kind of envision the whole massively-multiplayer game idea -- it was obvious that you could take those techniques and extend them to graphical games and, wherever gameplay and graphics went, you could bring that whole concept forward. So I always wanted to do that -- to create a large-scale multiplayer game. That's another thing that I've always wanted to do but haven't ever actually gotten to.
Image Image
steveg22
newcomer
Posts: 12
Joined: Mon Aug 04, 2014 5:57 pm

Re: zzt on the web

Post by steveg22 »

hehe. sounds like he was trying to go for minecraft. in text mode graphics ;)

which *could* be possible, but i dont know if i want to get that crazy with it

ok lets put it this way. i either make a zzt that runs in a webpage with zzt files, unmodified. or i try going that way, get a server going, and see if we can make a zzcraft or something. minecraft is surprisingly very similar to this if you do the adventure mode maps...spawned mobs, keys, locked chests/doors, treasure, rewards for questing, etc. all while doing this with a pack of people you know, in realtime. and with some clever mods, anythings possible.

my vision was to take zzt to the web, then possibly taking the old ascii engine and somehow/someday adding something more modern to it, like tiled graphics (like nes/snes tiled video modes) and turn it into a proper rpg/adventure map engine.

tell me your thoughts.
User avatar
bitbot
Official Clamp School Defender
Posts: 328
Joined: Thu Mar 01, 2012 3:00 am
Location: earthbound
Contact:

Re: zzt on the web

Post by bitbot »

steveg22 wrote: ok lets put it this way. i either make a zzt that runs in a webpage with zzt files, unmodified. or i try going that way, get a server going, and see if we can make a zzcraft or something.
Keep it pure. ZZT on the web.

The Roton library is pretty accurate thought not warm and fuzzy like real DOS. Not even Dosbox captures the experience. I'm happily editing on an actual 486 machine now.

#ZAP took the other route but its relationship to ZZT is merely superficial IMHO. Still, there must be a way to bridge the gap.

KVance was working on a Javascript ZZT which looked promising, but it never panned out. :(
https://www.youtube.com/watch?v=-k8v6Q1rHIw
Image Image
Post Reply