3D ZZT tribute project

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

Moderators: Commodore, Zenith Nadir

Mushy-pea
newcomer
Posts: 3
Joined: Sun Jul 10, 2016 5:48 pm

3D ZZT tribute project

Post by Mushy-pea »

Hi. Late last year I started work on a home brew game, writing a 3D graphics and logic engine using Haskell and OpenGL. I decided it would be a cool idea to loosely theme the game play around some of the key elements of ZZT, namely hard puzzles, combat, gems, ammo, torches etc. There could also be a white, cuboid smiley face running around. This line of thought led me to a working title of Game :: Dangerous (a tribute to ZZT).

This is a non - commercial project for which I will release the source code. So far I have implemented basic graphics (objects with textures), physics (running, jumping, gravity and friction) and programmable game logic. The latter consists of a low level interpreted language used to update game state on a per frame basis, which I call Game Programmable Logic Controller (GPLC). I have built player activated devices like lifts, doors and keys with this. It should be possible to build complex puzzles like those found in ZZT. I also have a makeshift tool chain for building game environments. The next major steps planned are the addition of lighting effects, non - player characters and sound.

If you think all this sounds like sacrilege, well...what can I say? Otherwise, I would be interested to hear from anyone who'd like to contribute to the project (or just play the game). Areas where help would be particularly useful are:

1. Working on an end user oriented map editor, like in ZZT. This could include adapting ZZT-OOP to the new engine's abilities and writing a compiler to transform this into GPLC.

2. Building and testing maps to be released with the game.

I'm an enthusiast developer taking on these challenges for the first time, so needless to say the level of sophistication I'm aiming for is pretty low compared to modern studio produced games. I should stress that anyone interested wouldn't have to be proficient in Haskell, as I intend to produce generic specification documents for the engine and a map editor could be written in a different language anyway.

Hope to hear your thoughts.

Steven
User avatar
Smilymzx
I hope she made lotsa spaghetti!
Posts: 182
Joined: Sat May 20, 2006 2:58 am
Location: LocacoLocacoL :LoL!

Re: 3D ZZT tribute project

Post by Smilymzx »

Sounds nice, A few Q's though:

-Will it need a 3D editor like Blender for graphics? If so, There will be trouble using it (as in: not easy)...
-Will it be based off Epic's Unreal Engine? (ZZT already inspired that game to exist, including the peculiar file formats)
-Is the characters 3D graphics are based off cubes with ASCII characters slapped into them?
-Did (if not, Will) you add modes for these?:
  • Font Editor (for Text only)
    Texture editor (for Objects and Built-ins other than text)
    Custom Shape Import/Export
    Transparency effect Editor
    Palette Editor
    Shading
    ...And more yet to be listed.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: 3D ZZT tribute project

Post by Commodore »

Cool project. Like smzx, I too am wondering what the game looks like. Does it take the tile based approach into 3D, (like cubes or voxels) or can things be placed anywhere in space?

Post a screen-cap if you can.
*POW* *CLANK* *PING*
Mushy-pea
newcomer
Posts: 3
Joined: Sun Jul 10, 2016 5:48 pm

Re: 3D ZZT tribute project

Post by Mushy-pea »

All important questions; I didn't want to go over the top with a load of technical data in the first post. I have written my own engine from scratch, apart from using some Haskell libraries for things like common data structures and bindings to OpenGL. This uses grid cube space partitioning and ray tracing for visible surface determination. The current environment state is held in three data structures, each of which is a three dimensional array whose elements correspond to the grid cubes that environments are partitioned into. To summarise, these have the following names and functions:

Wall grid: This contains information used by the ray tracing algorithm to determine lines of sight, as well as the positions of all objects for rendering purposes. Also, detecting collisions with walls is dependent on this structure.

Floor grid: This contains a description of each floor tile, namely what height it is at and whether it is flat, absent (i.e. a hole in the floor / ceiling) or one of four possible types of ramp.

Object grid: This contains information used for detecting collisions with all other objects (i.e. other than walls), as well as the GPLC programs that control dynamic objects. It will later be used as part of the non – player character system.

