Jump to content

'Very Easy = too hard' frustration.


Recommended Posts

I find Sandbox too easy, and Very Easy too hard.

Am I the only one?

I've installed and uninstalled this game with disgust 3 times already.

Could there not be something in-between?

The version I'm playing is the one available through Muon Package Manager, in Lubuntu, latest version.

Playing Single Player -> Matches -> Alpine Valleys (2)

My game settings are Very Easy by default, Balanced AI attitude.

But there is no balance whatsoever:  Got a first wave of attacks way too soon, and then two or three minutes later another wave, about twice the size.  I find it just impossible to survive.  Every time I try to play this I end up quitting the game;  and every third time I quit the game I uninstall;  then a month later I install it again to give it another try;  and it's the same thing.

Too bad because I like the game, the music, the art;  but it's just too impossible to win.

 

Link to post
Share on other sites
  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hey, Thanks a lot for the coding offer! For the technical part, while I understand most of it I'll let @wraitii and @vladislavbelov tell you whether it's a good idea or even applicable to th

I believe that if you watch some ValihrAnt's videos and reinstall for the fifth time, you're gonna make it. But as nifa and Nescio suggested, playing with multiple bots (some allied) can really b

Posted Images

Hello, DanW58! All I can hear is that the challenge presented by the AI keeps you motivated to keep trying again and again. :) 

No, I understand what you're saying. There had been concerns about the Easy AI being too hard (that's why Sandbox was added), but then there also were concerns that the Very Hard AI is too easy. I'm not sure if anyone else has pointed out that there is a big difference between Sandbox and Easy. Maybe the distinction could really be tweaked a bit (which isn't very hard to do), but it might be hard to find what works well for a majority of new players.

I think that an alternative solution might be to provide a better tutorial so that the newcomers really know what they have to do to win the Easy AI. I'm pretty sure that you'd only need to do one or two things differently in order to start winning against the AI. If you can post some of your replays, we can give you tips. If you don't want to do that, it's highly probable that the tips are contained in any of the following two videos:

 

 

Edited by Boudica
  • Like 1
Link to post
Share on other sites

Ah, many thanks!

That first video really turned my concepts up-side down;  I was in denial at first.  I was trying to build all the research buildings early on, like the forge, and the market.  What he's doing is setting up for massive food and wood production, instead.  And after getting through some resistance, I must admit it makes sense, as otherwise I have high tech but no people...  And this way I'll be forced to make a barracks early on, to produce units, which barracks is better than a defense tower for defense, as I can stuff a lot more ranged units in it than I can in a tower.

The second video also;  I had no idea I could produce multiple units, have control groups, much less of control groups of buildings.

But there's a lot more about this game, I feel.  Reviewing stats after a game (in Sandbox mode, mainly), I've come across the fact that the AI is doing some kind of commerce I don't know how or with whom.  I've seen some kind of haggling interface somewhere but I've no idea what it does.  Then again, now I hear that there is a manual somewhere;  I never saw it.  Is it online?

  • Thanks 1
Link to post
Share on other sites

If you are new one issue is the game speed. For example you do not have the time to hover over icons to wait for pop-ups to tell you this is a farmstead, this is a barrack etc. The same for fights, you do not know by hart how to position units and so forth. Adjust the game speed to 0.25 (game setup page) till you get familiar with units, buildings, techs and other aspects.

As for a manual, there is an in-game one and some online ones like https://play0ad.com/category/game-manual/ or https://trac.wildfiregames.com/wiki/0adManual

Link to post
Share on other sites

Thanks for the reply! I'm glad that the videos helped. ValihrAnt has many more on his channel, and watching other people play can be a good way to improve at your own game. I specifically value the fact that you are willing to abandon what didn't work in favor of something better. Trust me that there are some mistakes that almost all new players make, yet many are really stubborn and refuse to learn.

You deduced very well that one of the main goals of the game is to grow your population as fast as possible. At some point of your growth, economy techs become worth researching, yet it's often a bit later than ASAP. Also you need to balance your growth with how your opponent is growing, so that you aren't in a position when he has many more soldiers and you can no longer defend.

When you're talking about ranged units, they really are good at dealing damage. On the other hand, melee units are much better at taking damage and they don't die that fast. Having a balanced army of different unit types is consequently almost always a better choice. I'm just mentioning this because there are a lot of new players that make an army of only one unit type with the greatest damage, neglecting all other properties.

The commerce thing you've mentioned is probably either trading or bartering. You need to build a market for either of those. Once you and your ally have a market, you can produce trader units to generate resources by automatically going between those two markets. You can actually also trade between two market of yours, the more distance between them, the greater the income. To start trading, you either set a rally point from your market to the other one before you train traders. Or you can just select the traders you have and right click the two markets you want them to trade between. You can also set the proportion of different resources you're getting from the trade after selecting a market. Bartering is just an instant exchange of one resource type for another, yet there is a variable fee you pay for doing that, so it's only worth up to a certain point.

Link to post
Share on other sites

Thanks Hyperion and Boudica.

I did much better after watching those videos but eventually I was attacked by a force so big that all my towers and walls did nothing for me, and I exited the game and uninstalled for the fourth time.  darn;  I'm over 60;  I want something more relaxed;  but just not as easy as Sandbox.

  • Haha 1
Link to post
Share on other sites

you can also use the ceasefire option to have peace at the beginning, set the AI behaviour to defensive or add another player as your ally, to make it easier :)

Also if you are not already doing so, using ctrl and shift can be useful in many situations (aswell as other hotkeys)

  • Like 1
Link to post
Share on other sites
1 hour ago, DanW58 said:

I want something more relaxed;  but just not as easy as Sandbox.

Nowadays I tend to play a giant random map with a world population setting of 600 and five players, myself and four very hard Petras, each in a different team (though not locked), and a last man standing conquest victory condition. I'm not interested in multiplayer and dislike 1 vs 1 matches, because those are primarily about who's fastest, while I like developing a bit more slowly and building a nice base, with city walls etc. That said, building a strong economy is still key.

When I was new to 0 A.D., I started with playing random maps of a team of one Petra + me vs one Petra, or a team of two Petras + me vs a team of two Petras; later it became two Petras + me vs a team of three Petras or even one Petra + me vs two Petras vs another team of two Petras, and I began raising their difficulty settings. Having AI players fighting each other gave me the opportunity to gradually get used to the game and figure out what works and what didn't at my own pace.

  • Like 1
Link to post
Share on other sites
1 hour ago, DanW58 said:

Thanks Hyperion and Boudica.

I did much better after watching those videos but eventually I was attacked by a force so big that all my towers and walls did nothing for me, and I exited the game and uninstalled for the fourth time.  darn;  I'm over 60;  I want something more relaxed;  but just not as easy as Sandbox.

I believe that if you watch some ValihrAnt's videos and reinstall for the fifth time, you're gonna make it. ;)

But as nifa and Nescio suggested, playing with multiple bots (some allied) can really be another interesting way to ease the difficulty and make the game more fun. Honestly, the bots can sometimes be better team players than some of the humans.

  • Haha 2
Link to post
Share on other sites

Hello @DanW58,

if you feel comfortable digging in a game file, you could also mod the AI difficulty in binaries/data/mods/public/simulation/helpers/InitGame.js, line 47 (AI gather rate) and line 48 (build and train time). The second entry in the square brackets defines the very easy AI.

Dirty solution: unzip your binaries/data/mods/public folder on your computer, edit the file and zip the folder with the edited file again

Elegant solution: create a mod that changes AI difficulties, distributable as .pyromod or downloadable on mod.io (the wiki pages modding guide and mod layout can be helpful here)

Edited by Palaxin
  • Like 1
Link to post
Share on other sites
1 hour ago, Palaxin said:

Elegant solution: create a mod that changes AI difficulties, distributable as .pyromod or downloadable on mod.io (the wiki pages modding guide and mod layout can be helpful here)

Perhaps someone can make a "Very Very Easy" mod. 

There should also be an "Insane" difficulty level.

  • Like 2
Link to post
Share on other sites
2 hours ago, wowgetoffyourcellphone said:

Perhaps someone can make a "Very Very Easy" mod. 

There should also be an "Insane" difficulty level.

I'm thinking about it for A24. No promises though, since there are several exams waiting in the coming weeks.

It may be better however to include more difficulties in the vanilla version, since a "very very easy" AI would be interesting primarily for beginners which might not be aware of the presence of such a mod.

In general I dislike differentiating AI difficulty simply by tweaking gather/building rates instead of strategic/tactical decisions, i.e. a harder AI shouldn't be harder because of quantity in the first place, but because of intelligence. However that's a huge project on its own, certainly not within my possibilities.

Edited by Palaxin
Link to post
Share on other sites
1 hour ago, Palaxin said:

In general I dislike differentiating AI difficulty simply by tweaking gather/building rates instead of strategic/tactical decisions, i.e. a harder AI shouldn't be harder because of quantity in the first place, but because of intelligence. However that's a huge project on its own, certainly not within my possibilities.

Agreed. Though an initial iteration could be based on gather rates and such, while a later iteration could be based on strategy and tactics. 

Link to post
Share on other sites

Hi, 
there are some other things involved not just gather rates and training times.
For example, very easy ai should not be able to enter city phase. It is not recapturing structures, it is bringing less siege to the fights.

Easy and very easy ai is training less units for the attacks, but maybe thats not enough. It almost halfs the numbers.

But probably it should be even less inteligent, e.g. not researching techs, maybe no market usage ?

@wraitii thoughts ?

  • Like 1
Link to post
Share on other sites

Overall I think the main problem is that the AI snowballs better than beginner players, whatever happens.  It collects half as fast, but it can easily get twice as many units.

One interesting thing would be to limit the AI pop to a % of the Player's pop at lower levels.

  • Like 1
Link to post
Share on other sites

I've read your posts, folks, and I watched a lot of videos.  The problem with the videos is that many of them go too fast to make out what they are doing.

For example, the videos talking about making units in batches.  I tried it but I don't understand the sense of it.  If I click a unit 5 times, I don't have to wait for all 5 to be made before I can use them;  I can grab the first unit made and put it to build a house, for example.  Making units in batches makes me wait until all are made;  I see no sense in it.  So, I watched 2 or 3 videos about using shift, but I'm not using it anyways.

One of the videos mentions briefly that you can assign a producing building to a control group;  but does not show how to do it;  or at least doesn't show it slowly enough to see how it's done.  So, I'm using ctrl, but not much.

Nifa suggested I add an allied player, but I've not been able to figure out how to do it.

As far as build order, I do now try to make a lot of food and cut a lot of wood, and make more units;  but as for results, I only once won 1 game in very easy mode, and tried half a dozen times since and got wiped out by the first or second attack.  The videos, like I said, don't help much because they go too fast to be able to tell exactly what they are doing.  I don't even understand;  I can't even believe that it is possible to build so many units so fast as the AI's attack me with.  It feels to me like the game is cheating.

I play at 0.25 speed, as someone suggested, but besides making everything horrendously slow, it doesn't help much;  I still get beaten to a pulp when the attack comes and have to exit the game.

So, after about 20 videos and trying again multiple times, I'm back to square zero.

On 13/01/2021 at 3:03 AM, wraitii said:

Overall I think the main problem is that the AI snowballs better than beginner players, whatever happens.  It collects half as fast, but it can easily get twice as many units.

Alright, I don't know what "snowball" refers to, but I do feel, intuitively, there's some truth here.  Let me guess how this is programmed:  Somebody tried to figure out what THE BEST build order and THE BEST strategy is, created a super-AI, and then tried to tie a hand behind its back for the easier levels.  Right?

That's a bad decision.  Many games are fun precisely BECAUSE the AI is dumb as monkeys;  and it's hilarious to defeat.  Fighting a super-AI may be fun for people playing at insane level, but I want the AI to be dumb.  I want the fighting to be an "extra spice" added to the fun of building and exploring;  NOT the most important part of the game.

EDIT:  The problem with Sandbox is that it's not an AI anymore, if it doesn't expand or attack at all.  Levels of difficulty should go exponentially from the easiest to the hardest;  say for instance a repeating factor of 1.7.  The difficulty of Very Easy divided by 1.7 is NOT zero.  Or it should not be zero.

Edited by DanW58
Link to post
Share on other sites
46 minutes ago, DanW58 said:

Alright, I don't know what "snowball" refers to, but I do feel, intuitively, there's some truth here.  Let me guess how this is programmed:  Somebody tried to figure out what THE BEST build order and THE BEST strategy is, created a super-AI, and then tried to tie a hand behind its back for the easier levels.  Right?

Well, true-ish. The AI is actually not that great if you're a somewhat experienced competitive RTS player, but there's a big difference between the 'competitive' RTS play and the more relaxed style of play you seem to enjoy, and we ought to support both equally :) 

I believe you can 'cheese' the AI somewhat with towers and walls, if that helps.

We should probably look at reducing the AI's effectiveness for the next Alpha, though, I agree, as this is a rather recurrent problem.

Link to post
Share on other sites

Cool.  Good to hear, and glad to be understood.  For now I guess I'll go back to Sandbox and for a challenge just try to win faster.

 

EDIT:

I suppose you guys never played Masters of Orion II?  I picture you all much younger than me;  MOO2 is from the days of .. DOS.

In MOO2 you're conquering planetary systems, rather than terrain, and riding space-ships rather than horses, and researching quantum displacement devices rather than iron swords, but it's the same thing otherwise.  And that was a turn-based game, though it kept you on the edge of your chair anyhow.

The diplomatic paradigm was interesting, though, and even if it's not traditional in Age of Empire type games, I see no reason why it could not be imported or used as inspiration.

Basically,

1)  At the beginning of a game you haven't met your opponents yet, so you have NO diplomacy with them;  your diplomatic screen is blank.

2)  As you expand through the galaxy, you begin to meet your "opponents", usually one at a time.  When you do, they fill a slot in your diplomatic screen, and now you can talk to them, offer them gifts or demand gifts from them;  you can declare war, sue for peace, or suggest an alliance;  you can send spies to their territory and tell them to steal technologies, or to do sabotage, or to hide.  In this screen, you can also see how an opponent "feels about you" (in a love to hate scale);  though their feelings are not always a sign of upcoming war or peace.  They may hate you, but if you know that they fear you more than they hate you, you know they won't be declaring war any time soon;  and viceversa:  if you are weak, even if they love you and feel really bad about conquering you, they might do it anyways if it makes sense strategically.

3)  Some races are more likable than others.  The game allows you to create your own race, and one of the items is "repulsive", which makes your race automatically hated by everyone;  but the value of this attribute is a whopping negative 6 points that you can spend on positive attributes.  And there's a research item you can queue up that gives you extra points in diplomacy.

4)  Offering gifts of gold or technologies or systems to a race makes them like you more, of course.  Demanding tribute or gifts, and spying on them makes them like you less.  Occupying a system too close to their territory makes them like you less in a big way, unless you are in a formal alliance with them.

5)  When a race declares war on you, they do it verbally.  The message is not always formal;  for example "Our troops really need some target practice;  so I've instructed them to try taking some of your systems.  If we like the result, then it will be WAR.",  though the status shows 'WAR' right away.  The fact that war is not ON by default, but has to be declared, is the core of the difference.

 

I'm bringing this up because something along such lines would fit in well with 0ad, offering several advantages, namely,

a)  No attacks at the beginning

b)  When attacks come, you'll know why (declaration of war)

c)  You can choose trade and diplomacy over war, *** in-game ***

d)  Alliances are also possible in-game, but also may shift in-game, adding a new angle

Saying, because when I get attacked, in 0ad, I always ask "WHY is this happening?", and there is no answer.  It just is.

 

EDIT 2:

Just realized what people will ask:  Don't you have to eventually have war in order to win?

Not necessarily in MOO2.  There were 3 ways to win a game in MOO2:

1)  Conquering the whole "galaxy", system by system (lots of war)

2)  Conquering the world of the Antarans, a transdimensional race that's always present in every game;  but it's difficult, and you need to build a dimensional gate to get there...

3)  Getting voted emperor of the universe (no war necessary, though it can happen in times of war).  Every 50 years or so (game time) there is a vote, where all the races vote for one of two randomly selected contenders (sometimes you are a contender;  sometimes not).  To win, a contender has to get 2/3 of the votes, which is not easy.  The number of votes each race gets is per the number of systems they have settled;  so if you have 2/3 of the systems, you can vote for yourself and win.  Otherwise, you can improve your chances by having good relationships.  But most players DON'T want to win this way, and the way to avoid this win (or the war that may result from voting for the wrong opponent, as they threaten you sometimes), is to abstain.  If you abstain, it is VERY rare that you'll be voted in anyways, though it happens occasionally.  Most of the time it just prevents all parties from achieving a 2/3 majority, and thus the game continues.

Edited by DanW58
Link to post
Share on other sites
1 hour ago, DanW58 said:

a)  No attacks at the beginning

c)  You can choose trade and diplomacy over war, *** in-game ***

d)  Alliances are also possible in-game, but also may shift in-game, adding a new angle

a) Have you tried the CeaseFire option? It's different but end result is the same.

c) You can use the diplomacy window to do this?

Link to post
Share on other sites

