Is it possible to display the vavle of desirability of each tile on Desirability layout?
Closed this issue · 11 comments
Describe your improvement here.
Keep in mind that UI improvements which require new texts will most likely be declined because we can only work with the original text files. Also, large UI changes will not be accepted.
I have been wondering if it is possible to display that. As the game goes on, I want to control the house to or (not to) evolve to the next level with desirability, however it's a headache to remember and calculate the values again and again.
Thank you
Possible: yes, but useful for the majority of players: no. For controlling house evolution, it's better to use access to goods and services than desirability.
Thank you! I really want to build some cities where citizens are free to get access to all goods and services and control their houses' evolution. To me, that's how a wonderful world should be.
Can you advise how I can do this feature myself if it's not on your agenda? Really like it and need it.
Thank you again,
You can do this easily by editing function draw_top_desirability.
Apply this patch for a rudimentary implementation:
diff --git a/src/widget/city_overlay_other.c b/src/widget/city_overlay_other.c
index 0178be94..6cd9f236 100644
--- a/src/widget/city_overlay_other.c
+++ b/src/widget/city_overlay_other.c
@@ -15,6 +15,9 @@
#include "map/random.h"
#include "map/terrain.h"
+#include "core/string.h"
+#include "graphics/text.h"
+
static int show_building_religion(const building *b)
{
return
@@ -454,6 +457,9 @@ static void draw_top_desirability(int x, int y, int grid_offset)
}
int offset = get_desirability_image_offset(map_desirability_get(grid_offset));
image_draw_isometric_top_from_draw_tile(image_group(GROUP_TERRAIN_DESIRABILITY) + offset, x, y, co
lor_mask);
+ uint8_t number_string[10];
+ string_from_int(number_string, map_desirability_get(grid_offset), 0);
+ text_draw_centered(number_string, x, y, 58, FONT_NORMAL_PLAIN, COLOR_BLACK);
} else {
image_draw_isometric_top_from_draw_tile(map_image_at(grid_offset), x, y, color_mask);
}
You can do this easily by editing function draw_top_desirability.
Apply this patch for a rudimentary implementation:
diff --git a/src/widget/city_overlay_other.c b/src/widget/city_overlay_other.c index 0178be94..6cd9f236 100644 --- a/src/widget/city_overlay_other.c +++ b/src/widget/city_overlay_other.c @@ -15,6 +15,9 @@ #include "map/random.h" #include "map/terrain.h" +#include "core/string.h" +#include "graphics/text.h" + static int show_building_religion(const building *b) { return @@ -454,6 +457,9 @@ static void draw_top_desirability(int x, int y, int grid_offset) } int offset = get_desirability_image_offset(map_desirability_get(grid_offset)); image_draw_isometric_top_from_draw_tile(image_group(GROUP_TERRAIN_DESIRABILITY) + offset, x, y, co lor_mask); + uint8_t number_string[10]; + string_from_int(number_string, map_desirability_get(grid_offset), 0); + text_draw_centered(number_string, x, y, 58, FONT_NORMAL_PLAIN, COLOR_BLACK); } else { image_draw_isometric_top_from_draw_tile(map_image_at(grid_offset), x, y, color_mask); }
Thank you, bro. I must confess it's much more complicated than I expected.
But I do want to get a version to have this feature.
If you are willing to help with this, please email your quotation to stucowade@qq.com, and let's discuss it.
I'd like to pay for it at a reasonable rate.
I am looking forward to hearing from you,
Yours faithfully,
Thank you, bro. I must confess it's much more complicated than I expected. But I do want to get a version to have this feature. If you are willing to help with this, please email your quotation to stucowade@qq.com, and let's discuss it. I'd like to pay for it at a reasonable rate. I am looking forward to hearing from you, Yours faithfully,
No need for quotations, here's a build that implements the above code.
To see the values, just go to the "desirability" overlay.
Thank you SOOOOOO much for your help and kindness!!!
Gonna read the codes and try to learn.
I like coding, just start to learn Python and made some small projects for my daily work.
C is really hard and deep for me....(I believe, hard and deep for most people)
Not to sound like bragging, but even though julius is a big project, it's also one of the clearest codebases around, so it should be relatively straightforward to follow.
The game begins execution on function main
in the file src/platform/julius.c
if you're interested.
The game begins execution on function
main
in the filesrc/platform/julius.c
if you're interested.
YES, I AM INTERESTED!!! REALLY APPRECIATE YOUR INSTRUCTION!!
I found myself enjoying coding and seeing it produce whatever I want---It's always a great pleasure to see my codes work well and produce what I need!!
The only problem is that I am too old to learn it thoroughly--40 yrs old already...
So only been enjoying some basic pleasure brought by some basic codings : )
Thank you again, bro, Sooo kind of you!!!
If I may just offer an observation or two: I absolutely agree on the quality (aka clarity or cleanliness) of the Julius codebase; the skill and dedication of Ms. van Schaik and others is utterly extraordinary, worlds beyond almost anything else I've seen in over 40 years of programming. The project would have been extraordinary even without the code clarity; I specifically mean that the clarity is extraordinary as well. I've read a LOT of code, and this code isn't just better, it's a shining example of what code can be if the authors apply good software engineering principles consistently.
That said, I would like to comment on crudelios' phrase "relatively straightforward to follow". I think this is true but depends on what you are comparing to. Yes, relative to other codebases of the same order of magnitude in complexity that are only of average quality. But someone who leaves out the "relative to" portion and just looks at "straightforward" might get the wrong impression.
stucowade, I see you write "I like coding", "start to learn Python", and "C is really hard and deep for me". My guess is that you are not (yet!) very experienced at programming, which is where we all start. My observation is not to get too discouraged if you find understanding the codebase for Julius to be beyond you (at least in the time you have available to study it). I've known excellent programmers who made their living at it who would have found it to be beyond them. The ability to create models in your head that allow you to understand and follow what is going on in a large, intricate C codebase is not something you should expect to be good at easily or quickly. I wouldn't be surprised to learn that, without special abilities we can't name and don't fully understand, it might be nearly impossible anyway.
Keep in mind that the C language is a structured assembler language, not at as high a level as other languages, and over the decades I've come to understand that some programmers have a MUCH easier time understanding it than other programmers. There are people with a special capability that allows them to do extraordinary things in math, or music, or languages, or memory, and I think there are some with a special capability for intricate procedural logic and the understanding of structures built from bits and bytes. Ms. van Schaik is certainly one of them, and some others of them have contributed to the project.
So, for understanding the Julius code: imagine you had just built your own canoe, and then imagine trying to understand the entirety of the internals of a nuclear submarine.
I don't mean to discourage you from looking -- anything you can learn from the experience is good, and you may be one of these people who eat up intricate C code for breakfast. There definitely are such people, and every one of them started from the experience level you now have (sometimes seemingly when they were 4 or 5 years old, but they did start there). I just wanted to caution you not to expect to pick it all up in a weekend, even with the extremely high quality of the codebase.
Nice comment @ralphcook!
Well, I was purposefully vague on the "relatively straightforward" adjective. As you mentioned, understainding Julius' codebase is straightforward compared to some projects of the same dimension, but it's still not trivial to follow. As an entire game, the Julius codebase branches off in many different directions.
However, I do mantain that starting at the main
function, it's not really too hard to understand the broad workings of the game. You have the game loop, the input events, the simulation processing and frame drawing. With a reasonable IDE, you can follow or skip some of these parts of the game and learn as you go.
I also believe that I would have delved in many other projects if only I figured out where their entry point was and understood from "top to bottom" how things worked and were related to each other.
Also, @bvschaik already knows this, but I can't overemphasise how much I learned from this project in terms of general code structure and design principles. I'm not as mentally organised myself, but I have really started using some principles found on this codebase elsewhere.
Many thanks for the encouragement!!! @ralphcook
Yes, you are right, I am a rookie in programming, who is tired of the repeating routine daily work, that's why I started my study on Python.
It opens a door for me to a brand new world!!!!
I do understand it takes time to learn a language, including English, Spanish, JavaScript, Python, or C language... : ).
I am still learning basic of C and Python, some logics are same while Python is more friendly, which is good for me.
And luckily, the Internet and AI evolution enable me to turn all those "xxxx-oriented Programmings" into "Google-Oriented" or "ChatGPT-Oriented" programming.. : )))
After some study of the basics, I built some small projects with the help of Google or ChatGPT and tried to understand the codes, that's how I study Python..
I am still far from understanding these codes in this patch, but let's see...
I like this game (Caesar III), as well as the patch Julius, and hopefully, I will be able to do some contribution to the REPO one day...