The engine has its own map file format (currently in text form) that is read at initialisation time to generate these three structures. Currently it uses a simplified form of the OBJ file format for object rendering, which just has vertices and texture coordinates. This will be replaced with standard OBJ file importation in the next graphical update, allowing Blender or similar software to be added to the tool chain. Although the Wall grid structure has 12 data fields for each array element, five of these only depend on the position of the associated cube in the environment. One is used to avoid double rendering and just needs to be a unique integer.

So, I've written some code that transforms data of the form found in the attached file to the wall grid section of a map file. Each block of six characters is transformed to map file data describing the correspondingly positioned cube in game space and this spatial match up makes it human readable enough for me (at least) to build environments with. Something similar is done for the other data structures and I've also built an assembler to convert GPLC “assembly code” into the list of integers the engine actually interprets. The tool chain I aim to have soon is this map building program combined with Blender for generating objects and textures. As for non – player characters I am aiming for basic animation of objects, but if this proves too difficult to achieve in my intended time frame I may go for sprites.

Though I think this will function well enough for developers, I think it would be in the spirit of the original ZZT to have a user oriented map editor. This could be a GUI based application someone could use to put together various pre – made (or user made) objects and characters into a level. Ideally it would be possible to write game logic in something similar to ZZT-OOP and have this transformed to GPLC code. So, essentially the editor would need to convert user input to an intermediate form that my existing code could convert to map files. Obviously this is easier said than done and at the moment all my available time is going into building the engine. You can have a look at a pre – alpha demo via the link below; minimal work has gone into the objects and textures as I'm still at proof of principle stage.

http://plays.tv/video/578413e56a2b3d05b ... us-engine-

Steven

P.S. I tried to attach a file but it didn't work so the content is posted below:

Wall grid pre - map data:

x axis ->

k11111 i11111 i11111 i11111 i11111 i11111 i11111 i11111 i11111 j11111 a11111 a11111 y axis
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111 |
c11111 b11111 c1111c b1111c c11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111 |
c11111 b11111 c1111c b1111c c11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111 |
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111 |
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11110 a11110 a11111 a11111 a11111 a11111 a11111 a11111
g11111 a11111 e11111 e11111 e11110 e11110 e11111 e11111 e11111 f11111 a11111 a11111
k11111 a11111 i11111 i11111 i11111 i11111 i11111 i11111 i11111 j11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
c11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 b11111 a11111 a11111
g11111 e11111 e11111 e11111 e11111 e11111 e11111 e11111 e11111 f11111 a11111 a11111
a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111
a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111 a11111

The z - axis corresponds to multiple layers of the above grid structure.

GPLC assembly code for a lift activated by player pressing switch program:

bot 0 top 240 pos 240 sig2 2 sig3 3 sig4 4
w0 0 w1 -1 u0 8 v0 4 u1 9 v1 5
sw_u 9 sw_v 1
open 1 closed 3 open_ 0 closed_ 2
h 3 not_abs 0 down_step -4167 up_step 4167
fl_u 4 fl_v 2 no_op -1
~
1 0 33
2 33 36
3 69 59
4 128 37
x
if 0 pos top 2 25
place_hold no_op
chg_obj_type closed w0 u0 v0
chg_obj_type closed_ w0 u0 v1
chg_obj_type closed_ w0 u1 v0
chg_obj_type closed_ w0 u1 v1
send_signal sig4 w0 u0 v0
if 0 pos top 5 25
send_signal sig3 w0 u0 v0
chg_obj_type closed w0 u0 v0
chg_obj_type closed_ w0 u1 v0
chg_obj_type closed_ w0 u0 v1
chg_obj_type closed_ w0 u1 v1
send_signal sig4 w0 u0 v0
if 0 pos bot 25 28
chg_obj_type open w0 u0 v0
chg_obj_type open_ w0 u0 v1
chg_obj_type open_ w0 u1 v0
chg_obj_type open_ w0 u1 v1
send_signal sig2 w0 sw_u sw_v
chg_state h not_abs down_step w1 u0 v0
chg_floor bot not_abs down_step w0 fl_u fl_v
chg_value pos 0 -1 w0 u0 v0
place_hold pos
send_signal sig3 w0 u0 v0
if 0 pos top 5 26
send_signal sig2 w0 sw_u sw_v
chg_state h not_abs up_step w1 u0 v0
chg_floor bot not_abs up_step w0 fl_u fl_v
chg_value pos 0 1 w0 u0 v0
send_signal sig4 w0 u0 v0
Mushy-pea
newcomer
Posts: 3
Joined: Sun Jul 10, 2016 5:48 pm

