From 854ae471a01bb13cb73a38143f43d97a9ca62ce5 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sun, 16 Oct 2022 23:51:43 +0200 Subject: Added new draft post --- ...2022-06-28-sentiment-based-on-political-bias.md | 84 --------------------- ...2022-10-10-sentiment-based-on-political-bias.md | 84 +++++++++++++++++++++ .../2022-10-11-handling-massive-worlds-in-godot.md | 87 ++++++++++++++++++++++ 3 files changed, 171 insertions(+), 84 deletions(-) delete mode 100755 content/posts/2022-06-28-sentiment-based-on-political-bias.md create mode 100755 content/posts/2022-10-10-sentiment-based-on-political-bias.md create mode 100755 content/posts/2022-10-11-handling-massive-worlds-in-godot.md (limited to 'content') diff --git a/content/posts/2022-06-28-sentiment-based-on-political-bias.md b/content/posts/2022-06-28-sentiment-based-on-political-bias.md deleted file mode 100755 index 5b7816c..0000000 --- a/content/posts/2022-06-28-sentiment-based-on-political-bias.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: Sentiment distribution analysis based on political bias in online publications -url: sentiment-based-on-political-bias.html -date: 2022-06-28 -draft: true ---- - -I have been wondering for a long time what would sentiment differences look based on political leaning from popular publications. Is it the left that is more optimistic, center or the right. - -> Before people loose their minds, I don't care about political stuff and this is data we are talking about and not my personal feelings about it. So, before saying anything have this in mind and let data speak for itself. - -## Preparing the data - -The first step in getting stories from publications so we can start doing sentiment analysis on it. I have chosen to select 30 publications. 10 from left leaning publications, 10 from centre and 10 from right leaning ones. - -To find out leaning of a publication I will defer to AllSides website which provide a [Media Bias Ratings](https://www.allsides.com/media-bias/ratings). - -![AllSides Bias Chart](https://www.allsides.com/sites/default/files/AllSidesMediaBiasChart-Version6_0.jpg) - -The chart above is taken from AllSides and demonstrates political leaning of publications. This data changes over time and AllSides have made the revisions publicly available on their website. - -- [Learn more about Version 6](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-6-updated-ratings-npr-newsmax-and-more) -- [Learn more about Version 5](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-42) -- [Learn about Version 4](https://www.allsides.com/blog/new-allsides-media-bias-chart-announcing-version-4) -- [Learn about Version 3](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-3) -- [Learn about Version 2](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-2-updated-media-bias-ratings) -- [Learn about Version 1.1](https://www.allsides.com/blog/updated-allsides-media-bias-chart-version-11) -- [Learn about Version 1](https://www.allsides.com/blog/introducing-allsides-media-bias-chart) - - -They categorise political bias AllSides came up with is: - -TODO: CREATE A HORIZONTAL ARRAY STYLE OF CHART IMAGE - -- Left, -- Lean Left, -- Center, -- Lean Right, -- Right. - -I will group Left and Lean Left together. And the same goes for Lean Right and Right. So we end up with three groups [Left, Center, Right]. - -The list I have ended up with contains these publications: - -- Left political bias: - - BuzzFeed News (https://www.buzzfeednews.com) - - CNN (https://cnn.com) - - Daily Beast (https://www.thedailybeast.com) - - HuffPost (https://www.huffpost.com) - - The Intercept (https://theintercept.com) - - Vox (https://www.vox.com) - - Slate (https://slate.com) - - The New Yorker (https://www.newyorker.com) - - MSNBC (https://www.msnbc.com) - - New York Times News (https://www.nytimes.com) -- Center political "bias": - - Axios (https://www.axios.com) - - BBC (https://www.bbc.com) - - News Week (https://www.newsweek.com) - - Reuters (https://www.reuters.com) - - RealClear Politics (https://www.realclearpolitics.com) - - The Hill (https://thehill.com) - - The Wall Street Journal News(https://www.wsj.com) - - Associated Press News (https://apnews.com) - - CNET (https://www.cnet.com) - - Forbes (https://www.forbes.com) -- Right political bias: - - The American Spectator (https://spectator.org) - - Breitbart News (http://www.breitbart.com) - - The Blaze (https://www.theblaze.com) - - Daily Caller (http://dailycaller.com) - - Daily Mail (https://www.dailymail.co.uk) - - The Daily Wire (https://www.dailywire.com) - - Fox News (https://www.foxnews.com) - - The Federalist (https://thefederalist.com) - - New York Post Opinion (https://nypost.com/opinion/) - - OANN (https://www.oann.com) - - - - - - - diff --git a/content/posts/2022-10-10-sentiment-based-on-political-bias.md b/content/posts/2022-10-10-sentiment-based-on-political-bias.md new file mode 100755 index 0000000..fc03a5e --- /dev/null +++ b/content/posts/2022-10-10-sentiment-based-on-political-bias.md @@ -0,0 +1,84 @@ +--- +title: Sentiment distribution analysis based on political bias in online publications +url: sentiment-based-on-political-bias.html +date: 2022-10-10 +draft: true +--- + +I have been wondering for a long time what would sentiment differences look based on political leaning from popular publications. Is it the left that is more optimistic, center or the right. + +> **Before people loose their minds**, I don't care about political stuff in the context of this post and this is data we are talking about and not my personal feelings about it. So, before saying anything have this in mind and let data speak for itself. + +## Preparing the data + +The first step in getting stories from publications so we can start doing sentiment analysis on it. I have chosen to select 30 publications. 10 from left leaning publications, 10 from centre and 10 from right leaning ones. + +To find out leaning of a publication I will defer to AllSides website which provide a [Media Bias Ratings](https://www.allsides.com/media-bias/ratings). + +![AllSides Bias Chart](https://www.allsides.com/sites/default/files/AllSidesMediaBiasChart-Version6_0.jpg) + +The chart above is taken from AllSides and demonstrates political leaning of publications. This data changes over time and AllSides have made the revisions publicly available on their website. + +- [Learn more about Version 6](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-6-updated-ratings-npr-newsmax-and-more) +- [Learn more about Version 5](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-42) +- [Learn about Version 4](https://www.allsides.com/blog/new-allsides-media-bias-chart-announcing-version-4) +- [Learn about Version 3](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-3) +- [Learn about Version 2](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-2-updated-media-bias-ratings) +- [Learn about Version 1.1](https://www.allsides.com/blog/updated-allsides-media-bias-chart-version-11) +- [Learn about Version 1](https://www.allsides.com/blog/introducing-allsides-media-bias-chart) + + +They categorise political bias AllSides came up with is: + +TODO: CREATE A HORIZONTAL ARRAY STYLE OF CHART IMAGE + +- Left, +- Lean Left, +- Center, +- Lean Right, +- Right. + +I will group Left and Lean Left together. And the same goes for Lean Right and Right. So we end up with three groups [Left, Center, Right]. + +The list I have ended up with contains these publications: + +- Left political bias: + - BuzzFeed News (https://www.buzzfeednews.com) + - CNN (https://cnn.com) + - Daily Beast (https://www.thedailybeast.com) + - HuffPost (https://www.huffpost.com) + - The Intercept (https://theintercept.com) + - Vox (https://www.vox.com) + - Slate (https://slate.com) + - The New Yorker (https://www.newyorker.com) + - MSNBC (https://www.msnbc.com) + - New York Times News (https://www.nytimes.com) +- Center political "bias": + - Axios (https://www.axios.com) + - BBC (https://www.bbc.com) + - News Week (https://www.newsweek.com) + - Reuters (https://www.reuters.com) + - RealClear Politics (https://www.realclearpolitics.com) + - The Hill (https://thehill.com) + - The Wall Street Journal News(https://www.wsj.com) + - Associated Press News (https://apnews.com) + - CNET (https://www.cnet.com) + - Forbes (https://www.forbes.com) +- Right political bias: + - The American Spectator (https://spectator.org) + - Breitbart News (http://www.breitbart.com) + - The Blaze (https://www.theblaze.com) + - Daily Caller (http://dailycaller.com) + - Daily Mail (https://www.dailymail.co.uk) + - The Daily Wire (https://www.dailywire.com) + - Fox News (https://www.foxnews.com) + - The Federalist (https://thefederalist.com) + - New York Post Opinion (https://nypost.com/opinion/) + - OANN (https://www.oann.com) + + + + + + + diff --git a/content/posts/2022-10-11-handling-massive-worlds-in-godot.md b/content/posts/2022-10-11-handling-massive-worlds-in-godot.md new file mode 100755 index 0000000..9603022 --- /dev/null +++ b/content/posts/2022-10-11-handling-massive-worlds-in-godot.md @@ -0,0 +1,87 @@ +--- +title: Handling big worlds in Godot by splitting and lazy loading chunks of it +url: handling-big-worlds-in-godot.html +date: 2022-10-11 +draft: true +--- + +**Table of contents** + +1. [Handling lazy loading in 2D world](#handling-lazy-loading-in-2d-world) + 1. [Player movement](#player-movement) + +> Because these examples are exported from **Godot to WebAssembly** and the packaging produces **large files**, you will need to **click to lazy load them** + +I have seen a couple of examples on the net, but never really a comprehensive guide how this would be achieved. My solution is nowhere perfect, but it will get you started. This code is also not optimized, so buyer beware. + +For the sake of simplicity, I will keep the terrain plain. I have been working on a terrain generation tool in my spare time, but due to the other obligations, that project was put on the back burner. If you however interested in it you can check it out on my personal Git repository [https://git.mitjafelicijan.com/village-creator.git/](https://git.mitjafelicijan.com/village-creator.git/). + +![Village Creator](/assets/godot-dynamic-tile-loading/village-creator.png) + +It's using a node system to generate a terrain mesh, and it's utilizing cellular automata for special effects like sand erosion and wind erosion, etc. Example of using cellular automata rule in an image below. + +![Cellular automata](/assets/godot-dynamic-tile-loading/cellular-automata.png) + +As I mentioned previously, still far away from being useful. Always, enough about that. Let’s move on to the topic of this post. + +## Handling lazy loading in 2D world + +To simplify things, we will try doing in 2D world first. It makes for a simpler exercise and eliminates a lot of complexity that comes with additional axis. + +### Player movement + +First, we need to take care of player movement. I will not go into many details here, since there are plenty of good tutorials on this topic on the interwebs. Suffice it to say, I created a [KinematicBody2D](https://docs.godotengine.org/en/stable/classes/class_kinematicbody2d.html) node that gives us goodies like `move_and_slide` and added input maps for [move_up, move_down, move_right, move_left] movement. + +```gdscript +# Player2D.gd + +extends KinematicBody2D + +# Exported variables. +export var speed = 300 + +# Utility variables for later use. +# Can be ignored for now. +export var player_scale = 1 +export var camera_zoom = 1 + +# Internal variables. +var velocity = Vector2.ZERO + +func _ready(): + # Can be ignored for now. + $Model.scale = Vector2(player_scale, player_scale) + $Camera.zoom = Vector2(camera_zoom, camera_zoom) + +# Executes on every physics frame (60, 144, etc). +# This game has vsync enabled. +func _physics_process(delta): + handle_player_movement() + +# Handles player movement. +func handle_player_movement(): + velocity = Vector2.ZERO + if Input.is_action_pressed('move_right'): + velocity.x += 1 + if Input.is_action_pressed('move_left'): + velocity.x -= 1 + if Input.is_action_pressed('move_down'): + velocity.y += 1 + if Input.is_action_pressed('move_up'): + velocity.y -= 1 + + # Make sure diagonal movement isn't faster. + # Therefore vector needs to be normalized. + velocity = velocity.normalized() * speed + velocity = move_and_slide(velocity) +``` + +[Read more about vector normalization.](https://www.fundza.com/vectors/normalize/) + +`$Model` is just a sprite loaded and positioned into the scene. For the background, I again loaded just a normal sprite and positioned it to center. This makes it easier to test if the movement is working properly. Background will be removed when we will start dynamically loading the world. + + + +Code for player movement can be [downloaded from my Git server](https://git.mitjafelicijan.com/big-worlds-godot.git/snapshot/big-worlds-godot-55bcad79c11bd67e8268925d7edbf571aa31e3bf.zip). + + -- cgit v1.2.3