Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - [Coding Competition 2022] Segle by willbritton

Reply to topic

Rate this entry!

1 (Terrible) 0% 0%
2 6% 6%
3 0% 0%
4 0% 0%
5 12% 12%
6 43% 43%
7 31% 31%
8 6% 6%
9 0% 0%
10 (Excellent) 0% 0%
This poll has expired.
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
[Coding Competition 2022] Segle by willbritton
Post Posted: Sun Mar 27, 2022 9:52 pm
https://www.smspower.org/Homebrew/Segle-SMS

Quote
Segle is an action-packed word guessing game.

Description from back cover:

Words!

We think we are their Masters, but what happens when the words FIGHT BACK?

Dare you brave the five letter abominations that rain down upon the earth, with only your verbosity to guide you (and a little help from the coloured hints you might just find on your travels)

Green means you’re winning the battle.
Yellow means you’re on the right track.
But watch out for the grey letters ------ grey is the colour of death...


  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
Post Posted: Sun Mar 27, 2022 10:12 pm
This seems to lack checks that you entered a valid word - much discussion on the internet has gone into this game's word list and some ways to compress it down...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 595
  • Location: London, UK
Reply with quote
Post Posted: Sun Mar 27, 2022 10:22 pm
Maxim wrote
This seems to lack checks that you entered a valid word - much discussion on the internet has gone into this game's word list and some ways to compress it down...


Yep - ran out of time to get either of those things done :)

When I get back round to the valid word check I'm already thinking about using hscroll for the little "head shaking animation" - reckon that would work perfectly.

BTW the valid word list is around 13k words long, so even without compression it would fit on a paged cartridge.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
Post Posted: Sun Mar 27, 2022 10:25 pm
Yes, but then it's not so interesting to talk about :)

I also padded the ROM to 32KB and added a Sega header so it ought to work on a real system.
  View user's profile Send private message Visit poster's website
  • Joined: 28 Mar 2022
  • Posts: 18
  • Location: UK
Reply with quote
Post Posted: Tue Mar 29, 2022 10:59 am
Can confirm.

Source : Doing that.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3759
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Mar 29, 2022 2:43 pm
willbritton wrote
BTW the valid word list is around 13k words long, so even without compression it would fit on a paged cartridge.


Any 5 letter word can be converted to a 24-bit number, as there are only 26 characters. An unsigned char array wordlist[13000][3] would require less than 40 KiB and you wouldn't even need to uncompress it to use it.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 595
  • Location: London, UK
Reply with quote
Post Posted: Tue Mar 29, 2022 6:18 pm
Yep, very true.

Although I'd still need to compress my artwork tiles as it stands if I wanted it to fit into a 48K ROM as they're running at like 18K.

I quite like the idea of getting the word list obscenely small as a exercise though. I read somewhere that someone got it down to 17K but I didn't spoiler it for myself and see what their algorithm was...yet!

Wish I'd spotted the comp earlier - this was the result of a mad 3 days or so of all-nighters, plus my first ever "full" assembler game written from scratch, so I'm putting my regret to one side and thinking about something more ambitious for next year ;)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
Post Posted: Wed Mar 30, 2022 7:45 am
Some links...

https://iamkate.com/code/wordle-dictionary/
http://alexanderpruss.blogspot.com/2022/02/game-boy-wordle-how-to-compress-12972...
https://nullprogram.com/blog/2022/03/07/

I'm sure I read something years ago about how prehistoric spell checkers would make use of the sorted nature of a word list to store words as deltas (a bit like the second one above), making it trivial to iterate through. Keeping the data uncompressed would make binary searching feasible for even more speed.

Unfortunately I find this stuff much more interesting than the game!

Regarding the implementation, it seemed to always suggest reusing the first letter of my previous guess but then go back to A for subsequent letters. Maybe it doesn't matter as I probably ought to be choosing different letters until I guess the real answer, but it was a bit inconsistent. I also kept forgetting what button 1 and 2 did so I'd delete my last letter instead of submitting my guess.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 595
  • Location: London, UK
Reply with quote
Post Posted: Wed Mar 30, 2022 8:28 am
Ah yes...a "known issue" rather than a feature that thing where it copies down the first letter!

And interesting feedback about the buttons, thanks for that observation. I made it that way because I was worried the opposite might be true - that the user might expect button 1 to be delete and accidentally submit their answer. But I never got round to testing it on real hardware - only on the emulator.

Yeah, if I get to look at it again, my plan is to try something similar to what I think you're referring, which is to sort alphabetically and encode "jumps" or special delimiting instructions in the data. In my head it would kind of be a hybrid tree structure / vertical RLE.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 844
Reply with quote
Post Posted: Wed Mar 30, 2022 11:53 am
Very nice version of the game. I had the same problems with the buttons as Maxim, though. I kept erasing my last input accidentally.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3759
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Wed Mar 30, 2022 2:16 pm
willbritton wrote
Wish I'd spotted the comp earlier - this was the result of a mad 3 days or so of all-nighters, plus my first ever "full" assembler game written from scratch, so I'm putting my regret to one side and thinking about something more ambitious for next year ;)


pretty impressive for a first ever try in full assembler in 3 days

also, I think to submit the entry you could have a sixth position with some icon on it right of the fifth letter and if you press 1 when your 'cursor' is there you enter the word. sure you first need to build a cursor...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 595
  • Location: London, UK
Reply with quote
Post Posted: Wed Mar 30, 2022 3:13 pm
Many thanks for the kind words, both, and the notes on the buttons.