Re: 3D ZZT tribute project

Post by Mushy-pea »

To answer your question Commodore, it is a bit of both. The rendering part of the engine runs a ray tracing algorithm each frame to determine which grid squares (in each vertical level) are within line of sight. Each grid square is represented by an array element that contains the coordinates used to transform up to two models from model space to world space. Objects can therefore appear anywhere but one needs to be careful that their data is in the right grid squares(s), to avoid objects popping in and out of existence at the wrong moments.

Steven
User avatar
bitbot
Official Clamp School Defender
Posts: 328
Joined: Thu Mar 01, 2012 3:00 am
Location: earthbound
Contact:

Re: 3D ZZT tribute project

Post by bitbot »

Image
Image Image
User avatar
Mushy-pea2
newcomer
Posts: 13
Joined: Thu Dec 22, 2016 4:26 pm

Re: 3D ZZT tribute project

Post by Mushy-pea2 »

Hey. Sorry about the double user naming, but I forgot my password and the reset system appears broken. Anyway, I just wanted to let people know I'm still pressing on with my game project and am hoping to release a playable alpha version in Q1 next year. This will include an opening level / region intended to appear in the full game. There will be the option of third person mode so you'll be able to see the 3D smiley guy running around (in as much as an irregular cuboid with no legs can be said to run). Initially there will be releases for Windows x64 and 32bit, with openGL 3.3 required.

Since the last post I've added lighting effects, as well as further game logic such as object / character interaction menus. Also, I now have a tool chain that allows me to build 3D models in Blender and (using OBJ files) import these as game content. The major features yet to be implemented are the real time side of non - player characters (ie enemies / combat) and game saving. I still intend to make an end user friendly map editor, in keeping with the concept of ZZT. For now all my available time is going into the engine and content.

So, as there was some interest shown in the first post I just thought I'd pop back and say I'm determined to press the launch button on this.

Steven
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: 3D ZZT tribute project

Post by Commodore »

Good luck with this!
*POW* *CLANK* *PING*
User avatar
superbowl shuffle
Official Clamp School Defender
Posts: 418
Joined: Mon Apr 07, 2003 4:52 am
Location: CAsE SenSiTiVe

Re: 3D ZZT tribute project

Post by superbowl shuffle »

So, in theory, could existing ZZT games be run on it?

It would be a lot of work and the result would be a mess -- you wouldn't be able to capture any of the faux 3D that ZZT authors have been using since the 90s.

Still, the idea of capturing the creativity and enthusiasm of these games and transferring them to a new engine is an intriguing idea.
[size=75:lh51rn9h][b:lh51rn9h]When the 5 o'clock whistle blows, so do I.[/b:lh51rn9h]
[/size:lh51rn9h]
User avatar
Mushy-pea2
newcomer
Posts: 13
Joined: Thu Dec 22, 2016 4:26 pm

Re: 3D ZZT tribute project

Post by Mushy-pea2 »

Well, only in the sense that someone could build maps for this engine that attempted to imitate the design elements of existing ZZT boards. As for the results, I imagine it might be a bit like the part in the book Flatland where A. Square finds his 2D self in a 3D world. If you haven't read it I would highly recommend it by the way. I think when designing a 3D environment you need to think about it in three dimensions throughout the process and that trying to port 2D boards to 3D maps would indeed result in a mess. I haven't actually played ZZT for years; my sister and I used to make nigh on impossible to complete boards for each other as a challenge. What drew me to the idea of attempting a [kind of] remake was the deceptive simplicity of the original. The controls are basic, you just have the one weapon and the gems, torches and keys, but the game logic allowed for complex puzzles and annoyingly hard action sections. Without wanting to give too much away, it is this essence of ZZT I'm trying to capture. To give you an idea though, I will say that there will be fully dark sections that you could get lost in if you run out of torches. Centipedes will definitely make an appearance as well. :)
User avatar
Mushy-pea2
newcomer
Posts: 13
Joined: Thu Dec 22, 2016 4:26 pm

Re: 3D ZZT tribute project

Post by Mushy-pea2 »

