Results 1 to 30 of 34

Thread: Challenge for all modders out there

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    aka AggonyAdherbal Member Lord Adherbal's Avatar
    Join Date
    Oct 2004
    Location
    Belgium
    Posts
    1,014

    Default Re: Challenge for all modders out there

    Then we put all our talents together and develop a strategic game on our own. When a battle occurs, a historical battle script is written. Next you load up R:TW and you play the historical battle. Then we need to extract the outcome of the battle (or perhaps just write up the results) and import it back into the strategic game. Thus you have the excellent battle engine of R:TW but with a proper AI and strategic game that can be as challenging as we want.
    that was exactly my idea for a MP campaign game. I would write a program with an MTW style campaigngame, then when a battle occurs it generates a script and the program pauses. The players then fight this battle in RTW via gamespy. After completion the campaignmap program is resumed and it reads the battle results from the battle's logfile (rtw\logfiles\), and the campaigngame continues.

    It will probably be my next project after Chivalry TW (if I can still be arsed to play RTW by then :))
    Member of The Lordz Games Studio:
    A new game development studio focusing on historical RTS games of the sword & musket era
    http://www.thelordzgamesstudio.com

    Member of The Lordz Modding Collective:
    Creators of Napoleonic Total War I & II
    http://www.thelordz.co.uk

  2. #2
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Challenge for all modders out there

    Mkay.. I bBegan to do a proper battle script, for a battle like the one described by Duke. Currently the script is a follows:

    Code:
    ;###############  init  #####################################
    	prepare_for_battle
    
    ;*************
    ;player
    ;*************
    
    	label_unit 0 0 0	plr_general
    	label_unit 0 0 1	plr_inf1
    	label_unit 0 0 2	plr_inf2
    	label_unit 0 0 3	plr_inf3
    	label_unit 0 0 4	plr_inf4
    	label_unit 0 0 5	plr_inf5
    	label_unit 0 0 6	plr_inf6
    	label_unit 0 0 7	plr_miss1
    	label_unit 0 0 8	plr_miss2
    	label_unit 0 0 9	plr_inf7
    	label_unit 0 0 10	plr_inf8
    	label_unit 0 0 11	plr_inf9
    	label_unit 0 0 12	plr_inf10
    	label_unit 0 0 13	plr_inf11
    	label_unit 0 0 14	plr_inf12
    
    	define_unit_group plr_army plr_general plr_inf1 plr_inf2 plr_inf3 plr_inf4 plr_inf5 plr_inf6 plr_inf7 plr_inf8 plr_inf9 plr_inf10 plr_inf11 plr_inf112 plr_miss1 plr_miss2
    	define_unit_group plr_front plr_inf1 plr_inf2 plr_inf3 plr_inf4 plr_inf5 plr_inf6
    	define_unit_group plr_missiles plr_miss1 plr_miss2
    	define_unit_group plr_reserves plr_inf7 plr_inf8 plr_inf9 plr_inf10
    
    
    ;*************
    ;AI
    ;*************
    
    	label_unit 1 0 0	AI_general
    	label_unit 1 0 1	AI_leg13
    	label_unit 1 0 2	AI_leg21
    	label_unit 1 0 3	AI_leg22
    	label_unit 1 0 4	AI_leg33
    	label_unit 1 0 5	AI_leg23
    	label_unit 1 0 6	AI_leg12
    	label_unit 1 0 7	AI_leg31
    	label_unit 1 0 8	AI_leg32
    	label_unit 1 0 9 	AI_leg11
    	label_unit 1 0 10	AI_leg_1
    	label_unit 1 0 11	AI_rcav
    	label_unit 1 0 12	AI_lcav
    	label_unit 1 0 13	AI_vel1
    	label_unit 1 0 14	AI_vel2
    	label_unit 1 0 15	AI_vel3
    	label_unit 1 0 16 	AI_raux
    	label_unit 1 0 17	AI_laux
    
    	define_unit_group AI_ARMY AI_general AI_leg13 AI_leg21 AI_leg22 AI_leg33 AI_leg23 AI_leg12 AI_leg31 AI_leg32 AI_leg11 AI_leg_1 AI_rcav AI_lcav AI_raux AI_laux AI_vel1 
    
    AI_vel2 AI_vel3
    
    	define_unit_group AI_1line AI_leg11 AI_leg12 AI_leg13
    
    	define_unit_group AI_2line AI_leg21 AI_leg22 AI_leg23
    
    	define_unit_group AI_3line AI_leg31 AI_leg32 AI_leg33
    
    	define_unit_group AI_skirm AI_vel1 AI_vel2 AI_vel3
    
    			
    ;*************  Locations
    
    	label_location plr_center -590 -134
    	label_location AI_prepline -500 -134
    	label_location veliteloc -550 -134
    	
    ;************* Declaring variables
    
    declare_counter battlephase	; phase 0=deployment/march, 1=missile duel/skirmishing, 2=closing lines, 3=all-out attack 4=monitor situation
    declare_counter skirmphase	; phase	0=closing into range, 1=shooting/throwing part, 2=disengaging skirmishers
    set_counter skirmphase 0
    
    ;**********************
    ; start
    ;**********************
    
    	while ! I_BattleStarted		;standard wait part
    	end_while
    
    	ai_active_set off		;disable core AI in favor of scripted one
    
    	unit_set_skirmish_mode AI_vel1 off
    	unit_set_skirmish_mode AI_vel2 off
    	unit_set_skirmish_mode AI_vel3 off
    
    	battle_wait 4
    	unit_group_order_move_formed AI_ARMY -480 -134 run; march AI army to positons
    	unit_group_order_move_unformed AI_skirm -500 -134 run
    
    	battle_wait 10
    
    	while I_IsUnitGroupMoving AI_ARMY	;wait until army is in position
    	end_while
    
    	battle_wait 10
    	set_counter battlephase 1
    	unit_set_experience plr_general 1 ;debug nodes, watch for general's exp
    
    	while I_InBattle		; main battle loop
    ;**********************************
    ;	== skirmish part ==
    	if battlephase = 1
    		if skirmphase = 0	;skirmish phase 0: skirmishers move to range, loosen formation
    ;		unit_group_change_unit_formation AI_skirm square_hollow
    		unit_group_order_move_unformed AI_skirm -560 -134 run
    		set_counter skirmphase 1
    		unit_set_experience plr_general 2
    		end_if
    ; more to come
    ;		
    	end_if
    ;**********************************
    ; much more to come
    	end_while
    	end_script
    Script layout plan:
    [CODE]init & labels

    defining monitors?

    move AI army to range

    while-loop, checks everything possible implemented in script
    {
    skirmish-part
    {
    {
    move to range, fire next phase when rdy
    }
    {
    shootout, check for possible threats, fire next phase when out of ammo/large casualties to skirmishers
    }
    {
    disengaging, fire next phase when rdy
    }
    }
    main battle part
    {
    {
    close to precursor range (fire at will), position flank guards according to player's flanks, make flanking movements
    }
    {
    charge
    }
    }
    battle checks
    {
    {
    check front line, assign reserves
    }
    {
    check flanking attempts, assign reserves
    }
    {
    after a delay start to check for free reserves, possibly send them to flank
    }
    }
    possibly a delay to lessen CPU load
    end_while
    /CODE]

    Current problems:
    1) The skirmishers don't respond to orders (in skirmish part, the first order is acknowledged)
    2) I can't get monitors working. Dunno what it is.

    Flanking checks could be implemented by: check flanking attempts-part checks the distance of player's units from lines placed on AI's flanks and on AI's front. Flank line checks (obviously) check if player's unit is on outflanking course, front line checks if player's unit has advanced far enough for the reserves to counter it.

    About
    Will the game crash if you label unit sixteen when there are only 15 units?
    for example,
    I_BattlePlayerArmyNumberOfMatchingUnits all > 12
    tests if player has over 12 units. One could use this while labeling, assuming that the game doesn't check if-statements beforehand.


    Some observations on scripting:
    *invalid labeling, using invalid label, using location label in some commands that require a location = CTD on execution of command.
    *mistyped command, missing/extra end_* = script doesn't work but battle runs as usual.

    EDIT: Groups within groups don't work. They can be defined but some of them won't respond to commands.
    Last edited by The_Mark; 03-10-2005 at 18:00.

  3. #3
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Exclamation Re: Challenge for all modders out there

    Just one thing to say about RTW script engine: It's crap. It can't store variables (other than numbers), it doesn't have any functions returning values etc.

    Regarding to that, I had an idea

    What if one would make a proggy that'd use the information from the battle and would constantly write script commands to a file to be executed every second?

    Example: A battle script calls the console command output_unit_positions, saving the positons of all units to a file. The proggy checks this file for positions. The proggy then uses the information to figure out what's going on, for exampl, flanking manouvers. When it recognises a flanking manouver it will write a command (unit_order_attack_unit plr_unit_3) to a separate script file (show_me) that is run by rome regularly.

    Benefits: We can have all the commands, calculus, variables we want and need to make the AI smart.

    Problems: output-command doesn't output unit status, for example, men left/ammo status/engagement status. If we can work around these there's possibly no limits.

    Any thoughts?

  4. #4
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Challenge for all modders out there

    Quote Originally Posted by The_Mark
    Just one thing to say about RTW script engine: It's crap. It can't store variables (other than numbers), it doesn't have any functions returning values etc.
    I could have told you that...

    I don't know about the whole seperate program idea. The advantage of scripting is that there are loads of things you can check up on like if a unit is being attacked in the flank of back etc...

  5. #5

    Default Re: Challenge for all modders out there

    I think he was saying that you could write scripts that would return all that battle data to an external program, who could at the same time do a lot more with the data than the scripts themselves.

  6. #6
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Challenge for all modders out there

    No hes not, there is a command which outputs the unit positions to a file, but it doesn't output anything else...

  7. #7
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Challenge for all modders out there

    Quote Originally Posted by Myrddraal
    I could have told you that...
    Well, I didn't expect much, but I didn't expect it to be (utter) crap either.

    And if you only know the units' positions, it CAN tell you a lot of things. As the command also outputs the units' directions. So we can, in fact, check if a unit is attacked fron flanks etc. But yes, there's a lots of things that we can't test. We can assume that two units are engaged by their distance, and we could check whether a unit is attempting flanking much more reliably (and more easily).

    So we have a script engine that can test stuff handily but can't do anything with it and we could make a program that would do everything we want but it couldn't check things.

    Is there any other ways of extracting battle information than output_positions?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO