Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming noob in need.
#1
Hello!
I've returned to Colobot after many years when I saw new feature - Bot Battles.

So, I've instantly tried to build my own program:


Code:
extern void object::OverlordAI01A()
{
    
    object util;
    int c;
    PosLog();
    OVBuildInit();
    
}

void object::OreCheck()
{
    
    util = radar(TitaniumOre, 0, 360, 0, 100);
    if(radar(TitaniumOre, 0, 360, 0, 100) != null)
    {
        c = 1
    }
    else
    {
        c = 0
    }
    
}

void object::BuildInit()
{
    build(Converter);
    OreCheck();
    util.position = orepos;
    
    while(true)
    {
        if(c = 1)
        {
            goto(orepos);
            grab();
            turn(180);
            break;
        }
        else
        {
            turn(180);
            while(c = 0)
            {
                wait(0.1);
            }
            break;
        }
        break;
    }
    
}
So, I'm having error concerning 'util' not declared in OreCheck() altough I've declared it in OverlordAI01A(). Conclusion is that stuff declared in one block is unavailable to the other blocks, which sucks, as I'm using coordinates based system for building and having a colossal brick of position data at the very start of my program generates total mess (that's the PosLog() in first block, which will be unavailable for the rest of the program, I guess).

So, how to allow all blocks to use declared positions, objects etc. from any other block?
Si vis pace, para bellum.

#2
You need to pass variable util as a parameter, like this
Code:
OreCheck(util);


void object::OreCheck(object util)
{

}
Spoiler :
[Image: unknown.png]
#3
Oh boy.
I'll need to mess around this for a while to get a grip then. Thank you, I'll probably keep posting new issues concerning my child-in-fog programming skills.
Si vis pace, para bellum.

#4
So, my program is much more advanced, but I need help again.
So, the thing is, that I'll rely on multiple types of bots, one building initial base, second just building more buildings, two converting ore, etc. And since it's battle, some of the bots will be lost and they'll need replacement.
So, my question is how to make bots declare to everyone that they're not destroyed and running program X or program Y.
Si vis pace, para bellum.

#5
Making a bot declare it is not destroyed is not the best of solutions since it's impossible for a bot to state otherwise. After all it cannot send any information if it's no longer operational.

A much more elegant solution would be to have other bots check for it being functional.
Code:
object botURchecking; // declaring variable
botURchecking = radar(BotCategory, 0,360,0,1000,FilterFriendly); // looking for a friendly bot
if (botURchecking != null) // checking if it exists


If you'd like to share information between multiple bots you'll have to use a class. I'd recommend checking information available in the sat-COM and playing through the exercises available in-game.
The botURchecking variable can also be shared through a class.


As a general tip I'd like point out that most bot battles resemble a race where players attempt to attack as soon as possible while the opponent is still defenceless. There rarely is enough time to get any bots out except the starting WheeledGrabber.
My Code Battle League program: MhrodeBattle.txt

Welcome back, Mrocza. You last visited: Sunday, July 7th, 2013, 02:12 pm 
http://imgur.com/L3Y8bQz
#6
Quote:As a general tip I'd like point out that most bot battles resemble a race where players attempt to attack as soon as possible while the opponent is still defenceless. There rarely is enough time to get any bots out except the starting WheeledGrabber.
Yeah, I've noticed that, but I'm planning to invest some time into Colobot and making some custom Code Battles maps encouraging to use other tactics than simple zerging. Those battles are full of potential, and simple zerging is simply wasting it.

