|
Thanks Gerry, that gets me a bit closer to what I’m trying to do even if I’m not using exactly the same approach. In this case what matters most is the order in which the money are spent so as soon as building the Barracs has begun you can jump to the next item in the queue if you have the money
modified 28-Apr-23 7:35am.
|
|
|
|
|
I have "various" queues. If I need to rotate over time, the angle is "queued" as a counter. During each frame (time interval / slice) the angle is reduced and applied to the object. Since my "game" can run at anywhere from 1x to 40x, it's all a function of time.
The route waypoints are queued and consumed at a rate equal to the time it took for the last one; which varies with terrain. One queue can direct multiple objects (object chain of command).
The guns have to be unlimbered before they can fire ... a queue on itself.
One queue is fatigue ... which increase with rapid gaits, and only decreases with reduced movements.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Hi, thanks for feedback
> if I need to rotate over time
I guess you can queue a lot of things.
If we talk about rotations a place where you could use that would be when you want your units to face in the direction they are walking towards. In my game the graphics are as basic as they can get. A unit is just a small square. If I were to change the graphics to something slightly better, for unit look at I would probably be using sudden changes of rotation, the method used in Blizzard RTS games.
Returning to base building... a question that has got me thinking is the problem of training low level units vs training high level units. When the AI player is far into the tech tree and has advanced units available for training it chooses to replenish the low level units lost in the battle too. ( a human in the same situation usually chooses to train only advanced units)
|
|
|
|
|
Yes, I use rotation to align the front / line of battle. They're "blocks" too, but are to scale as to front (line of battle) and depth (column of route).
In terms of cheap versus advanced units, AI could use cheap units for a diversion while the advance units attacked the primary target.
The first "phase" of each time interval is evaluating possibilities and threats; which starts with (in my case): is anyone firing on me?
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
> Yes, I use rotation...
Sounds like more than math for beginners so I really can’t engage with you in a debate about it.
Regarding your other post I think we are on the same page.
|
|
|
|
|
At the very least, one must allow 15+ seconds for any change in formation. I don't animate everything; I will show different icons on my blocks depending on the status of the block: marching; limbering / unlimbering. If you're in realtime and to scale, some movements are hard to see from a user point of view so you have to be more visible.
Nothing wrong with doing an "instant" turn; you just have to pace it properly (i.e. it still takes time; use an hour glass icon + another one on the block (which is simply text using font icons; e.g. Segoe UI Symbol / Emoji).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I think I got it figured. When a unit is killed the AI has to build another unit to make up for it. If you use the unit death event to start building a new unit you might not have the money to do it, so you have to queue the training for later. Implementing this behavior takes extra code. My guess is that in the case of the method presented in the opening post a capacity limit for units is created. As the processing moves down the priority list the capacity limit for various units increases.
The computer checks if the actual unit number the AI player has and capacity limit number match, if they don’t ( due to units dying) units are trained.
modified 30-Apr-23 12:10pm.
|
|
|
|
|
My "event" (if you call it that) happens when the loss inficted by the attacker is applied to the target. At that point, the target: maintains ground / continues to advance; is dispersed, temporarily or permanently; is shattered; is captured; is pursued; or is destroyed. The state of the various parties determines what can happpen in the next "round".
If was to spawn or seed something, it would be "triggered" here. (So, let's say I use triggers instead of events).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Say we have a set of positive integer numbers and the size of the set is always Q
For each position in the set we can define a minimum value and maximum value, both inclusive, for the value that could appear at that position in the set.
We can then deterministically sort a list of all of the distinct permutations of Q. To do so, We will sort first by the position 1 value, then (where the position 1 value is the same across multiple permutations) by the position 2 value and so on and so forth through to position Q being the least significant for the sort.
Given a single valid permutation of this type, is there a mathematically efficient way of determining its position in the sorted list, that is, without ever creating or iterating the list?
Conceptually reversing the above, given a position in the sorted list, is there a mathematically efficient way of determining the corresponding permutation, without ever creating or iterating the list?
|
|
|
|
|
Hmm, if I understand correctly, we have a list of Q positions where each one has a specific range say:
1 - [m_1, u_1]
2 - [m_2, u_2]
...
q - [m_q, u_q]
where m_1 to m_q are the minimum values and u_1 to u_q are the maximum (upper) values. A valid arrangement (I wouldn't call it a permutation) V = [v_1, v_2, ... v_q] can be "normalized" by subtracting the vector M = [m_1, m_2, ..., m_q] of minimum values. Let N = V-M be the normalized vector and R = U-M be the vector of ranges. Note that n_i < r_i.
I will change your problem to set the least significant position to be position 1 just for ease of notation. Then position of V in the list of arrangements is given by the sum:
S = n_1 + n_2*r_1+n3*r_1*r_2 + ...n_q * r_1*r_2*...*r_q-1
This is a bit like expressing a number in a "variable" base. The number of "digits" available at position i is r_i.
Mircea
|
|
|
|
|
Is the problem with dijkstra the fact that it computes not only the shortest path towards the destination but also the shortest path from the starting tile to any other tile in the search area ?
|
|
|
|
|
|
I don’t know. I was thinking if it’s good (potentially useful )it doesn’t come for free. Although I’m not sure this law of life applies to the world of programming as well. Also it’s a “good” thing you don’t need usually you only need the shortest path to the destination
modified 14-Dec-22 7:56am.
|
|
|
|
|
Nothing is free and everything is limited.
|
|
|
|
|
Yeah but sometimes what is expensive ( precious) in our terms is cheap in computer terms and vice versa what is cheap in our terms turns to be expensive in computer terms ( takes a lot of power to process) In this case you would think something good is produced that goes to waste
|
|
|
|
|
However all of that depends on how you are going to use it. And even should include questioning business requirements as to why they think they need something in the first place.
|
|
|
|
|
I see what you’re saying, just because I don’t need that potentially useful information doesn’t mean a scenario where that information is being used could not be imagined. Thanks
modified 31-Dec-22 3:10am.
|
|
|
|
|
This is basically what A* aims to avoid, trying to limit the searched area as much as possible while still guaranteeing an optimal result (as long as the requirements on the heuristic are met).
|
|
|
|
|
Write it yourself. Limitations will be, and Dijkstra solves some, not all.
..or just ask ChatGTP if it's homework.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: ..or just ask ChatGTP if it's homework.
We have learned that it is currently far from a reliable source for this kind of work.
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
|
|
|
|
|
"We"?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: "We"?
Yes, we who support members in the Quick Answers[^] section of the website. We have been watching the solutions given using ChatGPT as plagiarised answers. Half the time it does not compile, and mostly when it does, it does not work.
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
|
|
|
|
|
I cannot reply in any form or format and I cannot think; she just told me that there will be three of us.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy just curious, your way of addressing is always so sketchy, do you always expect the other person to guess the second half of the thing you’re trying to say?
|
|
|
|
|
I address developers. If it sketchy, you're not.
Half a word is all you can get, since money on the line.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|