Hello again. I've decided to use Github to host my project; the address is github.com/Mushy-pea/Game-Dangerous. At the moment there's just a snapshot of the current code base (engine and tool chain components). Still, if you're interested in this kind of thing feel free to have a look. The metric tonne of complexity you'll find (from my point of view at least) is partly why I may not meet the self imposed deadline I was hoping to. Anyway, this is where a release will appear at some point, so I'll keep you posted. Keep it real.

Steven
User avatar
Mushy-pea2
newcomer
Posts: 13
Joined: Thu Dec 22, 2016 4:26 pm

Re: 3D ZZT tribute project

Post by Mushy-pea2 »

Hi. Hopefully people are having some wholesome long Easter weekend fun (if you have such a weekend in your locale). I'm into the final stages of the engine build part of my game project. At least, that's what I'm telling myself to help me keep going. The only major feature I've not made a start on is sound. Having considered a few options I've settled on the idea of trying to replicate the original PC system speaker sound effects of ZZT (i.e. the sounds triggered when picking up gems or torches, firing etc that appear to be inherent to the original engine). I'm also planning to add some of my own less retro sounding ones. I've found that ZZT Ultra achieves this flawlessly. I would be grateful if anyone could give me some pointers on the following.

1. If data for the original material is available somewhere.
2. If there is any enduring copyright.

By the way, after many revolutions the cat on the record turntable animated smiley has stopped rotating. Thanks.

Steven
User avatar
Appetite4
Official Clamp School Defender
Posts: 204
Joined: Tue Nov 18, 2014 4:57 am
Contact:

Re: Sounds

Post by Appetite4 »

Mushy-pea2 wrote:1. If data for the original material is available somewhere.
2. If there is any enduring copyright.
Chris here, designer of ZZT Ultra and The Hall of Music.

I'm pretty sure you won't need to worry about #2. I recorded DosBox samples for the drum sounds and key frequencies. No one owns the PC speaker effects; they'd fall under fair use. While the drum sounds might be technically a grey area, good luck to anyone trying to actually litigate it. The point is, no one would. Take 'em; they're yours.

As for #1, this depends on what you're looking for. The built-in sound effect note sequences are accounted for, leaving just the tone and drum generation code. I'm guessing there are three different ways to answer this question.

1) Generating a note using actual PC speaker hardware ports is simple enough. Use this to set a tone, where countnum is 1193180.0 / NoteFrequency.

outp(0x43, 0xB6);
outp(0x42, (unsigned char)(countnum & 255));
outp(0x42, (unsigned char)(countnum >> 8));

Speaker can be turned on and off using this (lower 2 bits control onOrOff switch; 0=off, 3=on).

outp(0x61, (inp(0x61) & ~3 | onOrOff));

2) The ZZT Ultra project on GitHub has its own samples embedded within the .fla file. Extracting them without at least Flash CS4 might be tricky, but if it's a one-shot deal, a demo 30-day version of Animate CC would work. I'm not attached to the samples; go ahead and use 'em.

3) If you're really determined to generate the drum sounds on your own, check out Roton, which was built from reverse-engineering. I'm not sure if this project has the original drum sound loop code in place, but if it does, you'll be all set. I was fortunate enough to find and work with the sound FX loop code from the original Kroz series, so I know it can be done, with some patience and a decent emulator.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: 3D ZZT tribute project

Post by Commodore »

I mean it's just a square wave right? Can't it be faked?
Attachments
videotogif_2017.04.17_16.10.28.gif
*POW* *CLANK* *PING*
User avatar
Mushy-pea2
newcomer
Posts: 13
Joined: Thu Dec 22, 2016 4:26 pm

Re: 3D ZZT tribute project

Post by Mushy-pea2 »

Hi Chris. Thanks for your input on this. It's occurred to me I could use your Hall of Music app with the #PLAY sequences for certain effects and do a sound card capture on them. I'm only intending to use a strategic subset. For one thing, while certain sounds such as OPENDOOR seem reasonable in the discreet move - by - move ZZT world, a door opening in a 3D world would work better with a more progressive noise like the whir you get when opening doors in Doom. For these kinds of sounds I'm going to attempt my own DIY approach and in the end I should have a set of samples that can all be plugged into a single module of code. Cool project by the way; I hadn't realised until I found this forum that a big mod scene had grown around ZZT since I last played it at about age 12. So yeah, appreciate your assistance.
Post Reply