Two Stupid Kharkov Questions

Discussion relating to Kharkov: Disaster on the Donets

Moderators: Run5 Staff, SSG Staff

Postby Roger Keating » Sun Mar 14, 2010 8:48 am

Speed is one of those imaginary items that haunt the C++ programmer. There are techniques of knowing how the compiler looks up jumps to sub routines, for example, that anyone in the business of writing 3D applications has to know.

Then there are the numerous settings that you can give the compiler to decide debugging information or speed. I doubt that Codeblocks is inherently faster than Visual Studios but I would look to all the compiler options and try them out and see the difference in speed with each one.

In the past I would spend months on optimizing code although that happens seldom these days as the machines are so fast. When using the combat advisor it moves every unit to every possible location on the map and tests the combats that could occur there and will return within a second (usually). This routine could be made more efficient by shifting non combat units away from targets and allowing a better result but I have found that the general routines are really good enough. I have the improvement down as something I may do one day.

It is good that you are enjoying the experience. It is one area where practice is the only way to get better.
User avatar
Roger Keating
SSG
 
Posts: 1792
Joined: Sun Aug 03, 2003 3:32 pm
Location: Sydney, Australia

Postby hank » Thu Apr 15, 2010 4:20 am

I'm still hammering away at C++. I've had a few breakthroughs with some code projects I've been playing with. I finally got a version of the Mersenne Twister to work with my PRNG "test stand". I never had a problem getting the built-in C++ rand() function to work with it but couldn't get the basic older M.T. programs to work.

I've run several 100,000 die roll test runs with both and the MT does give a little tighter result (based on the calculated 2-dice roll probabilities ... ie. 2's-2.78%; 3's-8.33% ... etc etc.). I'm going to get brave and do a million roll run. My little test stand will capture all the rolls and give stats at the end. ... kinda fun

Does the K:DotD / AtD engine use the rand() method or does it have its own custom method? ... maybe one a mathematician such as yourself would write.
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Postby Roger Keating » Thu Apr 15, 2010 10:00 am

I have always used rand() to generate the random numbers, and the AI uses the same one as well.

It is very, very, difficult to test whether a random generator is truely random or slightly off. This is a subject that has resulted in books being written and is used today by those generating results for gambling institutions.

In games I show a tabulation of the die rolls for those who want to claim that they had bad luck but it is usually the critical rolls that count. I was once accused of making the die rolls in critical combats bad for the human and good for the AI. If I was that good I would be programming in some top secret facility rather than writing games.
User avatar
Roger Keating
SSG
 
Posts: 1792
Joined: Sun Aug 03, 2003 3:32 pm
Location: Sydney, Australia

Postby hank » Fri Apr 30, 2010 3:34 am

I've been watching the forums here and at the Matrix and the issue of die rolls is coming up again. I can feel their pain. I have experienced games where nearly all my critical assaults got bad rolls where the opponent (pbem games in this case), a human was consistently getting good rolls in what I considered critical assaults. I can identify with what some are feeling. Is it possible some computers are seeding the PRNG in a way to give better results? Is the computer's clock time milliseconds being used to seed the prng?

But, my actual reason for being here is that I played AtD2 through 19 turns as Axis against the AI. I noticed after turn 19 the die rolls stats all fell within a fuzzy range of ~3.3 to ~3.7 which is in that sweet spot near 3.5; Except for one catagory, Retreat rolls and it was averaging ~4.1. That's a big shift. Does the die rolls for retreats work the same or is something else going on there?

I'm still studying PRNG's. I have several versions now of the Mersenne Twister and have conducted numerous runs of 100,000 to half a million die rolls. They all come in very close to the probability they should. But then (on the other hand) when I do large runs of the rand() method they do about the same. I'm getting ready to play with some linear congruential RNGs. That should be fun.
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Postby Roger Keating » Fri Apr 30, 2010 8:16 am

Retreat rolls can be affected by positive artillery shots against the hex that has the combat. Each hit adds +1 to the retreat die roll and this is taken into account when displaying the results so 3.5 is probably not what you would expect.

The combat roll, however, can't be affected and should be around 3.5.
User avatar
Roger Keating
SSG
 
Posts: 1792
Joined: Sun Aug 03, 2003 3:32 pm
Location: Sydney, Australia

Postby hank » Fri Apr 30, 2010 10:44 pm

Thanks again. I'm sure that was probably in the manual somewhere.

Oh, by the way, it appears we have an incursion. Someone trying to sell jewelry.

:?
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Postby hank » Tue Sep 21, 2010 7:06 am

Been a while since I posted here. To verify what RK said above, I've developed some C++ routines that will roll a die as many times as I want and with a sampling of 10,000 to well over a million rolls (calls to rand()), it aways lands at around 3.498.... .... so close to 3.5 its scary.

And since I'm here. I had a question for RK.

I've come to a cross roads and I thought I'd ask your opinion.

What flavor of C to learn. C++/CLI or just C++ or C#? (for game programming)

So far almost all my C++ has been unmanaged code for Win32 API and simple console apps. Now that I've started to get more into the Windows
programming, the .NET issue has come up and I want to concentrate my efforts in a rewarding direction.

