Map Database  •  FAQ  •  RSS  •  Login

Random Map Generator

<<

Toxic

Rogue

Posts: 50

Joined: 22 Feb 2017, 19:04

Post 08 Mar 2017, 15:57

Re: Random Map Generator

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).
<<

Rey

User avatar

KaM Remake Developer

Posts: 217

Joined: 12 Oct 2016, 07:41

KaM Skill Level: Fair

Location: Moscow

Post 08 Mar 2017, 17:28

Re: Random Map Generator

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.
<<

thibmo

User avatar

Council Member

Posts: 124

Joined: 03 Aug 2015, 09:12

KaM Skill Level: Skilled

Website: https://kp-wiki.org/

Location: the Netherlands

Post 08 Mar 2017, 19:04

Re: Random Map Generator

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);
~~ The magic wizard of PascalScriptus. ~~

KP-Wiki :
  • Information about Knights Province scripting ( unofficial )
  • Information about several hosting/server maintenance basics
  • Other random stuff
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 10 Mar 2017, 06:54

Re: Random Map Generator

@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.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Lolslayer2

Post 11 Apr 2017, 14:25

Re: Random Map Generator

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
<<

Toxic

Rogue

Posts: 50

Joined: 22 Feb 2017, 19:04

Post 10 Jun 2017, 16:05

Re: Random Map Generator

-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.

Return to “Dynamic Scripting”

Who is online

Users browsing this forum: No registered users and 10 guests