Randomized maze - now with graphical map!

Hi there, my name is Diego and I am new to the forum. I discovered Choicescript recently, and I am having a blast.

I am trying to find examples of CS pushed to the limit. Here for instance, I have a page that generates a random maze and lets you play it. Note you must change the font to monospace with Chrome dev tools, because I cannot change style.css on dashingdon.com

https://dashingdon.com/play/sciscidiego/randomized-maze/mygame/

Startup.txt is generated with Python, but the randomization runs in CS. I’ll be happy to share the source if anybody is interested.

  • Can anybody point me to other advanced examples of CS?

  • How could I improve the rendering? It looks like my options are very limited.

  • I have a different script that precomputes step-by-step (graphic) maps of a hardwired maze, but I’d love if the maze were different every time.

Thanks all!

PS big kudos to Dashingdon for hosting the games! Can I submit feature requests and/or contribute them?

12 Likes

First of all, welcome! Secondly, és brasileiro? :joy:

It’s cool to see people pushing the limits of CS. I wrote a python script to generate an inventory system in CS for me.

I don’t understand your maze though. What do the commas and the hashtags stand for?

Also, you should consider that the game would run on different screen sizes, so this might phunk your maze. Besides the typeface.

Edit:
It just occurred to me that instead of common characters, you could use unicode characters with predefined lengths like:
Unicode 2588 (black block): █
Unicode 2001 (empty char). This is not the same as simple whitespace! Unfortunately, it seems Discourse converts empty characters into whitespace. So it won’t show here.


You can discuss DashingDon in its own thread:

And to contribute with features I think you would have to talk with @dashingdon.

2 Likes

Thanks for the warm welcome! I am Italian, but the name is misleading!

That was clearly a proof of concept, but the idea is that the maze should look like a map from above. Unfortunately it’s tricky to get a nice rendering using only text. The Unicode trick helps (thanks!), but you still need to change the font to monospace - and the line height introduces vertical breaks.

As I mentioned, for a real game I would precompute a bunch of images of the map, but in that case the maze would never change.

I’d love to see you what you did with the inventory. Can you point me to your games and maybe share the script?

1 Like

Hey, cool! I’m one-fourth Italian myself, but I never learned to speak it though.

I haven’t put anything out there yet. The inventory system was for a previous project. I finally abandoned it because it was too pretentious and I got overwhelmed. I might pick it up again someday, who knows.

I don’t think I have the script anymore. But it was very simple, it just declared all the variables for me, so I wouldn’t have to write it all down by myself. Something like this (I’m writing from the top of my head):

with open ('inventory.txt', 'w') as file:
      file.write('*comment INVENTORY')
      for i in range (1, 101):
            file.write('\n\n')
            file.write(f'\n*create slot_{i} false')
            file.write(f'\n*create slot_{i}_equiped false')
            file.write(f'\n*create slot_{i}_name')
            file.write(f'\n*create slot_{i}_type')
            file.write(f'\n*create slot_{i}_size')
            file.write(f'\n*create slot_{i}_weight')
            file.write(f'\n*create slot_{i}_value')
            file.write(f'\n*create slot_{i}_buff')

Then I would just copy the generated text to the startup file.


Also, I don’t know JavaScript that much, but I think that if you add this line to the the page where you render the maze it should do the trick. Note that CoG don’t like games that use the *script statement, so that’s something you should keep in mind if you plan on eventually publishing through them.

*script document.getElementById("text").style.lineHeight  = 0.2; document.getElementById("text").style.fontFamily = monospace;

I would say Missing Wings is one of those published games that pushes the engine to the limit. It has a simple managing sim, a similar maze escape thing, a logic-gate kind of puzzle, and many other puzzles (12, IIRC?).

3 Likes

Hi all, thanks for the tips and for sharing your code. The script command opens a whole new realm of possibilities. Here is the updated maze, with better layout and interactivity!

https://dashingdon.com/play/sciscidiego/randomized-maze/mygame/

Missing Wings seems very nice. I just started. The only mini-game I found so far is Nice Dice, which is a very simple comparison of two random numbers. Do they also have a full maze in it? I’d be curious to see it.

PS what is a “managing sim”?

1 Like

I’m not sure timing choices is a good idea in this case.

I haven’t played Missing Wings, but Managing Simulators usually refers to managing resources.

1 Like

Whohoo, it worked for me this time! Really REALLY cool to see what can be done with this.

2 Likes

Managing simulator refers to a genre that focuses on production, management, and efficiency. Games like Factorio, Cookie Clicker (this one leans more on idle-clicker), Automation Empire, Rimworld (this one is more on the survival), and recent EAccess Satisfactory (play with me I’m lonely anti-social weeb).

Btw, the timer seems inconsistent. I get a series of rapid brrt on my movement; can’t even click on my preferred option.

1 Like