I heard about the ceasefire option, but I haven't tried it yet.  I looked for it, but not too hard.

20 minutes ago, Stan` said:

c) You can use the diplomacy window to do this?

In MOO2 there's actually many ways to choose diplomacy over war (or the opposite).

One strategy I used which was absolutely hilarious, and it was my own invention, to get two races to go to war with each other:  I sent two colony ships into their territories, one each, timed to arrive to unsettled systems at the same time.  When the ships arrived, I told them to build a colony in a planet.  This would get ME into big trouble, if I left it at that; but what I did at the very next turn was to go to the diplomacy screen and GIVE these colonies to them, but such that... imagine they were the Darlok and the Meklar, I give the new base in Meklar territory to the Darlok, and the base in Darlok territory to the Meklar.  They are incapable of controlling themselves and not attack these new bases in their midst, and so they end up at war with each other.  It could work with only one base;  but I used two bases for extra insurance.

Yeah, the game never defaults to a war status, so if your race is not 'repulsive', and you make sure you have a respectable navy, and you use diplomacy to trade, and/or to exchange technologies, you can avoid war for the most part, if you want.  But it's not for sure;  sometimes espionage causes war, even if you were not spying, because sometimes the spies of another opponent manage to frame you.

If you are already at war, you can use the diplomacy screen to OFFER or SUGGEST a ceasefire;  but they may say NO.  The more or the sooner you ask, the worse the result is.  Knowing when to sue for peace is an art in MOO2.  You have to put yourself in the shoes of your opponent sometimes.  If someone else declares war on them, that's a good time to sue for peace, for sure.  But generally, the best ingredient is to be winning the war.  If you are winning and you sue for peace, you usually get it.  Sometimes your enemy may put a condition, like "give me system such and so as an incentive".

Link to post
Share on other sites

Hi, on game setup, you can set teams. To force the AI to make war at somone, you can set all to the same team, with the option "last man standing" (note this will probably just trigger them to immediately declare war on you).

You can also set the game to wonder victory and put yourself in the same team as the AI, this way the first to a wonder wins :) (Dont't forget to lock teams then.)

  • Like 1
Link to post
Share on other sites
6 hours ago, DanW58 said:

For example, the videos talking about making units in batches.  I tried it but I don't understand the sense of it.  If I click a unit 5 times, I don't have to wait for all 5 to be made before I can use them;  I can grab the first unit made and put it to build a house, for example.  Making units in batches makes me wait until all are made;  I see no sense in it.  So, I watched 2 or 3 videos about using shift, but I'm not using it anyways.

5 Units in a batch need less training time than 1+1+1+1+1 units

 

6 hours ago, DanW58 said:

Nifa suggested I add an allied player, but I've not been able to figure out how to do it.

in most cases the number at the end of the map indicates the number of players. You can change their team in the dropdown menu.

 

6 hours ago, DanW58 said:

I only once won 1 game in very easy mode, and tried half a dozen times since and got wiped out by the first or second attack.

Also it is important to see anticipate the attack and to be ready. You can try playing with a revealed map, so you see when they are moving towards you. If you play with Fog of war, build a wood tower in the direction that you expect them to come from, garrison it with one soldier and research the technologies there.

I think you already know, but basically you just need wood, food and houses at the beginning. Keep an eye on the population limit. Use women for berries and fields, calvary for hunting and soldiers for wood. Use the alarm ring in the civil center when you get attacked and don't forget to send them back to war afterwards.

4 hours ago, DanW58 said:

1)  At the beginning of a game you haven't met your opponents yet, so you have NO diplomacy with them;  your diplomatic screen is blank.

I think this wouldn't have much impact since you meet your opponents quite early into the game, nevertheless I agree that the Diplomacy system could use some inspiration

Link to post
Share on other sites

Good answers, all, thanks.

@Nifa,  I was not suggesting an exact copy of MOO2 diplomacy;  I was simply describing it.  Indeed, the first stage would be rather short in 0ad.

In MOO2, meeting a civilization is a bit of a big deal;  it's a first message delivery;  an establishment of diplomatic relations;  you typically stop hitting the turn key, and read about your opponent's personality, check their fleets, economy and technology tree.  A good tactic is to see what items they've researched, and what research items are denied to them, that you might have researched already, and offer them a technology swap.  This puts the love/hate bar from 55% or whatever is the default, all the way to 80%.

But that's a different game, of course, and it is turns-based.  I think the most important aspect that would be applicable to 0ad is the making of alliance versus enmity something dynamic;  something that is affected by your actions in-game, rather than written in stone during game setup.  An action such as building a tower right next to their territory could be interpreted by the AI as an act of war, while things like trade might trickle confidence into the relationship.  Then again, being too weak relative to an opponent could be an invitation for a sneak attack without formal war declaration.

In MOO2, if you attack someone without first declaring war formally, your relationships with all AI players deteriorate;  but it happens some times, with some races more than with others.  On the other hand, if you go to war with a party that is in an alliance with another, the other party is OBLIGED to go to war with you.  And they may still choose not to, but breaking the alliance in that way may lead to war with their ally.  There's all kinds of possibilities.

The main advantage, at least for me, would be to see whatever goes on as  conceivably justified.  This business of getting attacked for no reason whatsoever kind of detracts from game immersion... at least for me it does...  In MOO2 you could typically analyze the strategic and diplomatic situation in retrospect and figure out what you did or failed to do that resulted in a war that you didn't want at a particular time;  so even after you finished playing a game you are still partly immersed.  And this kind of AI is nothing requiring neural networks or dojos;  just simple rules for the most part.

By the way, what language are you guys writing this in?  I have C and C++ experience, ASM with SIMD, as well as GLSL.

Edited by DanW58
Link to post
Share on other sites
17 minutes ago, DanW58 said:

By the way, what language are you guys writing this in?  I have C and C++ experience, ASM with SIMD, as well as GLSL.

If you feel like you can drop by IRC to get the specifics.

We use C++ for the engine (Graphics, Pathfinding, Audio and some simulation components, and Javascript for AI, procedural map generation and the rest of the simulation)

I also gave an interview here https://mdco2.mini.debconf.org/talks/16-0-ad-empires-ascendant-a-floss-game/

 

Link to post
Share on other sites

Watched the interview.

Is the multi-threading done, or is it still open?

 

One thing I did back in early 2000 was a per-thread memory allocator and an inter-thread memory rotation object.

I was using Boost Threads, which back then was not part of the official Boost;  it was in early development.  And the idea came from an article in Dr Dobbs, which said basically that if you have a common allocator to all threads, each allocation call has to pass through a mutex, which is a real drag.  Another unrelated Dr Dobbs article talked about how much speed-up you can get by running array allocators under the standard allocator, and the speed-up was significant already then (should be far more significant today).

So I combined these Ideas.  First I coded a fast array allocator for single thread access;  no mutex;  put it into a class.  Then I allocated one object of this class per thread at runtime.

Now, you might ask, what about when one thread is a producer, and another is a consumer?

No problem:  I made allocated memory objects "remember" their producer thread;  then coded the virtual dtor to return the object to its producer thread, for destruction or recycling.  So the same thread that produced an object and allocated it to a fast array, would be the thread to destroy it, guaranteed.

 

The inter-thread memory rotator was an idea that came from a friend back in the 1980's who designed a traffic simulator using several microcontrollers working as a pipeline. Between the microcontrollers were memory banks that "rotated" at each iteration, such that controller A wrote output to the memory bank, and controller B read the memory bank also, but they were actually accessing separate halves of the memory bank.  Once both controllers signalled task completion, the hardware swapped the two halves of the memory bank, so that controller B could now read what controller A was writing in the previous iteration.

I implemented the same idea into an inter-thread communication object, with a size_t and two threads as template parameters, whereby the threads accessed a "common memory" (or rather, what might seem to be common memory).  This memory was actually duplicated, and the two copies could be "secretly" (internally) swapped.  So the two threads could read and write without the penalty of mutexes, and when done would call the im_done() function;  and when the object was sure that both threads were done, it internally swapped (the internal pointers to) the two copies of memory.  So, information could actually flow both ways between the threads, as safe as queues, but much faster, since you can write megs of data if you want, without mutexes, and then safely swap.  Even the swap was spared having to have a mutex, as each thread blocked as they hit the im_done() function, waiting for swap confirmation.  The logic was inherently thread-safe.

Besides gains in speed, this scheme could have beneficial side-effects in two general areas:

Exposing memory leaks, since you are in control of allocation and therefore can easily place code for debugging or monitoring what's going on.

Exposing thread balancing problems.

Promoting a clear inter-thread data flow graph, if inter-thread data objects are used exclusively, and mutexes are avoided entirely.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...