Do you have any opinions (or any experienced programmer out there)?

I am using Code::Blocks (10.05) as you recommended but I also pull up Visual C++ Express 2010 at times to stay fluent in a visual IDE.

(ps - I know this is a little off topic and if this thread needs locked, I understand ... but he answered some ?s so I instinctually come back to the source)
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Postby jjdenver » Tue Sep 21, 2010 7:48 am

I programmed profesionally in C & C++ a little back in the 90's. Since then I've moved to C# and I find it _vastly_ superior. The Advanced Tactics and Decisive Campaigns series sold on Matrix are built using .NET.

I would not hesitate to move from C++ to C# one second.

I'm just offering an opinion, not a definitive answer and I haven't used either for game programming.
jjdenver
Lieutenant
Lieutenant
 
Posts: 133
Joined: Wed Jul 22, 2009 2:37 am

Postby Roger Keating » Tue Sep 21, 2010 9:28 am

Any answer about languages and IDE's get very difficult as it often comes down to what the team uses or the one you are most used to.

I have programmed almost exclusively in C / C++ for the last 20 years as have most games companies I have dealt with. It is fast and you can do almost anything with it, including blowing your computer apart which is so hard using Java.

I have been playing around with NetBeans and Java recently and have also been looking at LUA as a scripting tool. So far I have kept away from C# but I understand it is closest to Java, which has just been taken over by Oracle so who knows what changes this will bring.

Sorry I can't give any more informed answers but I am not a 'trained' programmer. Just a guy who has been doing it for 40 years. I am, however, trying to catch up on many of the areas mentioned above.
User avatar
Roger Keating
SSG
 
Posts: 1792
Joined: Sun Aug 03, 2003 3:32 pm
Location: Sydney, Australia

Postby hank » Tue Sep 21, 2010 10:53 pm

Thanks to both of you for your replies.

I'm forging ahead with some flavor of C. Java has also peaked my interest and I've read where Java has some similarities to C languages. The only other languages I've used is VB and Lisp.

I get frustrated sometimes when things don't work like I want but yesterday I found a short article called "Teach Yourself Programming in Ten Years" by Peter Norvig. It's given me a new understanding of what it takes to become a competent programmer.

Thanks again.
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Postby Roger Keating » Wed Sep 22, 2010 9:08 am

After 10 years you find that the whole language has changed and the new committee has decided to revamp all the features and you suddenly find that nothing works on the new operating systems.

In any programming environment there is always a coffee machine with optional popcorn attachment. This is an object that has been inherited by the class.
User avatar
Roger Keating
SSG
 
Posts: 1792
Joined: Sun Aug 03, 2003 3:32 pm
Location: Sydney, Australia

Postby jjdenver » Thu Sep 23, 2010 1:46 am

Something I haven't tried yet is a graphical UI outside of a web environment. I'm familiar w/ how to construct web pages but putting up graphics like a map, hex grid, and units on a windows app (not a web app) I haven't done. Honestly I'd hardly know where to start with that although it seems interesting. Good luck w/ your adventures. :)
jjdenver
Lieutenant
Lieutenant
 
Posts: 133
Joined: Wed Jul 22, 2009 2:37 am

Postby hank » Thu Sep 23, 2010 3:36 am

I've started tutorials on C# (Pezgold has a good free online book). IMHO, if I'm going to stick with C, I think it would be beneficial to be able to code in all three primary C languages: C++ (unmanaged), C++/CLI, and C#. So far I really really like C#.

I think learning programming (at my age) is going to be somewhat akin to osmosis. But to let osmosis occur you have to immerse yourself in code languages. I can already create simple console and windows forms programs so hopefully it won't take 10 years to be half way proficient.

I do appreciate sharing thoughts here ... in this camouflaged thread. I don't know anyone who does game programming but the company I work for does do a lot of process controls ... breweries, refineries, etc etc.

thanks again
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Postby SundayForever » Mon May 23, 2011 12:16 pm

I have seen assaults on hexes containing infantry with armor units get a bad die roll (from defender's point of view) and been forced to retreat; the armored unit sometimes pushed into an empty hex. Then a subsequent attack either by ground forces, arty or air can be used to eliminate it completely for several turns.

It just seems the Axis armor is too easy to destroy compared to the Soviets units even though I know the soviet armor unit is a numerically larger unit. The Germans were excellent at recovering equipment and repairing it thoughout most of the war with the later months the exception.
Buy Tera Gold, cheap burberry messenger bags, burberry wallets for women
SundayForever
New Recruit
 
Posts: 3
Joined: Sat May 21, 2011 6:33 pm

Postby hank » Wed May 25, 2011 8:36 am

I tend to agree with you on this one. The only way tweek the way these unis are currently modelled is make the 2 step Axis armored units powerful from an offensive standpoint ... and make them regenerate repeatedly if destroyed.
User avatar
hank
Major
Major
 
Posts: 405
Joined: Thu Aug 28, 2003 12:09 pm

Previous

Return to Kharkov Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron