Tumgik
impurelight · 3 years
Text
Why Flutter Will Never Replace HTML
I love Flutter. It's so powerful and makes things so easy to do.
Recently Flutter arrived on web. Now web has a ton of problems. Namely performance and SEO. Now both of these problems are incredibly difficult to solve. But I do think the performance problem is solvable. I'm not sure if people will ever be willing to solve it but it can be done. It's the SEO problem that I'm beginning to think will never be solved.
So first of all the performance problem. Now it's worth noting that Flutter is very closely tied to the web. In fact Flutter is built upon a graphics library called Skia. The same graphics library that Chrome uses.
So this is why I think the performance problem is hypothetically possible. Because the way Flutter renders is not so different from the way normal web pages render.
But it will be very difficult because instead of having a browser render everything directly now it has to render a canvas (it actually uses the HTML canvas tag) and have the Flutter application render itself on the canvas.
So I suspect the only way you could get HTML-like performance is if you had Flutter integrated into the browser. So you cut out the intermediate canvas step. Which I guess is possible as most browsers are Chromium based and Chromium could do it thereby forcing most browsers to do it.
Now SEO. This problem is in my opinion impossible. So the problem here is that Flutter basically draws stuff on a canvas. And Google can't index the stuff on the canvas.
So I watched this video:
youtube
And it basically compares web pages to a document. And it makes sense. You can inspect the HTML source code of every web page and get all the text.
And this makes it very easy for search engines to crawl webpages. Just copy and paste the HTML code and remove the tags.
So how would you crawl a Flutter application? Well, you could run the Flutter application. And do a ctrl A ctrl C. Although that would require text to be selectable by default which I don't think it is currently.
Anyways, assume you could do that. Then you still wouldn't get all the content on the page. There's going to be information in menus and stuff you're not going to get.
Well, what if you just decompiled the Flutter application? Then you'd get everything. Of course you'd also lose a lot of information about what goes where unless you somehow managed to put it all back together.
But here's the problem. Both of these solutions require a lot of work on the search engine side. Now instead of just stripping out formatting on an HTML page you're going to have to, what?, decompile a Flutter application?
That's a lot of work. But it can be done. It's not the impossible part. The impossible part is there's no one that's willing to do it.
Think about it. The search engines aren't going to invest tons of time on a technology that only exists on like 0.0001% of the internet and the Flutter application developers will not increase their market share unless the SEO tools are in place. It's an unsolvable problem.
So Flutter can still work on the web. But it'll be restricted to web applications that don't need to be crawled by search engines. You're never going to see a Wordpress competitor written in Flutter. It's not going to happen.
0 notes
impurelight · 3 years
Text
iOS VS Android
I recently got an iPhone and with WWDC come and gone I thought I'd reflect on some of the differences between the two devices. Because I've seen a lot of comparisons between the two devices and they always talk about the superficial things that no one really cares about.
Like this phone has a 120 Hz display. This phone has feature X. Yeah, yeah, yeah. But what is it like to use?
Things I Like About The iPhone
In short the iPhone is just nicer than Android. Things are just designed a little better. Things work a little better. Like the bottom navbar. It's a complete joke on Android.
I wrote about it here. On my custom rom all of my complaints have been addressed. But it is a highly tweaked rom so I'm not sure if this applies to the base Android 11.
But still there is a black spot under the navbar in most apps including mine. I haven't figured out how to remove it in Flutter just yet.
Taptic Engine
OMG. The Taptic engine is amazing. And going back to my previous Xiaomi phone; that phone's vibration is complete trash. And apps know the taptic engine is amazing because they'll use it all the time. Android apps will never use vibration. Probably because they know it feels just meh.
Although I think I tried a Samsung phone once and it had similar haptics. Only the flagship. Apparently the A-series still has the garbage haptics that most Android phones have.
This begs the question though: why doesn't the default iOS keyboard support keyboard haptics. Instead you get this terrible tapping sound. What year is this? 2005?
I installed Gboard to try to get around this problem and it has an option for haptic feedback on the keys but it doesn't work that well.
Raise To Wake
This is a pretty neat feature. On an Android phone to wake it you need to press the power button. On an iPhone it just wakes up whenever it senses that you lifted the phone up basically making the power button redundant.
It took a little time getting used to. I'd turn off the phone's screen just for it to wake right up.
So I guess you're supposed to just let the phone's screen time out to turn it off. It's really weird. It's a nice to have but I don't think Apple really thought this one through.
Oh, yeah, you can also wake the device just by tapping on it. Which is cool I guess. Some Android phones let you wake them by double tapping. It's just a single tap here though.
Truetone
I love truetone. It looks so good. Although to be fair you can't really notice it unless you're comparing the iPhone to an Android phone. But then you really notice it.
FaceID
I'm filing this one under the things I like category although I don't really have that strong feelings for FaceID.
Android phones usually have a fingerprint reader. Most of the new phones have an under display one. It's alright but if your finger is wet it won't work which can be annoying.
So FaceID will work with a wet finger. But now you have a new problem. If you're wearing a mask it won't work (although I think they might have fixed that). And if you're not looking a the phone it won't work.
I'm talking about when the phone is on the table and you power it up while it's still lying flat. It won't be able to find you. Not the attention feature which you can disable in settings.
Lack Of Back Button Wasn't A Problem
I thought it would be, I even enabled the back shortcut where you slide from the left. But every time you need to go back there's a context button in the top left. So you really don't need that button anymore.
Things I Don't Like About iOS
So I really think iOS is beautifully made. But it's also flawed. In my short time with iOS I'd have to conclude that ultimately iOS is a beautiful toy. It looks nice but it's not really intended to get any serious work done. So I will not be using it as my primary phone OS. And here's why.
The Notifications Are Terrible
OMG. How do you make notifications this bad? And in 2021 too! I would have thought a mobile OS would have figured this out. But no. Android's notifications were lightyears ahead of Apple's... 5 years ago. Now they're even better and Apple is stuck in the stone age.
OK, where do I begin. Well for starters your notifications only appear until you unlock the phone. Then they go to this weird limbo you can only get to by swiping down from the top left.
Oh, that's another thing I don't like. The quick pull down. I always hated it when some Android roms did it by default and I hate it here too.
Then what's next? How do you close notifications? By swiping? No! That's how you open the notifications. You have to press on the X button. One by one.
And notifications don't work that well either. I think I'm not receiving notifications while I'm using the phone. I'm not exactly sure that's the reason but that would explain why I don't receive a notification for 2 factor code messages.
Too Many Notification Badges
OK, I don't need to know I have over 3000 unread RSS stories. I'll get to them when I have time.
And yeah, sure, you can disable them. But then you have to go through them app by app which is annoying.
No Battery Percent In Status Bar
Now on Android it's more of an afterthought with only one small option which screams that some developer put it in for debugging and no one bothered to take it out. But I still wish it was there.
Some Apps Don't Allow IAP's
I opened the Audible app excited to be able to see the daily deals. Nope. Not on iOS. Sorry.
The Notch
OK, look. My previous phone was a Mi 9T which had a pop up camera and no notch or cutout of any kind so I may be a bit spoiled. But the iPhone's notch is really big and annoying. Not really in portrait. But in landscape games you really notice it.
You sort of learn to live with it, but it's still annoying.
Long Pressing The Power Button Doesn't Turn Off The Phone
This opens Siri instead which maybe I might get used to. But every other phone brings up the power down option when you long press the power button so this is very weird.
Even old iPhones brought up a power down slider when you held down the power button. I mean, it is called a power button y'know.
Square Corners On The Phone
OK, I have a case so this is a non-issue for me. But if you don't have a case it's very difficult to pick up from the table.
Square Corners on a phone are nice, but impractical.
Doesn't Have Android's Rotate Button
Android recently introduced this option that brought up an icon when you rotated the phone while you have rotation lock on. And I really love this feature.
Too bad Apple doesn't have it. How do you rotate the device? Go to the settings and disable rotation lock and then re-enable it again later. Like a barbarian.
Oh, well, at least the rotation animation is prettier than Android's. It seems to be the same animation though. Maybe it's played slower or something.
0 notes
impurelight · 3 years
Text
Tenet - The Worst Time Travel Movie
Look, I love time travel. It's why I loved Quantum Break so much. That game looped back on itself so well and was completely mind bending. All that while maintaining the top quality story telling from Alan Wake. Time travel in movies is a little harder because you have less screen time and it's harder to see the consequences of your actions. But it can still hit you with the mind blowingness of... incest. It's always incest.
But I wanted to talk about Tenet because Tenet fails at time travel. OK, what do you need to make time travel interesting? First you need to see the future interact with the past in interesting ways. And second you need the entire thing to be consistent. Tenet fails at both.
So the only part of the time where you see the future interact with the past is in the masked attacker in the art thing scene. But then it's completely brushed aside and becomes a minor distraction. No, I want to see more of that. What are you doing?
And then it has to be internally consistent. Time travel in Tenet makes no sense. So you're telling me that that someone installed windows with bullet impacts in them and that was perfectly OK? As soon as you think about things they collapse.
And then the movie itself. It is just so bad. I knew it was going to be bad as soon as they tried to anesthetize an entire room full of people. There are so many reasons that wouldn't work. First of all anesthesia drugs are not harmless. That stuff can kill you if not admistered properly. And the idea that you can just pump it into a giant room? Ridiculous. Even if you got an air tight seal, even if you somehow mixed it properly, you'd need a lot of that stuff.
I think I wrote about it before but a good story has to build to something. It should snowball and when you look backwards you should go, "Oh, of course that's what they were building to." But tenet does none of that. I mean, it barely even makes sense. I had to read a wikipedia article to understand it. And then it's just some random adventure 'let's go talk to this guy', then 'let's kill this guy', 'we need to get this'.
Oh, and then at the end it randomly throws in, "Oh, it's the end of the world, no biggy." Without even justifying why, it just is.
And don't even get me started on the random domestic violence parts in the movie. Tenet is an embarrassment of a movie. Look, I loved Inception, but Tenet is just Nolan biting off more than he can chew and just reeks of a story constructed solely to support a gimmick instead of being actually interesting.
0 notes
impurelight · 3 years
Text
Why The GPL Is A Cancer
I've been thinking about this for a long time. Since 2012. That was the year I installed Linux for the first time. And I was like, "This is amazing, you can install apps from the terminal? What?" Completely ahead of its time. And you could completely install a new desktop environment? And this was how big? 16 MB and it's running off a tiny USB flash drive? And how much RAM is this using? 100 MB? Shut up and take my money.
It wasn't the most user friendly but surely they would figure that out and 2013 would be the year of linux on the desktop. But it was not. And neither was 2014. Or 2015. Or 2016, 2017, 2018, 2019, or 2020. So I was just left with a sense of 'why?'. At the time it seemed to be so obvious that Linux was technically superior to all the other operating systems. So why did it stagnate for all these years?
I always suspected the GPL because it was so intertwined with Linux and Steve Ballmer hated them. Like their logo has horns for goodness sake. How much more obvious can you get? They even called it a 'parasitic license'. Ooo parasitic bad. But there never was a smoking gun.
But I think now I can put all the pieces together. The crux of the argument is that you cannot make money from GPL software. OK, I know technically that's not true. You can make like a GPL version and a non-GPL version (although that's cheating) and you can have like a donate link.
But there's not that many big examples of people making money off the GPL. Except for Android. But I don't think that counts because Android is sort of like a second OS built on top of Linux. So it only really applies if you have an army of software engineers willing to clone all the functionality of an OS.
So for all intents and purposes no money off GPL software. So what does that mean? At first I thought that meant no one would work on GPL software. But that's obviously not the case. There's tons of software that's built using GPL and GPL-related licenses: Krita, Blender, Inkscape, Audacity, Git, among others.
And this bothered me for the longest time. But now I think I know why. All this software is famously... work focused. I mean Blender is famous for being hard to use. So much so that one of its biggest releases's claim to fame was how user friendly it was (for the record it is still not very user friendly).
youtube
And git. I love git. But we all see those git jokes. If something goes wrong erase your local repo and pull a fresh copy.
So why? Because all of these developers are not developing for the average Joe or Jane, they're developing for people like themselves. For artists, developers, creators, people with a lot of experience. And if you step back it makes sense. Of course people are only going to develop for themselves. The people putting the issues in the git remote repository https frontend are not average users. They are experienced users.
So all this results in software that's good enough. Especially if you're a business. You could say that open source encourages business to business over business to consumer. And combined with its parasitic nature it will never be great for the end consumer. Because it is encouraging developers to stay in their own bubbles.
Of course it's not always true. But the only way I've seen this changing is if some company gave the maintainers a dumptruck full of cash. Like Blender. Their sponsors read like a who's who of the computer industry: Nvidia, AWS, Unity, Facebook, AMD, Epic, and those are only the corporate gold sponsors. Is it any wonder than that Blender is trying so hard to clean up its image and make itself user friendly?
But I don't think this is sustainable. Not every open source project is going to get that much money.
So the title is that the GPL is a cancer. Maybe that was too harsh. The GPL is not killing the industry. It's just holding it back.
So my point is the GPL had it's time in the sun. It was vital in bringing the various Unix operating systems together. But now it's just dead weight. Unnecessary. Even harmful. It is time we moved past the GPL and embraced more open alternatives like MIT and Apache and BSD.
0 notes
impurelight · 3 years
Text
Notes On The Capitol Riots
I've been watching the discussions on the capitol riots and I've noticed some things I haven't seen anywhere else. So I thought I'd write them here.
Trump Is Surprisingly Smart
A lot of liberal news has categorized Trump as incompetent and stupid. And I thought so too. But when I was watching this Legal Eagle episode I realized something: I was looking at it the wrong way.
I assumed that Trump cared about the United States. And if you believe that you'd naturally come to the conclusion that he is an absolute moron. But if you flip the script and assume that Trump only cares about himself, then you'd have to conclude he's actually pretty smart. Well, relatively speaking.
In the Trump rally immediately prior to the riots you can see Trump goes right up to the line of saying something illegal without actually crossing it. Contrast this with the people he was with, I believe his lawyer, who basically yelled, "Trial by combat!"
I now firmly believe Trump very carefully chose his words during that rally to give himself plausible deniability while hoping in private that the crowd would do what it did. This is further corroborated by the fact that it was reported he enjoyed watching the riots unfold.
Furthermore this 'tiptoeing up to the line and hoping other people do illegal stuff for him' has happened before. Just prior to the riots Trump asked Mike Pence to break the law for him and throw out the votes. It's the exact same thing on a much smaller scale.
Some People Will Never Admit They Were Wrong
So that's Trump. What about his followers? To quote Obi Wan Kenobi, "Who is more foolish? The fool or the fool who follows him?"
This was also a big issue in the 2016 election. A lot of people were dumbfounded why so many people voted for Trump. It seemed like everyone had some article trying to answer the question.
The answer appeared to be a combination of "Not as bad as Hillary Clinton" and "I support the republican party and will vote for them even if I hate Trump". Which is fair enough. But I don't think either of these answers explains what is happening now.
So in the 4 years since I read these original answers a lot more conspiracy theories have appeared and a new group which I call the 'right-wing-dumb-fucks' have risen up to make ridiculous comments on YouTube videos and are the reason why every mainstream news video now has over 50% downvotes. Seriously, I have to make a conscious effort not to read the comments on these videos because the idiocy there... it just hurts my brain.
In short I am like this:
youtube
I've also become so much more cynical. I mean I thought I was cynical in 2016. But that was just the tip of the iceburg.
So I've created a hypothesis for why people are the way they are. In short: the backfire effect. Now I remember reading somewhere that the effect is not as strong as what was originally reported, but it is the only way to rationalize what is going on.
Basically if you attack someone's beliefs it will 'backfire' meaning their beliefs get even stronger.
I don't believe this happens all the time or even most of the time. And it probably has something to do with how invested you are in a given belief before it is attacked.
If you look at some of the right-wing-dumb-fuck radicalization material they actually sort of know this already. So you say things like 'lead them in slowly' and 'get them to question authority'. And before you know it they are so far gone there is no saving them.
Sort of like this:
youtube
Politics Are As Partisan As Ever
So it is tempting to just throw the entire republican party under the bus. And a lot of democrats have done that. But that is not the right thing to do and the fact so many did it is just disappointing.
Now it is hard to sepparate what officials are saying vs political pundits. But I think that in a debate you should think about where your opponent is coming from, even if you think they are wrong.
So what I'd like to see is people saying things like, "Even if you believed X then Y is not an appropriate response." But instead I saw, "You're so dumb. Dumb, dumb, dumb, dumb. My team #1." It is a bit disappointing.
And when people are treated like this it is obvious why many republicans still defend Trump. And the ones that no longer support him are only doing it because of the sheer amount of cognitive dissonance not doing so would cause.
0 notes
impurelight · 3 years
Text
Wonder Women 1984
Wow, what a movie. I knew instantly I wanted to write something about this movie but what?
Well, first things first. This movie was about 30 minutes too long. There's definitely stuff they could have cut. And the physics is all over the place. Even in the very beginning when she kicks some guy's leg and he goes flying. Yeah... no. No no no no no.
And she can hardly use her lasso to swing across a light pole but somehow manages to attach onto a commercial airline. Come on guys. I'm going to give a pass on the axle of the truck slamming into the ground making the entire vehicle do a somersault, but that's only because I'm a sucker for those scenes. I loved it in Terminator Gen I Sys and I love it here.
And let's talk about the writing. It's not great. Especially in the beginning of the movie where it just plays like a bad fanfic. Like seriously the 'magical wishes' thing has appeared many times in erotic fiction. And I'm pretty sure that every single amateur writer has done it better than what happens here which is, "Oh, let's just randomly talk about our wishes in front of this weird stone for no reason."
But I did enjoy the movie once it got going. See aforementioned complaint about how it was 30 minutes too long. I heard the current populist regimes were an inspiration for this movie and it definitely delivered. Oh, by the way, there's no better way to show how screwed up the world is than firing a bunch of ICBM's, am I right?
And I definitely felt it. So the wishes are like populism and the solution is to denounce all your wishes. Yeah, yeah, whatever. If felt really good to see that finale. But, of course, like many movies and TV and video games that cover sensitive topics it didn't really teach us anything. It was just feel good junk food.
Unlike my current game Banality Wars Carridin which is basically a cross between a history lesson and an Advance Wars game. If I ever get around to finishing it that is.
So back to the movie. The reason why it's just emotional junk food and not like a life lesson mostly is because a ton of things just don't make sense or they do make sense until you squint at then you're like, "Huh?". Still a pretty good movie through and through. Not quite as good as the previous one but still very enjoyable.
2 notes · View notes
impurelight · 3 years
Text
OOP VS Functionalism - The False Dichotomy
youtube
So I watched this video... and it's a pretty good video. It talks about different types of programming: procedural, structured, OOP, and then finally functionalism.
But there's something that really bothered me. At around the half way mark the presenter really dumps on OOP and says how Functional programming is the future.
I'm not going to deny that, obviously functionalism has it's perks. But the way he talks about OOP as if it's just some fad is really... annoying.
And of course we all know the next big thing is not functional programming, but dysfunctional programming.
I think functional programming and OOP can coexist. And I've done it in my games. Well, mostly so I don't have to scroll around as much in my files, but it's functional nonetheless.
Because what OOP does really well is complexity hiding. Otherwise called encapsulation but I think encapsulation is a bit of a loaded term due to the number of people with no idea what they're doing using it.
"Why are you refactoring this thing to use like 12 nested calls when one sufficed before?"
"It's encapsulation!"
And what functionalism does really well is centralizing all of your logic so it's easier to see and test.
So complexity and centralization. Two very different ideas. Saying one completely replaces the other is just... well, it's just nonsense. Maybe in some niche fields, but in general you're going to need one or the other somewhere. Restricting yourself to just one is like only using half of the tools you can. Why limit yourself?
So let me tell you how I do it. In my code I usually default to OOP because it's easier, you don't have to think as much because it's not centralized like functionalism. But as the code becomes more mature I'll find myself spinning out things that don't depend on much stuff into their own static functions. Functionalism.
And this has gone really well for me. To paraphrase Einstein: your code should be as functional as possible, but no more functional than that.
It's amazing how many programming arguments you can kill by just saying, "Refactor it later."
So that's how I see functionalism and OOP coexisting. I mean, what I'm trying to say is:
0 notes
impurelight · 4 years
Text
I Support Apple's 30% Cut
Because the truth is you get a lot for that 30%. You get advertising and you get a distribution pipeline and payment processing and reviews. Oh, and you don't have to worry about credit/debit cards. Like at all. That's a big one.
Now if I was a billion dollar company which made a large portion of my money on the app store I would not like paying that 30%. Because chances are I already do that sort of stuff and all I'm doing is double spending. But I'm not a billion dollar company so quite frankly, I don't care.
I'd classify myself as an indie developer and as an indie developer I don't see any problem at all. These are excellent services Apple is providing. Now, of course, there's a lot written about the over saturation of app stores, the 'indiepocalypse', but you still get a lot even if it's not what you used to get.
Do I wish it was lower? Yeah, I do. But what is low enough really? If Apple had a 90% cut yeah that would be too high. If they had a 10% cut that would be perfect. But a 30% cut. It's... meh. I don't really care too much about it.
And this is how I see the Apple problem spun all over the place. "30%" "30%" "30%". But I just don't understand why people just keep on talking about this figure.
Antitrust is about competition. Full stop. So this 30% figure is completely meaningless. Because 30% is the industry standard. It's like going to a company and saying, "You are doing what everyone else is doing and so I'm going to break you up." It is like... "what?".
Of course it's not 100% cut and dry. I think you get a discount if you use subscriptions and your subscriber pays for a year or something. And some stores have lower cuts like Epic and now Steam is experimenting with lower cuts if you sell more. But most of the time 30% is pretty reasonable.
That's not to say I support everything Apple does though. There are two clauses in the App Store rules that is giving everyone a headache. Those are that you can't use your own payment provider in your app and you can't point people to places outside the app where they can buy your services.
And yeah, you have a legitimate antitrust case there. And I do believe that at least the second clause should be shut down.
This is the real problem behind Apple and Google and Amazon and Facebook. Although, honestly it mostly only applies to Apple. So the next time I hear someone saying we should break up a company due to them charging an industry standard rate I am going to lose my mind.
0 notes
impurelight · 4 years
Text
When To Use i As A Variable
So I found this thing called Google Foobar. It's basically an internal recruiting tool for Google. It gives you a bunch of coding problems. I completed all of them easily, but that's because I got the easy problems. There's a lot of harder questions out there.
Honestly I'm a little disappointed by Foobar. There are a lot of good online code testing platforms such as Triplebyte. Foobar is like 20 years out of date. It takes forever to compile anything on the platform, and when it does you aren't told if there's a compiler error or if you ran out of time. You're just told 'test failed'. Geez, that's helpful.
As for the questions they're pretty simple. Except they have absurdly large inputs. Like one question was like, "The input console only displays 309 digits so that's all you have to worry about." Well, I'm sure glad I only had to deal with 309 digits. So your algorithm has to be pretty efficient. But you do get a lot of time. Like weeks... or months.
But anyways, this is not about Foobar. It's about what I did during Foobar. When to use i as a variable. We all love using i as a variable as a counter in a for loop. It's the only time it's acceptable to use a one letter variable. And I'm not saying that's a bad thing.
But what if you have a nested for loop? What then. It's not something you really write that often. You mostly only use a double for loop if you're doing some fancy algorithm. But this is what Foobar required me to do.
So I realized I had this rule that I never wrote down. I never use i in a nested for loop. And here's why: simply put using i in a nested for loop has led to many bugs.
Let's say the outer for loop uses i and the inner one uses something like j. Then what always happens is I get them confused or something. Even if I name one of them a normal name so like i and guardIndex or something. Then I will by accident use i.
So enough is enough. When you have nested for loops never use i. Although non-nested for loops it's still OK.
0 notes
impurelight · 4 years
Text
July 29 Update
First of all I added two new campaign maps and 1 new trial map. The campaign maps are Nothing Ventured and Ghosts Of The Past.
Poisoning the well is actually a pretty interesting map. You start with factories even though your opponent doesn't, but it's still pretty hard because the AI has so many units. Plus the AI will spawn more units. The trick to this map is to not let the AI capture your buildings. If you just defend and don't pick off the infantry that try capturing it gets way harder.
Then there's the new trial map: This Island Isn't Big Enough For The Four Of Us
So this is just a 4 player map of another map I made early on (This Island Isn't Big Enough For The Two Of Us) plus fog of war. It's not that hard.
So next up is the new art I made. All of the buildings now have ambient occlusion baked in (it's when two surfaces come together it makes a shadow). Here's a before and after:
Before:
After:
As you can see in the before image it looks like the buildings are just floating whereas the second picture looks much more appealing due to the subtle shadows. It may actually look, dare I say, nice.
Also another change is the forests are a bit taller and overlap the tile that is above them. The way I did this is the forests now count as buildings. I mean, you can't capture them of course, but they use the same part of the game that allows me to do this with HQ's.
There's also a new turn animation:
I thought I copied this animation from somewhere but I can't find any other new turn animation that looks the same. Although it does have a striking resemblance to the Advance Wars 2 new turn animation.
There's also some tweaks to the Mission Debrief. Specifically we now display the time required to beat the level and the level name.
Also when you long press on a unit it will actually cycle through the terrain and unit danger info.
Which could be useful.
Here are some other improvements:
Updated Recon sprite
Now units can spawn at the end of the turn, not just the start
Improved scrolling between trial drawer/level selecter
Enabled ability to hide wave counter on some maps (716d1dba)
Disabled merging stats
Bug fixes
Fixed issue with camera moving while we zoom in
Improved Z position of units while moving to not overlap sprites incorrectly
Balance
Cruisers no longer use torpedos to attack subs, they use depth charges. This also means to attack battleships they have to use flak cannons which are not good.
Based on feedback machine guns no longer can hit sea units (but tanks can still) (54661beb)
For more information including builds go to https://www.patreon.com/banalitywars.
0 notes
impurelight · 4 years
Text
How I Made A Dysfunctional Language In The JVM
Part 1: Introduction
I remember when I first considered making my own language. I was googling how to make an abstract static variable in C#. Turns out you can't. Why? Don't know. You just can't. So this was pretty annoying. But what was even more annoying were the programmers that said not only that you couldn't but you also shouldn't.
They gave some flimsy justification about how it broke OOP or something. It was infuriating. On that day I saw the truth. These languages that were the blueprints of modern programming were just as flawed and opinionated as I was. They weren't better, they weren't worse they just were. And on that day I swore I would write my own language. One where I was in charge.
...
But you know, writing a language is hard. And C#... it's not perfect, but it's good enough. So I let my dream sit on the sidelines for several years.
But one day I saw this coding event called Code With Friends. It was one month to code whatever you want. And I was like, "Hey, you know that language you wanted to make since forever ago? Why don't you just make it?" And then I was like, "That sounds like a good idea." So I did. I entered and made a new language called Muse. And here's how I did it.
Part 2: People VS JVM
So to make a language you need to do two things. First you have to transform the code you write into what's called an abstract syntax tree. And then you have to transform that into instructions that the computer can actually understand, in my case JVM bytecode.
Step one is not too hard. I ended up using a program called ANTLR to do it.
ANTLR... let's just say if I had to do this project over I probably wouldn't use ANTLR. It's buggy. I'll be like, "What are you doing? That is obviously an addition operation!" And ANTLR will be like "No, no, no, I see an assignment operation." despite the fact that the code does not look anything like an assignment.
It is frustrating. And to top it all off the debugging tools for ANTLR are almost non-existent. The tool I used was this IntelliJ plugin. It would only tell you the raw output, not how it got there, but it was good enough. Although the plugin did occasionally crash IntelliJ.
So once you have the abstract syntax tree you have to write JVM bytecode. I used this blog post about writing hello world in the JVM to get the structure of a JVM class file. In fact I started my project by just hard coding the code from the post in my program.
So apart from the various metadata such as how many bytes your code is and the header which says 0xCAFEBABE a JVM file has basically 3 parts. The 'constant pool' part, the actual code, and attributes for the code. It's a big of a simplification. If you want to learn more go read the official JVM documentation here and here.
Anyways the constant pool as you might expect holds constant strings. In fact it's basically a grab bag of different constants. But it's most important job is to tell the code which methods/variables each class has and their type.
So then you have the code. If you've worked with assembly code at all you know what to expect here. The only difference is there are no registers, only a stack. So for example to add 1 and 2 together you'd push them both onto the stack and then use the add operation which would pop 1 and 2 and then push 3 onto the stack.
It's pretty neat. I mean, it's not the most efficient thing in the world. There is a command dup and all it does is duplicate the top value on the stack, but it does simplify things a bit.
And now lastly there's the attributes. Most of the attributes are optional. But there is one that is not. That is the Stack Map Table. This one took me forever to figure out. Basically whenever you use a jump instruction (so in an if or a while or a goto (which I really wanted in my language)) you have to use the Stack Map Table to tell Java what should be the current state (in terms of what's on the stack and what variables are defined) at that instruction address.
I mean, there's technically a flag -noverify which makes it so you don't have to have a Stack Map Table, but this pops up a scary warning about the flag being removed in a future version of Java.
So for the longest time I couldn't get the StackMapTable to work. I should probably mention the javap -v FILE_NAME command. This actually prints out the entirety of the JVM class file in a surprisingly readable way.
It was a lot easier than using a hex editor to view the files, that's for sure. In fact the strategy I was using was write a program in Java, compile it, view the JVM class file, and then copy it in my language. And this worked really well.
Until I hit the Stack Map Table. It didn't make any sense how the JVM was generating the values to put in the table. But after sleeping on it I finally got it.
The stack map entries don't hold the actual instruction numbers. They hold the instruction relative to the last instruction subtracted by 1 for whatever reason. So finally I got it working.
So that's it. You can view the project here. It's not fantastic. I mean, it doesn't support basic things like 64 bit ints and orders of operation. But for a month of work I'm pretty proud of it. And it supports things that some other languages don't support. Things like: variables that start with a number (a worryingly high number of languages don't support this), do while (not supported in python), goto statements,
)
unix directory syntax for global variables (like use ../globalVar to access something in global scope, it always bothered me how you can access a global variable identically to a local one and they can have the same name too, that's a bug just waiting to happen), named return types (it always annoyed me to no end when I had a function that returned a bool. What is it returning? If the operation succeeded? Some information about the operation?), and there are no constructors which brings me to...
Part 3: A Dysfunctional Language
This is a class in C#.
And this is a function in C#.
So this is a class.
And a function.
A class with two variables.
A function with two variables.
A class.
A function.
Class.
Function.
Are you getting it? These are not two separate things. This is one thing. And it's called a Dysfunction.
This is one of the epiphanies I had. A class and a function are fundamentally the same thing. We just use different syntax for each and under the hood they're treated a little differently.
So what if I made a language where you define a function the same way you define a class? Well, version 1 of Muse actually did just that. But I was never happy with it. Because you get a class file whether you want it or not and a random function.
So version 2 of Muse I did away with that entirely. No more functions. Only classes. But what if you actually want to use a function. Something like a square root function? Well, we can do that.
Simply instantiate a class (let's call it squareRoot), do some work in the constructor, save that work to a variable (called squareRootValue) and get that variable in the caller (which in Muse can be done on the same line we create the object). Easy.
This is what Dysfunctional Programming is. Will it take off? Well, probably not in the JVM because we have to make new objects on the heap which is much slower than on the stack.
But if I were to port this to something like LLVM and make it so dysfunctions that aren't assigned to a variable are allocated on the stack sure, why not?
Dysfunctional programming could be the next big thing.
0 notes
impurelight · 4 years
Text
July 8 Banality Wars Update
It's hard to believe it's already been 2 weeks since my last update. Time flies, right? Anyways, despite the incredibly short time period between updates there is a lot to cover. It even surprised me how much stuff there was. So here goes.
First there's the two new maps: Ghost In The Machine and Nothing Ventured.
Ghost In The Machine is a bit of an interesting map as you don't have any starting factories. Your only option is to steal a factory from the enemy. Nothing ventured goes one step further. Not only do you not have any starting factories but you also can't capture factories.
This makes the level pretty tricky despite being able to beat it in only 6 turns. It harkens back to the old Advance Wars maps where you'd get out by the skin of your teeth.
Next up is the new trial map Island Hopping.
I knew I wanted to do a map with a bunch of small islands a long time ago but I never knew what that map would look like. Well, I finally made it. It's pretty fun taking back the islands one by one.
Next up is the new mission debrief screen.
The old one was some random placeholder thing trying to copy a mobile game with the stars. I don't know what I was thinking.
But now the debrief screen has been completely redone with a ton of stats that are oddly satisfying to see. "Ooo... Cost destroyed vs cost damaged. I have no idea what that means, but I love it! (I mean I do know what it means, I just don't know why it's significant)" I think it's just interesting to see how much better you are than the AI. Because the AI will just let their units die resulting in 'Value Defeated' being very close to 'Value Damaged'. But the player will actually heal their units and play it cautiously resulting in 'Cost Destroyed' being significantly lower than 'Cost Defeated'.
You can also see this by clicking on the completion button on the LevelLoader as long as there isn't a level in progress.
The only thing I don't like is the screen is missing the time it took to beat the level, the actual level name, and the date you completed the level (when viewing on the LevelLoader). I might just add these in later.
Now there's a medium tank. It uses the old tank sprite. The normal tank now uses a new icon.
I may have to adjust the size of some of the normal units because they all look bigger than the normal tank now.
Also new (as you may have already seen) is we can change the colour of the map border. So gold = beat, bronze = complete using cheats or something, grey (the previous colour) = unlocked, and dark grey = locked.
Those are the main changes. There's also a lot of little changes like long pressing on a unit that moved displays danger info.
The settings and trial drawer button are in the top right (I'll probably make it nicer looking in the future) and I removed the trial drawer (which wasn't even rendering properly in builds).
now turns and money is displayed in the menu. It's just temporary until I figure out a better place to put it.
Also the cycle button is hidden when zoomed in and the menu and cycle button are not clickable during your opponent's turn. And there's a bunch of other bugs which I fixed.
If you want to try out the latest builds check it out on my patreon.
0 notes
impurelight · 4 years
Text
Will Macs Run On ARM?
So at WWDC Apple announced they are moving away from Intel. But they never said if they're moving towards ARM. They only said they were moving to 'Apple Silicon'.
Now Apple does have a habit of making up terms. Logicboard instead of Motherboard. Flash instead of SSD's. It is possible that 'Apple Silicon' just means 'Apple made ARM CPU's'. However it could also not.
What if Apple were to drop the ARM instruction set entirely? Design their own instruction set.
So for the uninformed ARM is not a type of CPU. Well, they make CPU's but that's not what we're talking about. When we say ARM we refer to the ARM instruction set. This is the list of commands you can give the CPU and it'll do work.
Now I believe all of Apple's current chips run using the ARM instruction set. But will this always be the case? I mean, what better time to change instruction sets than at the same time that you're already transitioning between instruction sets?
Now, I can't think of that good of a reason why Apple would need its own instruction set. They could probably add some instructions to make things more efficient. Although that is a lot of work to go through just for a little optimization.
Or maybe they'll go a hybrid approach. Use the existing ARM instruction set but add and remove things from it year after year until it's something completely different. If they haven't done that already, I mean.
0 notes
impurelight · 4 years
Text
Banality Wars Progress Update For June 24
This month the biggest thing was the AI improvements. First of all it is no longer so keen to spam infantry. The main reason for this before was the AI would assume that our infantry could just casually walk up to and capture any building on the map. If you're the only person on the map that's true. But if there's like an enemy tank there you start to end up with problems. So this would make the AI think infantry are far more valuable than they actually are.
So what I did was implement a nearest neighbour algorithm to determine which buildings we can capture. Basically from every building we compute the closest production building or unit.
The lines in the above image visualizes this. Each building has a line pointing to its closest neighbour.
We then only compute the desire to build infantry units based on the buildings where our team is the nearest neighbour. I might actually do a more detailed write up on this later. It's quite complicated.
The other big AI improvement is the AI can now save up money. Before it had to use up as much money as it could every turn. Although this has contributed to the building too many rockets problem again. Will have to figure out a way to fix that.
Another improvement is the new window animation system. I was never happy with it before with it animating from where you click. Although it is impressive on a technological level, it wasn't that cool. So now I added a more standard animation.
So here are the maps...
The rest of this article as well as playable builds for Windows and Android are available on my Patreon.
0 notes
impurelight · 4 years
Text
Active Vs Passive Stories
I have a hypothesis on how TV shows work. Assuming they start out good they always get worse and worse as the seasons go on due to having to constantly one up themselves. And in some cases even earlier. If the writers don't have any clear ending in mind they just have to just keep on adding more and more unrelated random sub plots.
The first example of this was Arrow. It had a great season 1. Great season 2 too. But after that it started to go off the rails a bit. And I thought that this was happening to another show, Agents of Shield. So I stopped watching season 6. But then I saw a comment saying how the first episode of season 7 was pretty good so I watched it. And it was pretty good.
Now this does not invalidate my previous hypothesis, but it does make me think. What happened to Agents of Shield in season 6? Or the one episode of it I actually saw. And I think I have an explanation. Active and Passive stories.
An active story is one where the protagonists are actively doing something to solve their problems. A passive story is one where they are not. I cannot stand passive stories. Like even 5 minutes of that stuff and I'm out. It's why I hate those movies and TV shows where the main character is in school. It's just... how does anyone possibly watch this? It's soooo boring.
Agents of Shield is probably one of the most active shows I've ever seen. That's why I love it. Every single episode, every single scene really, the protagonists are actively moving towards their goals. They're not just taking in the sights and sounds.
This also explains why I did not like the first half of season 5 with space. It was very passive. The protagonists were not doing anything to accomplish their goals. There was just world building for this space station. I hate that.
The more I think about it the more I'm starting to think how predictable I am. The more active a show is the more likely I am to like it. There's almost a 1 to 1 correlation. Well, apart from all those stories that jump the shark.
I wonder if other people are as predictable as me. Anyways it's something I'll definitely have to keep in mind when writing stories
0 notes
impurelight · 4 years
Text
Banality Wars Updates
I have a game I'm working on called Banality Wars Carridin. It's a turn based strategy game similar to Advance Wars. I have been posting updates to my patreon here. I have beeen meaning to cross post them for some time now but I finally decided to do it. And because I'm quite behind I decided to post the past 2 updates.
Update For May 29
So I didn't get much work done this month. I got sidetracked by this Code With Friends Event. But I did do a lot still. Most notably I completely changed how the AI decides to build things. It's not perfect but hopefully it won't build so many recons now.
Also I fixed this bug:
That is there are four buttons appearing on one tile when there should be only one button with 3 buttons around it.
It was quite a pain. It was actually an issue with the buttons not being repooled properly. Repooling is a process where instead of destroying the old button and making a new button we keep the old button in a suspended state and use it again later. This can improve performance because the process of creating and destroying a button can be a little costly. Repooling is a pretty simple solution, but you have to reinitialize things correctly, as I learned. I have no idea why it was even working before. These two variables were randomly flipped and... Well, it's fixed now.
Also fixed another bug where units weren't being loaded if they got interrupted on the way to the unit they were being loaded to. That was another nasty one.
I also tweaked 2x05 (Capital Offence) and 2x06 (Reclaiming Hope) with 2x06 being completely redesigned to make it more interesting. Oh, and units can start on Landers to get the lore of that map working.
I also added the trial map 'Like Shooting Fish In A Barrel'. It's not the best map in the world. It's mostly to check if the AI unit generation (that I completely redid) is working correctly but it's there.
Also the UnitActions camera tricks have been significantly improved.
As always to play all the maps open up the console (` or double tap where the second tap is a long press) and enter the command 'unlockall' to play all the maps.
Some other improvements.
Added the 'We Have Been Spotted' check for dialog.
Building a submerged sub now only makes noise if we built it
Rockets have slightly more defense
Improved toast animations
Fix one frame error in confirm dialog
Significantly improved UnitActions focusing on click
Fixed long pressing on maps
Fixed wrong order of actions playing at the end and end game things in general
Update For April 30 (I try to post an update every 2-3 weeks but got side tracked)
youtube
The above video shows off my new testing system. I was originally thinking of including it as a GIF but the GIF was 18 megabytes. So I decided to put it on YouTube instead.
Anyways testing is the big thing I added these 3 weeks. Testing is the big thing in software development but not so much in gaming. Like, how would you even start? Unity, and presumably most game engines don't offer some easy way to test things. So instead the only way to test a game is to hire a QA team.
So I guess I was always a little scared of tests. But recently I made a contribution to Google's Flutter project and part of my contribution was I had to write a test. I tried to weasel out of it. I said, "This small change doesn't need a test." But the person reviewing my pull request got me to cave and write a test.
And it really wasn't that hard. I mean, writing a test for Flutter was hard because the entire system is just terrible. But the whole concept of writing a test and checking if the system worked properly wasn't that bad.
So I eventually thought, "Could I write tests in my game?". So I tried Unity's native testing framework. And it sucks. Tons of errors about not finding assemblies and it closed all my scenes when I ran it. But not perturbed I wondered if I could use some other method of writing tests.
And I remembered back to an asset I used: the In-game Debug Console. It's actually MIT licensed and I submitted a pull request a while back. And my pull request got it working pretty well. Maybe I could use it to run tests. So that's what I did.
The entire system is at my: ModularUI repo. I combined it with ModularUI because the testing framework relies on it to insert mock inputs and rather than maintain two separate repos with some stuff disabled in both I decided to merge them.
So when you run it it runs all the tests like in the video and outputs a report of what tests passed:
So you may be wondering, "Does it work"? Because it actually takes quite a while to write the tests. In some cases it takes longer to write the test than it does to implement the feature.
And I'd say yes, it does help. I already found two major issues: the first was UnitActions wasn't disappearing after selecting an option from a multi menu and the second was that long touches weren't being removed.
So onto the actual features.
First off there is a new trial map: Budding In.
As you can see there are three islands. The two that are connected are occupied by the AI. That leaves the player to have to bud in (hence the name) to the current battle. I actually had the idea for the map a while back but I didn't have Landers working. Now that Landers are working I can make it and it's actually pretty good.
You know it's funny, when I was playtesting this map I got that voice in my head, "You're supposed to be doing work, not playing games." Well, sometimes they are one in the same.
Similarly 2x04 (Reason In Madness) has been improved. The original plan of allowing the player to go up to the third island directly is now done. Except due to the AI being terrible it may not be the optimal solution. Like what is happening here?
I definitely have to create some tools to diagnose what the AI is doing.
There's also a new toast animation
Other things:
Fixed That Problem With The Greyscale Shader
Updated To Unity 2019.3.10
Refactored buttons: https://andrewzuo.com/post/616675484059713536/notes-on-refactoring
So that's where I am with Banality Wars Carridin. If you want to play the latest build be sure to visit my patreon.
0 notes
impurelight · 4 years
Text
Notes On Refactoring
I've been reading a lot more about clean code. And one of the things that comes up again and again is no one can agree on what clean code is. I mean they all agree if code is short, simple, easy to read, etc, etc it's good. But there's no grand unifying theory on what makes code good.
So I recently did some refactoring that I think made my code much better. And I thought I'd take a look at what I actually did and how it worked. A post mortem of sorts. Or pre mortem... Current mortem.
Anyways the code is responsible for getting all the actions you can make upon clicking a tile and displaying them to the player. The method that does this is getAndDisplayButtons(). I had originally made this a about a year ago with minor adjustments being made about a month ago when I had to add support for multiple buttons on a single tile.
But recently I noticed that the camera zooming wasn't working properly. And then I refactored that. It was just one algorithm that only worked for single tiles not multiple ones. But then there were more problems with the camera and these were more insidious. To fix these I had to change the code layout as some things were being called when they shouldn't have been.
So this is a nice diagram of what I had before:
And this is what I had after:
So much simpler. Well, actually it's a bit hard to notice because in the refactoring I managed to remove an entire method. If we add that back as well as some stuff from drawButtonsAndZoomIn() we get this:
It's a bit clearer now. The two flowcharts look similar but the after one looks a bit more streamlined. And it's difficult to tell why. If you ignore the ... node the number of regions only differs by one so why is the after one better looking?
Well, for starters there's a lot more code reuse in the second one. The second one reuses both focusOn() and zoomIn(). And yeah, I'm pretty proud of that.
But the thing I think is most important here is the linearity. In the before image we immediately have a break into 3 sections. One immediately terminates, but the other 2 go on for quite a while. Both of which actually split further later.
In the second that same split only leads to 2 sections with one immediately terminating. Then that one splits, sure, but each split is linear and short. This is why I believe the after example is so much better.
In programming the example of super linear growth is prevalent. It's in running time. An O(n^4) algorithm will be significantly slower than an O(n) even for a tiny change in the size of the input. The same goes for code. Code that is simple is significantly easier to understand even when adding only a small amount of content. This is why encapsulation is so important.
And I think that having code be linear, of only having one main 'trunk' of code that leads to many mini branches works on the same idea. The first example is sort of like having two branches of code that both branch themselves. So let's say the mental energy to keep all this in your head is something like O(n) = (n/2)^2 + (n/2)^2 as there are two parts each about half the size and we assume some super linear amount of effort to keep track of them (n^2).
In contrast the second one still has all that stuff going on but it does so while being more linear. There are less branches so it's more like O(n) = (n/2)^2 + n/2 + n/2. So here we still have to keep track of the main trunk of code (the (n/2)^2 operation), but because the rest of the code branches off from the main trunk late we can reuse all the information we already built up about the main trunk to reason about the rest of the code.
Also in the actual code the improvement is even more significant because each branch in the before example split even more later. Suffice it to say this is a big improvement, and this is why I think the second example is so much better.
Also there's the fact the second one has a pretty obvious issue: the if condition that doesn't do anything if it evaluates to true leading to extra code being called. That too.
0 notes