Vanilla map renders land shooting bots useless, bases are placed too close to allow anything more than zerg rushing, topography is not giving any viable challenge to flying bots and gameplay could really use some points of interest like uranium Derrick in between players. It'd encourage more complex tactics. I'm real strategy games enthusiast, and one proof-of-concept map is painful waste of huge potential.  This game might have 15 years, but I've only seen similar concept in recent Gladiabots. And IMO Colobot is doing it better (tough, Gladiabots are interesting and entertaining too). So, bunch of maps would really blossom this gamemode and I'm quite sure that it'd appeal strategy and coding enthusiasts easily if promoted potentially (but that's for future, obviously).
I'll try to make those maps as good as possible, so they might be useful for TerranovaTeam. But that's my plans for future, when I'll get my grip on map making.
Si vis pace, para bellum.

#7
We're aware it's not best map for this mode, it's just an example level to introduce to Code Battle mode, in future it will be replaced with better concept (maybe like this https://github.com/colobot/colobot/issues/800 when engine will allow us to make more advanced stuff).
Spoiler :
[Image: unknown.png]
#8
I know it's just a proof-of-concept.
MOBA-like idea is cool, and I think it even might be doable now (I'm quite sure that it's possible to "overcharge" shield level in scene.txt).
I'm working on Colobot version of Seton's Clutch map from Supreme Commander series now.

BTW, does the DefenseTower shoot at the enemy bots in range?
Si vis pace, para bellum.

#9
@Quartofel Yes! https://github.com/colobot/colobot/issues/700
#10
@krzys_h Awww yisss, get wrecked, early rush.
Si vis pace, para bellum.

#11
Actually defence towers are garbage.

Their incompetence in hitting a moving target renders them unusable. By the time defence tower fires the bot is no longer in targeted position. The range of the tower is more or less the same as shooter's range (40) so even if it hitsthe attacker it will take heavy damage anyway.

The cost of one additional research is to high.
My Code Battle League program: MhrodeBattle.txt

Welcome back, Mrocza. You last visited: Sunday, July 7th, 2013, 02:12 pm 
http://imgur.com/L3Y8bQz
#12
(01-02-2017, 07:24 PM)Mrocza Wrote: The range of the tower is more or less the same as shooter's range (40)

It's actually 200 engine units, which is 50 meters in-game if I'm reading the code correctly.

Shooters fire range is 0.8 seconds at speed of about 200 engine units/second, which is equal to 50 meters a second, which in turn gives the well-known value of 0.8*50=40 meters.
There is also a small speed randomization which makes the particles look more natural because they don't go in a straight line, but may interfere with this result a bit.

All these calculations assume the default value of g_unit=4 (the game unit to engine unit ratio)
#13
That's a greater difference than I expected. However, a flying bot at a top speed of 12.5 m/s closes that gap in under a second.

Do you by any chance know how long does it take for a tower to shoot? It's not really the range of the tower that is problematic but delay on the shot.
My Code Battle League program: MhrodeBattle.txt

Welcome back, Mrocza. You last visited: Sunday, July 7th, 2013, 02:12 pm 
http://imgur.com/L3Y8bQz
#14
This one seems a bit harder to find. I think it's checking every 3 seconds for a possible target, if it finds any then it plays the 1 second animation and shoots the beam (which may also take some time, I don't remember if it's instant or not).
There is also commented out code for a research which is supposed to make towers faster (check interval is the same but there is only 0.2s of animation). I think it was at some point meant to be part of the game but then it got taken out for some reason.
#15
Maybe we could restore this research only for Code Battle mode, it doesn't even needs additional button in UI, cause you don't control anything with mouse in this mode.
Spoiler :
[Image: unknown.png]
#16
Actually with the ability to cut the delay on the shot I see a novel strategy.

One would attempt to run two research projects and put up a tower. Would it be worth the investment? Depends if the buffed tower was reliable enough to destroy a few bots before being taken down.

That 3 second interval introduces some randomness into the equation. That's probably why it appeared to have a lower range when I was testing.
My Code Battle League program: MhrodeBattle.txt

Welcome back, Mrocza. You last visited: Sunday, July 7th, 2013, 02:12 pm 
http://imgur.com/L3Y8bQz


Forum Jump:


Users browsing this thread: 2 Guest(s)