Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1370249 Posts in 64449 Topics- by 56501 Members - Latest Member: liquidpigstudios

December 09, 2019, 01:07:08 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogs5N²+6N-4 . . . . . . (codename)
Pages: 1 2 3 [4] 5
Print
Author Topic: 5N²+6N-4 . . . . . . (codename)  (Read 8324 times)
a-k-
Level 1
*


View Profile
« Reply #60 on: February 23, 2019, 07:15:10 AM »

.
Logged

a-k-
Level 1
*


View Profile
« Reply #61 on: February 23, 2019, 07:16:03 AM »

The profiler now supports displaying the program as is, without conversion to code:


(program, and how it appears in the profiler)
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #62 on: February 23, 2019, 08:35:58 AM »

Ok, this is interesting. Not that many programming games out there!
Logged
a-k-
Level 1
*


View Profile
« Reply #63 on: February 23, 2019, 09:23:49 PM »

Ok, this is interesting. Not that many programming games out there!
Thanks! There have been very good additions to the genre for the last two years, but Zach keeps raising the bar...
Logged

a-k-
Level 1
*


View Profile
« Reply #64 on: April 06, 2019, 03:03:12 AM »

Particles are coming:


(usually emitted while players edit their programs)
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #65 on: April 06, 2019, 05:06:30 PM »

That's an unusual way to juice up your game Cheesy
Logged
a-k-
Level 1
*


View Profile
« Reply #66 on: May 09, 2019, 03:34:23 AM »

That's an unusual way to juice up your game Cheesy
Well, I guess I could give more attention to the standard practices of juicing, the game is a bit dry at the moment...


