Page MenuHomeWildfire Games
Feed Advanced Search

Oct 16 2022

phosit added inline comments to D3552: Split the rendering WaterManager in a graphics/ and a renderer/ part..
Oct 16 2022, 5:09 PM
phosit added inline comments to D3552: Split the rendering WaterManager in a graphics/ and a renderer/ part..
Oct 16 2022, 4:56 PM
phosit requested review of D4803: Replace SharedStateResult with std::optional.
Oct 16 2022, 4:35 PM
phosit planned changes to D4730: Type-erased SharedState.

Make a "use std::optional" patch and then rebase

Oct 16 2022, 3:08 PM
phosit added a comment to D3877: ThreadPool extension -> Timer for recurrent task & adapt netClient..

The core difference is that there is a pirority queue of timed tasks instead of a pool of repeating tasks.
My idea can be implemented either way. (Using the worker threads or make a timed thread)

Oct 16 2022, 11:49 AM

Oct 15 2022

phosit updated the diff for D4798: Rewrite shore wave vertex creation.

Comments from stan and wraitii

Oct 15 2022, 12:54 PM
phosit added a comment to D3877: ThreadPool extension -> Timer for recurrent task & adapt netClient..

I have a different idea:
A ThreadPool::runAfter(timePoint, timedTask) which pushes the timedTask to a new queue priority_queue<pair<timePoint, timedTask>>. Ordered only by .first.
So there is no need for a extra timerThread and there is no restriction in how long the task can take.

Part of the point of my timer thread is to try to use woken threads, to avoid waking up costs. Would your idea give the same benefit ?

Oct 15 2022, 12:12 PM
phosit added inline comments to D4798: Rewrite shore wave vertex creation.
Oct 15 2022, 11:45 AM
phosit added inline comments to D4798: Rewrite shore wave vertex creation.
Oct 15 2022, 11:33 AM
phosit added inline comments to D4798: Rewrite shore wave vertex creation.
Oct 15 2022, 11:04 AM

Oct 14 2022

phosit added a comment to rP27151: Adds BeginFramebufferPass/EndFramebufferPass instead of SetFramebuffer..

Should there be a RAII wrapper?

Oct 14 2022, 7:15 PM
phosit requested review of D4800: Format FSM.
Oct 14 2022, 9:07 AM
phosit requested review of D4798: Rewrite shore wave vertex creation.
Oct 14 2022, 12:27 AM

Oct 10 2022

phosit added a comment to D4770: Multiplayer saved games.
In D4770#204298, @mbusy wrote:

Yes it works as you described.
Some things i would change:

  • Single-player > Matches > Load Game directly starts a game. Multiplayer > Host Game > Load Game does not. This should be consistent.

I did that to give the players (in multiplayer mode) the possibility to edit the settings a bit before launching the saved game, to make sure that everyone has the correct civ. I don't really think that it's useful for single player though, as you will always fall back on the civ that you were playing. I could very well remove the load game button for the single player setup menu (I'll bring that up again in one of the following points)

Oct 10 2022, 6:01 PM

Oct 9 2022

phosit added a comment to D4664: Non-local condition_variable.

@wraitii I'm thinking about only moving m_Kill, m_Mutex and m_ConditionVariable to Impl and don't do anything to PopTask. The advantage over the current state would be that we can call notify_one.

Oct 9 2022, 4:09 PM

Oct 8 2022

phosit added a comment to D4796: Reduces uniform size for Canvas2D shader.

I don't get what you meen by that.

I mean we could have a class that might accept an arbitrary type and bind it properly to renderer backends. For example:

class CShaderProgramGraphicsContext : ...
{
public:
    CShaderProgramGraphicsContext(Renderer::Backend::IDeviceCommandContext* deviceCommandContext)
    // ...
    void SetUniform(const ReloadableHandle handle, const CColor& color)
    {
        m_DeviceCommandContext->SetUniform(GetBindingSlot(handle), color.AsFloatArray());
    }
    // ...
};
Oct 8 2022, 4:22 PM
phosit added a comment to D4796: Reduces uniform size for Canvas2D shader.

There should be a SetUniform which takes a Vector2D to initialize(conceptualy) a vec2.

Yeah, I was thinking about that as well. But the renderer backend shouldn't know about client types.

span is also a client tybe. ;)