My favourite ‘Look at what ChoiceScript can do’ game has to be Lunchtime at St. Expeditus by @aetheria (although I don’t believe they’re active anymore). It basically turns the CS interpreter into something more akin to a Visual Novel.

But I think @cup_half_empty has the right of it:

I finally abandoned it because it was too pretentious and I got overwhelmed.

You have to stop and ask yourself, why am I using ChoiceScript? If I’m spending more time writing Python utilities, or hacking around ChoiceScript’s interpreter, than I am writing my game. What’s the point? You may as well go and code your own engine/interpreter.

Note that I’m not trying to dissuade people from experimenting. I’m just encouraging people to be realistic, and I’m speaking from experience… Some of the stuff I’ve left by the wayside:

  • “Hello World” – Computer terminal style simulator, with ‘runnable apps’, including an email system
  • “Choice of Friends” – A IF novel that takes place ‘on’ a Social Networking Website
  • A Piracy simulator with real-world economy (growing towns/shifting allegiances)
  • Full inventory system with armour classifications and equip/un-equip UI
  • The infamous Tale With No End: Terminal: A Tale about an End

Pictures etc.

Hello World
https://www.youtube.com/watch?v=Yi-WuYbplRE

Choice of Friends

Inventory System

And, here’s the kicker: I have 0 released games to show for it :confused:

5 Likes

This looks pretty cool, though.

1 Like

Hi all. Thanks so much for your comments - it’s really nice to get so much feedback right on my first post!

@CJW ‘Lunchtime’ is really beautiful, but I believe the core CS engine was heavily modified, right? I don’t think you can do all that stuff right out of the box. Mine is a just a fun challenge - what can be done without hacking the engine?

So, here is the updated version of my maze. (LINK IN THE FIRST POST)

New features:

  • an advanced AI (?) driving an enemy in the maze
  • autoplay can be turned on-off
  • to avoid inconsistent events (@Szaal) the “next” button is disabled in autoplay
  • consistent directions (blocked directions are not hidden) so you can learn to navigate using the access keys 1-4

I am using a few script commands, which are in a sense modifications to the engine, but they are very limited.

--- Styling, because style.css is not supported in Dashingdon

*script document.getElementById("text").style.lineHeight  = 1; 
*script document.getElementById("text").style.fontFamily = "monospace";

--- Disable the page animation (one could do it manually in the settings).
*script window.animateEnabled = false;  

-- This is where the magic really happens. Automatically runs "next" for you.
*script setTimeout(function(){document.getElementsByTagName("form")[0].onsubmit(); }, 1500);

-- Disable the "next" button in autoplay to avoid extra events.
*script document.getElementsByTagName("button")[5].disabled = true;
*script document.getElementsByTagName("button")[5].innerHTML = "AUTOPLAY";

There are a million ways one could improve it, but it would go beyond the proof of concept.

  • Directions could be relative. 1 to go straight, 2/3 to turn left/right.
  • Better enemy AI (right now it’s random)
  • Better maze map (guaranteed solvable).
  • Treasures to collect along the way, scoring etc.
  • If one wants to use the script command more heavily, the map could be rendered with a series of small tiles, replacing the symbols for walls and corridor with little images.
  • The games of Snake or Tron could also work with a similar setup.

Let me have your thoughts.

1 Like

@Szaal I’ve spent some time on Missing Wings. Really nice! I loved the puzzles. I also found the maze. I can’t tell if it’s randomized every time, but it was fun to chase all the warping tiles to the end.

The puzzles are p good, though I think a few of them aren’t balanced properly; the dwarves pairing ones especially starts to feel like a chore once you know the solution to them (thanks to how CS handles interface as well).

I see your point. I started the bone collecting game… do I really have to click “collect” a thousand times?

Anyway, I realized that the game files are served in clear. It’s really interesting to see how things are done behind the scenes.

1 Like

Hi all. I have updated the maze, link on my first post: Advanced programming - randomized maze

Some key features:

  • Fully recursive map generation
  • Keyboard controls
  • Custom sizes, up to 80x60
  • If you solve it, nice lo-fi ASCII art treat :slight_smile:

Let me have your thoughts!

2 Likes

Ok, I added REAL GRAPHICS!! The map is graphical and changes every time.

Screen Shot 2020-07-11 at 8.02.15 PM

It’s still pure Choicescript (with some *script), and self-contained (no calls to external graphic renderer). Have fun!

4 Likes

Kudos

1 Like

Hi, What you’ve done its amazing!
I have created a really small maze for my game (though i could have done it a lot bigger if I wanted) a long time ago but it has no graphics. I just wanted to know if there’s a possibility to make the whole image dark and only show “light” where the player is, and a grayed out where it has been, as a way of not knowing the path to the exit before start. That’s how my maze works, as the player never have been there and it shouldn’t know it (at least not before the first playtough, which it could also be solved by the randomness of yours).

Yes, I believe it’s doable. I’d be happy to help you with your game. Do you want to share a link? Feel free to send me a private message if you prefer.

1 Like