Page 3 of 3

Re: Random Map Generator

PostPosted: 08 Mar 2017, 15:57
by Toxic
Right now it's basically impossible to crash the game from the script which is a great thing IMO.
Everything is possible... simple unwanted infinite while loop and the work is done. :D
I'm happy to help you get it compiling on your machine if you are interested.
Ok, I am interested. I have Lazarus and KaM from Github. All I need is the name of functions which start to load map from the arrays of tiles, heights and objects. I cannot see anything like UML documentation and searching of those functions which are hidden somewhere in KM_GameApp. It is for me waste of time especialy when you can tell me and structure of those arrays is unknow to me (it is loaded from the map files).

Re: Random Map Generator

PostPosted: 08 Mar 2017, 17:28
by Rey
I can help you with compiling and code structure too, if Lewin will be not available at the moment.
I've just sent you my contacts in private message.

Re: Random Map Generator

PostPosted: 08 Mar 2017, 19:04
by thibmo
All I need is the name of functions which start to load map from the arrays of tiles, heights and objects. I cannot see anything like UML documentation and searching of those functions which are hidden somewhere in KM_GameApp. It is for me waste of time especialy when you can tell me and structure of those arrays is unknow to me (it is loaded from the map files).
Well, I think in Lazarus you can also use [CTRL] + [LMB] to navigate to the method definition.
But it might be a good idea to start looking at : (KM_GameApp.pas @ Line 509)
  Code:
procedure TKMGameApp.LoadGameFromScript(aMissionFile, aGameName: UnicodeString; aCRC: Cardinal; aCampaign: TKMCampaign; aMap: Byte; aGameMode: TGameMode; aDesiredLoc: ShortInt; aDesiredColor: Cardinal);
This will lead you to the following : (KM_Game.pas @ Line 302)
  Code:
procedure TKMGame.GameStart(aMissionFile, aGameName: UnicodeString; aCRC: Cardinal; aCampaign: TKMCampaign; aCampMap: Byte; aLocation: ShortInt; aColor: Cardinal);
It's a bit of a read but I think you might want to focus on the lines after : (KM_Game.pas @ Line 367)
  Code:
Parser := TMissionParserStandard.Create(ParseMode, PlayerEnabled);
Which is the mission script. ( *.map )

The loading of the dynamic script starts at : (KM_Game.pas @ Line 422)
  Code:
fScripting.LoadFromFile(ChangeFileExt(aMissionFile, '.script'), CampaignDataTypeFile, CampaignData);

Re: Random Map Generator

PostPosted: 10 Mar 2017, 06:54
by Krom
@Toxic - as discussed in Skype, Rey will help you with entry-points and boiler-plate code.

For other readers - main entry point for terrain is gTerrain.LoadFromFile(). Main entry for mission script is Parser.LoadMission(). As Thimo pointed out, starting from TKMGameApp.LoadGameFromScript will lead you to them.

Re: Random Map Generator

PostPosted: 11 Apr 2017, 14:25
by Lolslayer2
Very nice!

But I want to say/ask a few things:
-The download button doesn't work anymore, can you reupload it?
-Does this work with KaM Remake too? (I suppose it does, but not sure)
-Can we have a few example pics of the program/results?

Many thanks in advance! :D

Re: Random Map Generator

PostPosted: 10 Jun 2017, 16:05
by Toxic
-The download button doesn't work anymore, can you reupload it?
Yes, I reupload old script for you.
-Does this work with KaM Remake too? (I suppose it does, but not sure)
Sure - this is made for KaM Remake.
-Can we have a few example pics of the program/results?
I made new topic for those purposes.