Oct 8 2022, 3:58 PM
phosit added a comment to D4796: Reduces uniform size for Canvas2D shader.
In D4796#204232, @Stan wrote:

Shouldn't the description be use vec4 + vec2 instead of mat2?

Semantically I use mat2, but I pass it via vec4 to save binding slots.

Oct 8 2022, 2:27 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

last version contained changes to extract.pl

Oct 8 2022, 12:56 PM

Oct 7 2022

phosit requested changes to D4617: Restrict access for Read/WriteFile functions.

There are errors if i go to Multiplayer > Host Game > Continue and then press Back or Start Game!.

Oct 7 2022, 8:27 PM
phosit updated the diff for D4739: Return terrain reference from CWorld.

Lint; 2 -> 2.f

Oct 7 2022, 7:42 PM
phosit added inline comments to D4739: Return terrain reference from CWorld.
Oct 7 2022, 5:23 PM
phosit updated the diff for D4739: Return terrain reference from CWorld.

I selected the wrong reposetory

Oct 7 2022, 3:22 PM
phosit updated the diff for D4739: Return terrain reference from CWorld.

Do only one thing... It is easyer to review.

Oct 7 2022, 3:11 PM
phosit added inline comments to D4773: Normalize names for ClientId in /network.
Oct 7 2022, 12:05 PM

Oct 6 2022

phosit added a comment to D4738: Allow other root XML than `entity`..

In ChildrenMap the elements are lexicographic orderd. Do we expect "Entity" and "test" to be the lexicopraphic first child?
If we expect the node to have only one child, you should ENSURE that.

Oct 6 2022, 5:44 PM

Oct 5 2022

phosit added a comment to D4786: A bit faster "state hash check".

It seems odd to me that the state hash check would be so slow to be honest.

Oct 5 2022, 3:49 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

Revert parameter reordering.

Oct 5 2022, 3:36 PM

Oct 3 2022

phosit added a comment to D3877: ThreadPool extension -> Timer for recurrent task & adapt netClient..

I have a different idea:
A ThreadPool::runAfter(timePoint, timedTask) which pushes the timedTask to a new queue priority_queue<pair<timePoint, timedTask>>. Ordered only by .first.
Since it is a single(cheap) comparison timedTasks.top().first < now multiple/every workerThread could check.
So there is no need for a extra timerThread and there is no restriction in how long the task can take.
ThreadPool::addRecurrentTask can be implemented in terms of ThreadPool::runAfter:

Oct 3 2022, 7:21 PM

Oct 2 2022

phosit added a comment to D4786: A bit faster "state hash check".

You can actually execute this in a replay with -hashtest-full=true and -hashtest-quick=true if you make it an MP replay.

Oct 2 2022, 2:13 PM

Sep 30 2022

phosit added a comment to D4770: Multiplayer saved games.

Yes it works as you described.
Some things i would change:

  • Single-player > Matches > Load Game directly starts a game. Multiplayer > Host Game > Load Game does not. This should be consistent.
  • Differentiate singlesplayer saves and multiplayer saves a bit more. Propably like the replays. Single-Player > Matches > Load Game by default only shows single-player saves but with a dropdown Multiplayer games can also be shown.
  • As we have Single-player > Matches > Load Game we should remove Single-player > Load Game. Some player may wonder if there is a difference.
Sep 30 2022, 3:38 PM

Sep 28 2022

phosit added a comment to D4770: Multiplayer saved games.
In D4770#204058, @mbusy wrote:

@phosit mh weird... I have been using this patch both from a windows desktop and an unbutu desktop, and played with a friend using it... What configuration do you use? What crash message do you obtain? I'll try to replicate your crash. I also wondered if this could be due to the fact that the patch is based on a slightly older version of the project (a month ago or so), I'll try to apply it with a more recent version of the project

Sep 28 2022, 3:22 PM
phosit raised a concern with rP26915: Fix text alignment handling of spaces around wrapping..

Valgrind reports uninitialized reads. m_EndsWithSpace is sometimes not initialized.

Sep 28 2022, 10:41 AM

Sep 25 2022

phosit added inline comments to D4790: Use atomic as buffer index in CProfiler2::ThreadStorage.
Sep 25 2022, 9:00 PM
phosit requested review of D4790: Use atomic as buffer index in CProfiler2::ThreadStorage.
Sep 25 2022, 7:44 PM
phosit added a comment to D4770: Multiplayer saved games.

It does not work for me: as soon as i hit Save as a host of a MP game the game crashes. Same for the Load Game button.

Sep 25 2022, 3:38 PM
phosit added a comment to D4664: Non-local condition_variable.

I'm not satisfied with the "selecting priority" inside PopTask. The predicate is not trivial and both mutexes are owned at the same time. Do you think this are problems? Do you have a solution?
My ideas (non of them is perfect and i omited m_Kill):

Sep 25 2022, 11:36 AM

Sep 24 2022

phosit added inline comments to D3676: Removes explicit synchronizations from MapGenerator.
Sep 24 2022, 4:18 PM

Sep 9 2022

phosit requested review of D4786: A bit faster "state hash check".
Sep 9 2022, 2:12 PM

Sep 8 2022

phosit accepted D4779: Removes drawing via IDeviceCommandContext from CMinimap.
Sep 8 2022, 8:00 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

change parameter order of PushTask
add context

Sep 8 2022, 3:16 PM
phosit added a comment to D4425: Use the threadpool for texture conversion.
In D4425#203777, @Stan wrote:

Can't you make it the responsibility of the receiver to destroy objects instead of adding the extra overhead of a unique ptr?

Sep 8 2022, 2:34 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

Revert to the one that worked

Sep 8 2022, 2:04 PM

Sep 7 2022

phosit added a comment to D4425: Use the threadpool for texture conversion.
In D4425#203777, @Stan wrote:

Can't you make it the responsibility of the receiver to destroy objects instead of adding the extra overhead of a unique ptr?

I guess an overkill solution could also be to have a destruction queue that's emptied when trying to push new tasks.

Sep 7 2022, 9:59 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

fix the actual memory leak bug

Sep 7 2022, 9:57 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

fix the memory leak

Sep 7 2022, 8:08 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

apply suggestions from Stan

Sep 7 2022, 5:59 PM
phosit added inline comments to D4425: Use the threadpool for texture conversion.
Sep 7 2022, 1:47 PM

Sep 6 2022

phosit added inline comments to D4425: Use the threadpool for texture conversion.
Sep 6 2022, 11:10 PM
phosit updated the diff for D4425: Use the threadpool for texture conversion.

Use Future to comunicate the return value and to ensure the task is stoped in the destructor.

Sep 6 2022, 11:04 PM
phosit commandeered D4425: Use the threadpool for texture conversion.
Sep 6 2022, 10:36 PM

Sep 5 2022

phosit added inline comments to rP22772: pthread -> std::thread (5/7) - Replace sdl semaphore with condition variable.
Sep 5 2022, 1:26 PM

Sep 4 2022

phosit added a comment to D4784: DummySoundManager.

A namespace can't have I prefix, because it's not an interface. As it doesn't provide a contract. Which means using namespace in such manner is much more error prone than using a real interface.

The name can also be changed.

Sep 4 2022, 9:14 PM
phosit updated the diff for D4784: DummySoundManager.

I tried to only remove the down-casts.

Sep 4 2022, 9:08 PM
phosit planned changes to D4784: DummySoundManager.
Sep 4 2022, 8:09 PM
phosit requested review of D4784: DummySoundManager.
Sep 4 2022, 7:33 PM
phosit added inline comments to D4677: span and string_view for CmdLineArgs.
Sep 4 2022, 5:56 PM
phosit added inline comments to D4677: span and string_view for CmdLineArgs.
Sep 4 2022, 1:21 PM

Sep 2 2022

andy5995 awarded D4677: span and string_view for CmdLineArgs a Mountain of Wealth token.
Sep 2 2022, 8:39 PM
phosit abandoned D4766: [WIP] PS::Execution.

I apologise to thous who put time in reviewing.

Sep 2 2022, 7:29 PM
phosit added a comment to D4766: [WIP] PS::Execution.

For now we should put ower time in improving Future and TaskManager.
When we have coroutines we should again take a look at this interface. When all compilers support coroutines we can also use libunifex.

Sep 2 2022, 7:24 PM
phosit abandoned D4682: Profiler2 lives in main().

On a second thought someone might expect the profiler to have a livetime like std::clog. Wen using CProfiler in static initialization there would be an dangling reference.
I think it would be bether to have components (HTTP / GPU) be handled by RTTI. Propably I do that in an other diff.

Sep 2 2022, 7:15 PM

Aug 31 2022

phosit added a comment to D4779: Removes drawing via IDeviceCommandContext from CMinimap.

The code in GUI is easier. But there is duplicate in Canvas2D.cpp. Could DrawRotatedTexture just compute the rotated destination and call DrawTexture

Aug 31 2022, 4:56 PM

Aug 28 2022

phosit updated the diff for D4730: Type-erased SharedState.
Aug 28 2022, 5:37 PM
phosit added inline comments to D4730: Type-erased SharedState.
Aug 28 2022, 10:57 AM

Aug 27 2022

phosit added a comment to D4773: Normalize names for ClientId in /network.

The new naming makes sense.
Does anybody know why it was called m_HostId before?

Aug 27 2022, 6:46 PM
phosit added inline comments to D4774: Fixes space correction after rP26915.
Aug 27 2022, 12:38 PM
phosit accepted D4774: Fixes space correction after rP26915.

The code is reasonable ✓
The bug is fixed ✓
The test pass ✓, and don't pass if the actual fix is not applied ✓
I don't see any new text missalignement ✓

Aug 27 2022, 11:50 AM

Aug 25 2022

phosit added inline comments to D4602: Avoids assertions in case of corrupted game saves.
Aug 25 2022, 11:19 AM

Aug 24 2022

phosit added a comment to D4751: Fix the specialness of `FindTemplatesUnrestricted`..
In D4751#203259, @Stan wrote:

@phosit it seems one cannot cast from const_iterator aka _Array_const_iterator to T* any clue?

Well the C++ standard does not specify that const_iterator is convertible to T*.

Aug 24 2022, 5:14 PM

Aug 22 2022

phosit added inline comments to rP26915: Fix text alignment handling of spaces around wrapping..
Aug 22 2022, 9:39 PM
phosit added inline comments to D4662: Fix text alignment handling of spaces around wrapping.
Aug 22 2022, 9:31 PM
phosit added a comment to rP26915: Fix text alignment handling of spaces around wrapping..

What menu is that?

Aug 22 2022, 4:29 PM
phosit added inline comments to D4730: Type-erased SharedState.
Aug 22 2022, 11:04 AM

Aug 21 2022

phosit updated the summary of D4730: Type-erased SharedState.
Aug 21 2022, 7:25 PM
phosit updated the summary of D4730: Type-erased SharedState.
Aug 21 2022, 7:23 PM
phosit added inline comments to D4751: Fix the specialness of `FindTemplatesUnrestricted`..
Aug 21 2022, 6:10 PM
phosit added inline comments to D4772: Remove some unnecesary string copy. related to substr.
Aug 21 2022, 4:50 PM
phosit updated the diff for D4772: Remove some unnecesary string copy. related to substr.

CI failed

Aug 21 2022, 4:48 PM
phosit updated the diff for D4772: Remove some unnecesary string copy. related to substr.

fix windows build

Aug 21 2022, 2:58 PM
phosit added a comment to D4730: Type-erased SharedState.

We could go even further and remove PackagedTask. The TaskManager then would hold std::shared_ptr<ErasedSharedState>

Aug 21 2022, 2:48 PM
phosit updated the diff for D4772: Remove some unnecesary string copy. related to substr.

coments from Stan and copyright year

Aug 21 2022, 2:27 PM

Aug 20 2022

phosit added inline comments to D4772: Remove some unnecesary string copy. related to substr.
Aug 20 2022, 7:52 PM
phosit requested review of D4772: Remove some unnecesary string copy. related to substr.
Aug 20 2022, 5:11 PM
phosit added inline comments to D4770: Multiplayer saved games.
Aug 20 2022, 1:32 PM
phosit added a comment to D4766: [WIP] PS::Execution.

From a 40,000ft view, libraries like libunifex already implement similar sender-receiver functionality à la the wg21 P2300 paper. Are there particular advantages of adding our own implementation of a subset of p2300 vs. adopting a library like libunifex which offers a much broader set of functionality?

I don't think that we want to depend on another library. Libutifex requires a newer compiler than we do.
If libunifex gets more approval, I'm in. After all we also have {fmt}.