(screenshot: misaligned keywords that don't mean anything except perhaps specifying which command to run next)

---
Graphics (OpenGL/WebGL):
  • x2 SSAA as a fallback for MSAA. Fonts are rendered with 2x2 pixel blocks so that downsampling produces unblurred text.
  • HDPI support for Windows (Linux and HTML5 should work OOTB)

UI:
  • Zoom support for several views: program, code, profiler
  • Mouse wheel handling: when there are multiple views that can handle scroll/zoom events and none is hovered, I highlight them for a second. When there's only one, it handles the event regardless of the mouse position.
  • HTML5: handling of fullscreen and browser-opening buttons at the JS side instead of asynchronously by SDL (so that they do not get blocked by the browser)

More:
  • About screen
  • Initial versions of logo, window icon/favicon, program icon, readme, ...
Logged

a-k-
Level 1
*


View Profile
« Reply #67 on: June 15, 2019, 12:07:24 AM »

"Elseif" statements are now emitted for languages that support them (including "cond" for Common Lisp).

It started with the idea of, I will just search for "if { ... } else { if { ... } }" and the like, but has become more involved than that:



Shown above:
1. User program
2. Old translation - early exit
3. Intermediate phase - nested "if" instead of early exit
4. New translation - "elseif" instead of nested "if"
Logged

a-k-
Level 1
*


View Profile
« Reply #68 on: July 27, 2019, 08:56:51 AM »

Leaderboards:

(using 5x5 symmetric "identicons" for representing players. Will probably add an option to select 2-3 letters, whatever does not violate GDPR.)

Client/server:
  • HTTPS on Linux: started with OpenSSL, and later replaced it with mbedTLS (a.k.a PolarSSL) for a smaller footprint (saved 1 MB)
  • HTTPS on Windows: replaced libcurl with the built-in WinHttp
  • Server maintaining aggregate statistics per level (solved/cheated vs. started)
  • Compression, getting rid of IP addresses in server/reverse proxy, and more

Savefiles and exports:
  • Windows/Linux: storing savefiles in user directory, to facilitate upgrades (personally, I don't like this practice)
  • Windows: supporting Unicode characters in user directory...
  • Windows/Linux: standard Save File dialogs for exports. Still need to fix a strange issue on Linux that the dialog boxes appear as "pop-unders", always under all OpenGL windows regardless of the defined z-order. Virtualization issue?
Logged

a-k-
Level 1
*


View Profile
« Reply #69 on: August 09, 2019, 09:32:53 PM »

I was just adding an intentionally-weak form of encryption to selected parts of the savefile. Since I was using signed/unsigned arithmetic heavily, and given that C++ has related undefined behaviors in contemporary compilers, I went on to verify that the Linux and HTML5 builds can read and write the savefiles created by Windows. That is, that the "encryption" algorithm behaves the same in all platforms.

The initial tests were positive: Linux (gcc) and HTML5 (llvm-emscripten), with all optimizations enabled, worked perfectly. But then I discovered that the release build for Windows couldn't read the savefiles created by the debug version, which was the one I had been using for the comparison with Linux and HTML5.


(decryption gone wrong)

It turned out that the compiler I least suspected, VC++, was emitting bad machine code in release configuration for a super-simple loop:

int digitsCount = 0;
int uppersCount = 0;
int lowersCount = 0;
for (char c : data) {
    digitsCount += ('0' <= c && c <= '9');
    uppersCount += ('A' <= c && c <= 'Z');
    lowersCount += ('a' <= c && c <= 'z');
}



The compiler attempted to use a clever optimization that reduced the number of '<=' comparisons from 6 to 3, but somehow miscalculated two out of the three counters. By the end of the loop, I was getting digitsCount = uppersCount = length of data, regardless of its actual content.

Annotated assembly (blue=correct, red=incorrect; it's recommended to look at the correct code first):

; c = data[...]
mov bl, BYTE PTR [eax]

; digitsCount += ('0' <= c && c <= '9');
mov edx, ('9' - '0') * 100h
cmp dh, dl

sbb edx, edx
inc edx
add edi, edx    ; edi = digitsCount

; uppersCount += ('A' <= c && c <= 'Z');
mov edx, ('Z' - 'A') * 100h
cmp dh, dl

sbb edx, edx
inc edx
add esi, edx    ; esi = uppersCount

; lowersCount += ('a' <= c && c <= 'z');
sub bl, 'a'
mov edx, 'z' - 'a'
cmp dl, bl

sbb edx, edx
inc edx
add DWORD PTR _lowersCount$[ebp], edx



Now, how would you work around such a bug? Curiously, neither of the following worked:

for (char c : data)
    digitsCount += ('0' <= c && c <= '9');
for (char c : data)
    uppersCount += ('A' <= c && c <= 'Z');
for (char c : data)
    lowersCount += ('a' <= c && c <= 'z');



for (char c : data) {
    digitsCount += ((unsigned char) (c - '0') <= (unsigned char) ('9' - '0'));
    uppersCount += ((unsigned char) (c - 'A') <= (unsigned char) ('Z' - 'A'));
    lowersCount += ('a' <= c && c <= 'z');
}



for (char &c : data)
    c++;
for (char c : data) {
    digitsCount += ('0'+1 <= c && c <= '9'+1);
    uppersCount += ('A'+1 <= c && c <= 'Z'+1);
    lowersCount += ('a'+1 <= c && c <= 'z'+1);
}



digitsCount = uppersCount = lowersCount = data.size();
for (char c : data) {
    digitsCount -= (c < '0' || c > '9');
    uppersCount -= (c < 'A' || c > 'Z');
    lowersCount -= (c < 'a' || c > 'z');
}



Only after 4 failed attempts did I finally come up with a successful workaround:

for (char c : data) {
    digitsCount += (c <= '9') - (c < '0');
    uppersCount += (c <= 'Z') - (c < 'A');
    lowersCount += (c <= 'z') - (c < 'a');
}



For completeness, it's worth noting that replacing the explicit conditions would work too:

// assuming setlocale(LC_CTYPE, "C")
for (char c : data) {
    digitsCount += isdigit(c);
    uppersCount += isupper(c);
    lowersCount += islower(c);
}



To be fair, I'm using an old version of VC++ so I guess that upgrade would fix this bug - it's just too trivial to remain unnoticed. But still, this is such a mess...
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #70 on: August 09, 2019, 10:59:26 PM »

Congrats! Few people can claim to have found a compiler bug Wink
Logged
a-k-
Level 1
*


View Profile
« Reply #71 on: August 11, 2019, 10:47:29 AM »

Congrats! Few people can claim to have found a compiler bug Wink
Well, they're actually not that uncommon in C++, though usually not in the code generation phase of mainstream compilers. So yeah, this one really surprised me.
Logged

a-k-
Level 1
*


View Profile
« Reply #72 on: October 12, 2019, 08:20:49 AM »

Demo version:
- Support for subset of levels (and achievements), including leaderboards calculation at server
- Actual selection of levels - ~15 levels from areas A-B-C, covering the basics and selected parts of nondeterminism and loops
- - Revised membership and default order of levels in areas A and B - taking into account hints that had made some levels easier

Gameplay - languages:
- Spread the 6 languages across the levels
- As soon as the player unlocks 2 or more languages, they will cycle over time (uncontrollably) according to logic that prioritizes newly-acquired languages in both new and already-solved levels


(per level: number of prerequisite levels assuming the player does not skip any (center), and the number of languages available (bottom))

Screenshots:
- Selection of screenshots (not ready yet, because they had prompted me to improve the looks of the game a little...)

User interface:
- Many small usability enhancements across the board and cosmetic changes here and there (still more to do)
- Most importantly: allowing clicking as an alternative to drag-and-drop, and vice versa
- Better support for wide screens - everything is still positioned assuming 4:3 aspect ratio, but now each "view" can be selected to align or expand according to the extra horizontal space, up to 16:9

Third party-related - sound:
- Windows/Linux: FLAC instead of zip-compressed-WAV for sounds
- Windows: friendly error message when game is launched from within the .zip without extraction
- Linux: fallback when OpenAL is not installed - a popup asks the user if to continue without sound

Third party-related - general:
- Removed unneeded 2nd-level third parties (i.e. dependencies of dependencies)
- Linux: custom-built all static dependencies for achieving a portable executable (verified on Ubuntu 18 down to 12...)
- Worked around some long-standing issues in third parties that I had hoped would have been fixed
- Per-platform licenses file + credits
- All third parties are now 100% open source (except old VS runtime)

Download sizes per version have become ~3MB for Windows/Linux and ~4MB for HTML5 demo.
Logged

a-k-
Level 1
*


View Profile
« Reply #73 on: November 09, 2019, 05:28:53 AM »

Focus has been on improving the UI: more options for unlocking/navigating to hint levels, more nuanced feedback to the player when output doesn't match the goal, a setting for disabling tooltips while editing, better keyboard support, etc.

Besides that, the time has come to finalize the colors - something I've been postponing for long. The game needs random colors for filling elements, and those colors should look good on a variety of backgrounds, and most importantly together, without one color popping up too much.

I started with generating colors in HSV by rotating the hue in constant intervals and changing the S and V periodically. Some colors were just too dark, so I desaturated them in proportion to their grayscale level vs. a threshold. For some reason, ignoring gamma correction seemed to produce better results - less uniform but more lively, and calculating the grayscale as a naive weighted RGB average appeared more representative than the L of L*a*b*. It really seemed like I needed to plague magic numbers without regard for any kind of theory.

That's how I came to the colors in the first row, the top color of every pair:


(The first 27 colors out of ~250. In every pair, top = element fill color, bottom = lighter version used for hovering. The lower the row, the more rare its background is.)

Now, for every color I need two darker versions and two lighter versions - for gradients and for hovering. That didn't turn out so well, and as you can see above, the change in brightness is currently bigger in some colors and smaller in others. Maybe I do need some theory, after all...
Logged

a-k-
Level 1
*


View Profile
« Reply #74 on: November 23, 2019, 04:44:33 AM »

HTML5 prototype is now available.
It's more of a non-final demo, with 16 levels, 8 achievements and 2 languages, which amounts to ~30% of the currently-planned content.

Play on itch.io (password: tigs)



Minor issues I've encountered with itch.io:
- No server-side compression (12MB download instead of 4MB)
- Local storage is regarded as 3rd party cookie
« Last Edit: November 23, 2019, 04:52:02 AM by a-k- » Logged

JobLeonard
Level 10
*****



View Profile
« Reply #75 on: November 24, 2019, 03:57:33 AM »

Oh no! I have no time to test it now but I can't mark the topic as unread or anything like that so now I'm afraid I'll forget it...

Will hopefully get to give it a shot later!
Logged
Flatgub
Level 0
***


My existence is questionable at best


View Profile
« Reply #76 on: November 24, 2019, 07:39:24 PM »

Demo is super fun! Its a shame the demo ends right as all the commands were introduced, I was ready for more! The editor felt a bit clunky but that probably due in part to me not learning all the keyboard shortcuts, I found myself setting the workers in the wrong order on join and unlink a lot or forgetting to set command directions. Other than that minor gripe though its really good, I'm keen to see more!
Logged

a-k-
Level 1
*


View Profile
« Reply #77 on: November 26, 2019, 09:49:26 AM »

Demo is super fun! Its a shame the demo ends right as all the commands were introduced, I was ready for more! The editor felt a bit clunky but that probably due in part to me not learning all the keyboard shortcuts, I found myself setting the workers in the wrong order on join and unlink a lot or forgetting to set command directions. Other than that minor gripe though its really good, I'm keen to see more!

Thank you for playing, Flatgub, this is very encouraging! You're right, the demo may be a little short, and the game really opens up once you have all the power at your disposal (and discover that, well, you need to manage with only that...) I will consider including more levels. Have you saved your savefile? It will work on any future version, demo or otherwise.

The "join" issue is probably a classic (like "mov al, bl" vs. "movb %bl, %al"), but it would have never occurred to me that some people might find it more intuitive for "link" and "unlink" to use opposite orders of workers! Will adding a shortcut for swapping workers (say, X for exchange) help? That'll still be a keyboard shortcut, though...

Now, your comment regarding forgetting to set command directions is pure gold! Did you expect the program counter to have some kind of directionality, Befunge-style, like in SpaceChem? Aside from personal preference, my rationale for the current design was that a game about graphs had better have programs that resemble graphs, with explicit connections between commands. Certainly, this brings extra work on the player. What I'm thinking right now, following your feedback, is to alleviate that with some form of "auto-connect". I believe I can come up with something that'll be intuitive enough so as not to require any toggling. I will need to experiment with that, hopefully it will improve the experience for all players!


Oh no! I have no time to test it now but I can't mark the topic as unread or anything like that so now I'm afraid I'll forget it...

Will hopefully get to give it a shot later!

I'm looking forward to that, JobLeonard! Watch out for additional posts and consider them as personal reminders...
Logged

Flatgub
Level 0
***


My existence is questionable at best


View Profile
« Reply #78 on: November 28, 2019, 03:36:31 AM »

I think having a shortcut for swapping workers would be pretty convenient, because my most common mistake was "oh whoops i got the order wrong" and then having to re-input both workers, or having A join B require drag join then two more shortcuts instead of just drag and swap. It is just another shortcut, but given how many times I found myself just wanting to swap the order instead of change the actual workers, I'd probably get more use out of an exchange shortcut than the dedicated worker and SHIFT+worker shortcuts as the majority of my use of them was swapping the order already on the command.

And yeah I guess my natural assumption was that program counter would continue along the last direction without interruption, especially if I'm just dragging commands into a straight row. I definitely think laying commands could be made faster with the ability to maybe turn on/off an autoconnect that links the last placed command to the newest command if they're adjacent or something like that, something optional.

But either way, great work with the project!

Logged

JobLeonard
Level 10
*****



View Profile
« Reply #79 on: November 28, 2019, 05:44:36 AM »

Just managed to sit down and give this is a spin. Very neat!
Logged
Pages: 1 2 3 [4] 5
Print
Jump to:  

Theme orange-lt created by panic