I think that's a nice idea about the UI, sverx. I was torn whether or not to try and be as faithful as possible to the "clean" UI of the original web game or to go completely rogue and make it something different but I do think your solution sounds quite neat.
Maybe a good compromise is to have the "submit" icon hidden most of the time and then only pop up when you've filled in the final letter.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Oct 2015
  • Posts: 183
  • Location: Ireland
Reply with quote
Good job
Post Posted: Wed Mar 30, 2022 9:13 pm
I haven't played "wordie" games for years but this one has a neat twist. Thankfully the different colors are very "different" so color blind people will still be able to enjoy this game so great usability there.
Thanks for including link to your source code - that makes you 256% more awesome. I dabbled with the z88dk on first project in 2016 but back then binaries produced with that dev kit at that time worked fine in emulators but did not play nice on real hardware - hopefully that has changed now... interesting your Makefile uses z88dk-z80asm whereas I thought it was WLA-DX all the way :) Good job!
  View user's profile Send private message Visit poster's website
  • Joined: 12 Aug 2021
  • Posts: 73
Reply with quote
Post Posted: Thu Mar 31, 2022 7:15 pm
The game works well. I like the original game and that's a cool port. :)

In my opinion, it's all a matter of improving the user experience now.

I tapped buttons until I found out what they did.

May I suggest building some sort of title screen ? Maybe draw the name of the game and the controls over the background as it currently is. And then when a button is pressed, the name of the game and tutorial text goes away, leaving only the play area to keep a minimal look. What do you think ?

Or if you want to keep the mobile roots of the game you could put a segle logo on top of the screen, and scroll out of it when a button is pressed haha

Also, personally I am surprised that there's a RNG on the word choice. I'm curious of how you would implement such a thing on a Master System ?
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 595
  • Location: London, UK
Reply with quote
Post Posted: Fri Apr 01, 2022 7:45 am
Great suggestions, thanks!

The RNG is really simple - at the start of the game it sits in a tight loop and counts through all the answers one by one until it sees the first character of the user's guess appear in the guess buffer (which is filled on the VDP interrupt "thread") at which point it stops cycling and settles on the answer it was on at the time.

In other words, it relies on the relatively unpredictable time it will take a user to press the button after the game starts to "randomize". I suppose if you were some kind of android you might be able to time your button presses sufficiently well to guarantee you could get the same answer every time, but for us mere mortals it's impossible :)

If you run this in Emulicious you'll see CPU spike (in my case running Emulicious my Mac fan goes on full!) when the game has first started and then drop down to essentially zero after the user has pressed either up or down.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3759
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Apr 01, 2022 8:19 am
I guess this is the only good source of entropy you can get on the SMS, wait for the player to do something... good idea to pick the word only after the first letter has been picked - actually it could be even done after the first complete word has been picked because there's no feedback to the player before that moment.

You could count the number of frames in a 16-bit counter (time driven entropy) and have a xor mask with all the pad input states at each frame (maybe left rotated by the lowest 4 bits of the above counter?) to get user driven entropy too, then sum those two 16 bit values and seed your RNG just before picking the word.

But your system works pretty well already I would say. :)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
Post Posted: Fri Apr 01, 2022 9:22 am
It would use a lot less CPU to use the user inputs and time to select a random number, then look up the word by index. You only need to pick a word after the user submits their first complete guess, so you have a lot of entropy available.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Jul 2010
  • Posts: 539
  • Location: Angers, France
Reply with quote
Post Posted: Fri Apr 01, 2022 10:28 am
Last edited by ichigobankai on Fri Apr 01, 2022 1:20 pm; edited 1 time in total
For pseudo random things, I'm using a LUT (aligned table of 256 values) and the R register.

Edit. R register not I...
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3759
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Apr 01, 2022 11:09 am
ichigobankai wrote
For pseudo random things, I'm using a LUT (aligned table of 256 values) and the i register.


yes, that's usually sufficient, but the problem we are discussing here is about finding the entropy needed to seed the generator
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 595
  • Location: London, UK
Reply with quote
Post Posted: Fri Apr 01, 2022 3:31 pm
Is the suggestion to use the frame interrupts to drive the counter rather than CPU loops?

If so, back of the envelope to me looks like it would take roughly 38 seconds to cycle through all the 2309 answers, which feels like quite a long time, even over 5 letters. I'd say a quick player could make a word guess in significantly less time than that, which would effectively cut the field of answers down.

Using line interrupts instead of frame interrupts would help I guess.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Mar 2013
  • Posts: 611
  • Location: Copenhagen, Denmark
Reply with quote
Post Posted: Fri Apr 01, 2022 3:56 pm
Wordle on my favorite console! :) My wife and son are totally wordle addicts, and they compete in the english and the danish version first thing in the morning... every morning. I registered the help of my son to playtest this, and after I learned to scroll through the letters with the dpad, we completed a couple of words together. Good time.

Only complaints from here is the complete lack of touchscreen and Internet connection :)
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2021
  • Posts: 55
Reply with quote
Post Posted: Fri Apr 01, 2022 9:12 pm
Great conversion but my english is too limited ;)
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3759
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Apr 04, 2022 12:40 pm
willbritton wrote
looks like it would take roughly 38 seconds to cycle through all the 2309 answers, which feels like quite a long time, even over 5 letters


this is true, and it's something to consider... still I suggested using both the frame counter and a bit rotated xor mask of the input to create a 16-bit value that would be used to seed the RNG. I think it would give you a nice seed and it will probably be enough to ensure that any word has its chance to appear
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!