Aug 20 2022, 11:29 AM

Aug 19 2022

phosit updated the diff for D4730: Type-erased SharedState.
  • template Future on return type.
  • use std::optional
  • Future does not implicitly convert the result type into its stored-type. That was considered a feature.
Aug 19 2022, 9:09 PM
phosit added a comment to D4766: [WIP] PS::Execution.

An other arguments ;)
The syntax for recurrent tasks https://code.wildfiregames.com/D3877 would be easy: syncWait(taskManager.schedule() | task | repeatAfter(duration)).

Aug 19 2022, 9:41 AM

Aug 18 2022

phosit added a comment to D4768: Fixes TaskManager number of worker calculation.

And how well does your task manager work with zero threads?

Works fine as said above.

Sory that was only a rhetorical question. I thaught it would not work. seems task-cancelation works great.

Aug 18 2022, 6:36 PM
phosit updated the diff for D4764: vector of locale in L10n.
  • Free function -> make m_AvailableLocales a const member
  • Rename member variables
  • Return const reference from GetCurrentLocale
Aug 18 2022, 6:31 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.
In D4768#202987, @Stan wrote:

numberOfWorkers < MIN_THREADS is perfectly fine.

Well it is only because of the cassert you added preventing MIN_THREADS to be 0. But then you have a logic flaw. If it can be lower than MIN_THREADS then MIN_THREADS is not the minimum bound and its name is incorrect.

Currently the name is also not perfect. It Should be MIN_WORKER.
Pyrogenesis uses between MIN_THREADS and MAX_THREADS threads. If the sound manager and userreporter and... would use TaskManager. :)

Aug 18 2022, 4:43 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.
static_assert(MIN_THREADS > 0 && MIN_THREADS <= MAX_THREADS);
numberOfWorkers = Clamp(std::thread::hardware_concurrency(), MIN_THREADS, MAX_THREADS) - 1;

As pointed by Stan it's wrong.

No Stan also didn't understand me. I think i'm the problem :(
numberOfWorkers < MIN_THREADS is perfectly fine.

Aug 18 2022, 4:16 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.
In D4768#202983, @Stan wrote:

Should be:

cassert(MIN_THREADS > 0 && MIN_THREADS <= MAX_THREADS);
numberOfWorkers = Clamp(std::thread::hardware_concurrency() - 1, MIN_THREADS, MAX_THREADS);

Else you can get numberOfWorkers < MIN_THREADS

Thats the way it is implemented right now.
MIN_THREADS; MAX_THREADS and hardware_concurrency() also counts the main thread.

Aug 18 2022, 3:58 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.

You suggest:

size_t GetDefaultNumberOfWorkers()
{
	const size_t hardware_concurrency = std::thread::hardware_concurrency();
	return hardware_concurrency ? hardware_concurrency - 1 : 0;
}
Aug 18 2022, 3:43 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.

You can set both MIN_THREADS and MAX_THREADS to zero and it will work perfectly fine.

That's not different with your patch.

Aug 18 2022, 2:38 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.

That's a not good fix, as it implicitly relies on MIN_THREADS non being zero.

Aug 18 2022, 1:57 PM
phosit added a comment to D4768: Fixes TaskManager number of worker calculation.

Why do we need an extra function GetDefaultNumberOfWorkers? Evaluating the number of workers is done in the constructor.
The problem would be solved by: Clamp<size_t>(std::thread::hardware_concurrency() - 1, MIN_THREADS, MAX_THREADS) -> Clamp<size_t>(std::thread::hardware_concurrency(), MIN_THREADS, MAX_THREADS) - 1. The the equation "Worker + main = Threads" would also make sens.

Aug 18 2022, 12:59 PM
phosit added a comment to D4764: vector of locale in L10n.

availableLocales is assigned only in the constructor. If LoadListOfAvailableLocales would be a free or static function availableLocales could be initialized in the constructor and be const

Aug 18 2022, 12:42 PM

Aug 16 2022

phosit added inline comments to D4764: vector of locale in L10n.
Aug 16 2022, 6:54 PM
phosit added a comment to D4764: vector of locale in L10n.

icu::Locale is about 200 bytes, if there is no too much vector resizing then changes make sense.

Aug 16 2022, 6:31 PM