You must be logged in to post messages.
Please login or register

Scenario Design and Discussion
Moderated by Sebastien, Mr Wednesday

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Scenario editing library
posted 01-20-13 08:45 AM CT (US)   
NEW (22.1.13): Preview release. See post number 12 below.

Hi, I'm completely new to this forum.

I am developing a library to read and write Scenario files in .NET. This eventually leads to a converter for different scenario versions.

Currently, it is possible to import and export maps as bitmaps. It does not include units, however. This means that it is not possible to "draw" resources (such as Stone, Forest, etc.), because they are Gaia units.

It is possible to draw maps in your favourite image editor, or to resize existing maps!

To demonstrate the possibilities, I created an accurate map of Europe using NASA imagery (Blue Marble, includes land, water depth, and terrain height). Feel free to complete it with resources! (Include this post in the credits, please.)

Greets,
ScenLib


Details and Download
Europe.scn: 4shared, Zippyshare (Lambert cylindrical equal-area)

World.scn: 4shared, Zippyshare (Sinusoidal, then slightly warped to fit)
Remark: Needs other fixes as well.

Credits
• Based on the documentation by David Tombs

[This message has been edited by ScenLib (edited 01-22-2013 @ 03:55 AM).]

Replies:
posted 01-20-13 08:59 AM CT (US)     1 / 28  
Hey ScenLib. Welcome to Age of Kings Heaven

This sounds very interesting - i am looking forward to it. However, i tried to download the files you posted, but none of the links seem to work.

I hope you can fix this, the entire thing sounds very promising so far!

D E V A S T A T O R
Paradise Lost ~ Scored 1st in the ACSC12! ~ Voted Best Cinematic Scenario of 2013 ~ Official Rating: 4.7
Demon Town ~ Scored 1st in the HHC11! ~ "...as unique as an AoK scenario can get." - Panel ~ Official Rating: 4.2

Proud Member of BlackForestStudios
My AoE2 Youtube Channel
posted 01-20-13 09:08 AM CT (US)     2 / 28  
Indeed, had some problems with the sharing settings... It should work now. Also added a credit which I forgot the first time.
I expect I can provide a first release of the library at the end of February.
posted 01-20-13 09:21 AM CT (US)     3 / 28  
This sounds a lot like this project, which seems to be abandoned. Although I can't access the files, it sounds awesome!
posted 01-20-13 09:41 AM CT (US)     4 / 28  
This sounds a lot like this project, which seems to be abandoned.
Yes, I also discovered that project. The implementation is also based on David Tombs' documentation. However, there are some errors in it. I mailed him about those, but he hasn't answered. My library also includes some reverse engineering of my own.
Although I can't access the files, it sounds awesome!
Darn, first the links were not working, now the files can't be downloaded. It seems that 4shared only allows registered users to download. Since the lock down of MegaUpload, most hosters do not provide free & unregistered up-/download anymore...

Does anybody know a place where I should put those files? What about Zippyshare? Cloudzer?
posted 01-20-13 09:47 AM CT (US)     5 / 28  
Or the new MEGA? Same guy behind that as MegaUpload
posted 01-20-13 09:58 AM CT (US)     6 / 28  
Added Zippyshare.
posted 01-20-13 10:16 AM CT (US)     7 / 28  
Aok blacksmith?

I can help you out with scx format if you have some problems. I believe there were one or two errors in Digit's documentation.

,
Jatayu O===|¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯/
`
Battle of Saraighat, 1671|Atlantis, the Lost Realm|AOE Roman Modpack|My profile
ि
StormWind Studios
posted 01-20-13 10:23 AM CT (US)     8 / 28  
Creating a mapshot and uploading that at an imagehoster might be more useful.
posted 01-20-13 10:42 AM CT (US)     9 / 28  
I tried the same in Java but had a bug when I tried to save the scenario. I got occupied with school in the meanwhile and never got to finish the program.
Are you sure you send it to the right email-address? I don't think I ever got your mail.

[This message has been edited by den cekke (edited 01-20-2013 @ 10:45 AM).]

posted 01-20-13 11:55 AM CT (US)     10 / 28  
@Jatayu: I would be very interested in your findings. At the moment, my library simply skips some sections and copies them to the new file. Do you have additional information about the Victory, Diplomacy, and Disables sections than in David's doc (and source code)?

@Dead_End: I would have wanted to do that, but it is only possible with the Conquerors expansion which I don't have.

@den cekke: Is your program also based on David's doc? If you have other insights of the format, please get in touch. I guess you misread something about the mail. I mailed David about the errors.

So has anybody managed to download the scenario and tried it already?
posted 01-20-13 12:55 PM CT (US)     11 / 28  
I haven't been able to test the scenarios yet.
And I used both Jatayu's program as davids guide while figuring some stuff out myself. Can you send the mail again? My email is 1302AOE(at)hotmail(dot)be.

What you've said sounds pretty exiting and is exactly what I had in mind with my program.
posted 01-22-13 03:52 AM CT (US)     12 / 28  
Hi, I provide a preview release! Download here!

It is a console program and has the following commands:

  • tobmp scnfile: Extracts the terrain and elevation map as PNG.
  • break scnfile: Breaks the attached debugger.
  • objspy scnfile: Inspect the contents of the Scenario object (This is what the library will provide for other developers)
  • frombmp_ map-png [elevation-png]: Converts the terrain and optionally the elevation map to a scenario (but manual hex edit insertion is required)

    The map PNGs are generated as follows:
  • Terrain: The color table Age2.act contains the mapping from TerrainId to colors. Feel free to adjust the color table, but the program also uses it for conversion.
  • Elevation: Valid elevations are 0-6. To visualize them, they are multiplied to use the full range 0-255. To check what it would look like internally, you can apply a "posterize" effect with value 7.

    Now you see what still needs to be done.

    Documentation

    It would be great, if somebody would write a decent documentation. There are some issues the user needs to be aware of when "painting" maps.
  • Land and water MUST be seperated by a strip of "Beach". This could be accomplished by Dilation (morphology) of the land with [1 1 1, 1 1 1, 1 1 1].
  • Ships may pass certain combinations of adjacent pixels* of land/beach/water, certain not.
  • Adjacent pixels in the elevation map MUST NOT increase by more than 1.
  • There seems to be another restriction for elevation maps, I haven't been able to pinpoint.
  • Errors in the terrain array manifest in strange behaviour in the Age scenario editor.
  • Errors in elevation array manifest to black spots on the map, but is playable.

    These are restrictions that must manually be taken care of when resizing maps!

    * The 8 pixels in all directions.

    Object editor

    It would be great, if there exists an object editor like ObjSpy which is also able to edit and create values with Reflection. Maybe somebody wants to have an exercise with Reflection and WinForms? :-) I guess, this would already serve as an adequate GUI.

    Questions to you

    Should it be possible to "draw" units? If yes, how? Some units can be placed at an arbitrary position (a real number, how to represent in a bitmap?), some need to be aligned on a grid (as stone/gold resources). And there are 65535 possible unit types.
    Possibilities:
  • 16-Bit bitmap → not possible in .NET
  • Additional mapping for unit IDs to palette entries

    Resources are Gaia units which is a different concept internally than the map. However, it would be easy to implement a conversion bitmaps from/to resources.

    I will rest the project for about 2-4 weeks, as I have to prepare for exams. But stay tuned!
  • posted 01-22-13 08:44 AM CT (US)     13 / 28  
    Great ideia! Also, I looked into your Europe and World maps: they are great! I'll test this tool later, it might help me a lot in a thing! ;-)

    Oh, and by the way, which programming language did you use for it ?
    posted 01-22-13 08:52 AM CT (US)     14 / 28  
    I would be really interested in this, but it needs to be available for scx format. No one uses just AoK anymore, unfortunately.

    "And Matt is a prolific lurker, watching over the forum from afar in silence, like Batman. He's the president TC needs, and possibly also the one it deserves." - trebuchet king
    posted 01-22-13 09:24 AM CT (US)     15 / 28  
    I guess that AoKTS or even the normal Scenario Editor, can open and "convert" scn to scx...
    posted 01-22-13 09:38 AM CT (US)     16 / 28  
    which programming language did you use for it?
    As ScenLib said:
    .NET

    Advanced Genie Editor
    Follow coding here and here.
    posted 01-22-13 09:50 AM CT (US)     17 / 28  
    @Keisari : Yeah, but, there are many programming languages "inside" .NET:
    Visual Basic .NET
    C# .NET
    J# .NET
    ...and so on... .NET is actually just a framework...

    [This message has been edited by danielpereira (edited 01-22-2013 @ 09:50 AM).]

    posted 01-22-13 09:58 AM CT (US)     18 / 28  
    Looks nice ScenLib. For the objects can't you use an array to store the info of the units(location, ID, direction, player,...) and write it to a separate file?

    I'm not really familiar with .Net so I'm not sure if I can help you. We get .Net at our college in our last year.

    [This message has been edited by den cekke (edited 01-22-2013 @ 10:00 AM).]

    posted 01-22-13 10:10 AM CT (US)     19 / 28  
    @Matt: I read somewhere that scn files can be opened in Conquerors without problems. However, it is not possible vice-versa.

    @Keisari, .NET is only the name of the runtime. Numerous languages can be used for it. MS provides C#, F#, J# (deprecated), C++, and Basic. Others are PostSharp, CciSharp, Nemerle, and Boo.
    It's like Scala for the JavaSE. Don't mix up runtime and language.

    I used C# 4 with .NET 2. C# is simply one of the best languages around (also from an academic point of view). And I like it, because it resembles C. Anybody who has coded in C#, I guess, would think Java sucks. :-)

    .NET 2 is chosen because of its wide support. Most XP machines have it and Mono is compatible. I would have chosen whatever runtime is available for C# 4. ;-)

    @danielpereira: Would you mind making a full mapshot and link it here? :-)

    @den: Yes, it is stored internally like that. I will probably include XmlSerializer, then you can do whatever you want with the whole scenario file. This is not every designer friendly, however... Have you tried the objspy command?

    [This message has been edited by ScenLib (edited 01-22-2013 @ 10:11 AM).]

    posted 01-22-13 10:35 AM CT (US)     20 / 28  
    Okay, I know little programming, but here are some suggestions based on user friendliness.

    1. frombmp -> Shouldn't this be a bitmap? each pixel represents 1 tile. The player just sets the size of the map by changing the size of the bmp. Seems easiest to me.

    2. Beach -> Again, limited programming here, but can't the program just place one tile of beach on every side of a tile of water? Just have it check if the tiles on the side are water, if not, place beach.

    3. Elevation -> work in grayscale? The darker the lower it is, or vice versa. Also, elevation can be placed as high as 15 I believe. 10 certainly is no issue at all.

    "And Matt is a prolific lurker, watching over the forum from afar in silence, like Batman. He's the president TC needs, and possibly also the one it deserves." - trebuchet king
    posted 01-22-13 10:37 AM CT (US)     21 / 28  
    Some students in my school have said that C# sucked badly.
    I prefer C++ over Java.

    Advanced Genie Editor
    Follow coding here and here.
    posted 01-22-13 11:11 AM CT (US)     22 / 28  
    Can something microsoft made to catch up with another thing ever be good? =D

    What's the difference between scn and scx except for the header? I've only used scx in my program so far because almost nobody play age of kings anymore.

    I'll try out the objspy but first will have to find a scn file.
    If you put the object information into a xml file that would certainly be a nice solution. XMLs are still pretty user friendly I think. And you can show the objects on the bitmap as dots in their player color or add an attribute to the object in XML so the user can choose the color for each unit. For example resources could have their own color so they stand out.

    Btw are you ever planning to make an user interface for your program or will it stay for console only?


    EDIT: I tested it and it looks awesome. The .net object browser shows all the data nicely. Will you put that data also in a XML or is it just for other developers to use?

    [This message has been edited by den cekke (edited 01-22-2013 @ 11:30 AM).]

    posted 01-22-13 11:11 AM CT (US)     23 / 28  
    @Matt: Thanks for your ideas.

    1. Yes, it is implemented exactly that way. tobmp and frombmp work like that and are the inverses of each other.

    2. This would be possible. However, this would lead to a considerable amount of work. Additionally, it would take away some control over the map design. As a low priority, I may implement it as an optional step. However, I find it easiest, if the map is designed in a sophisticated image editor with seperate layers for land, water, other tiles, and elevation.

    3. Already solved like that. The internal editor in AoK has elevation levels 1-7. Are there more in Conquerors? Or do they work nevertheless, even not supported by the editor?

    @Keisari: Yeah, I guess, I will have to learn C++ someday... However, it's not easy on my eyes... ;-)

    But I would honestly be interested why some of your fellows think it sucks. Maybe they don't like .NET. I also don't like it that much... But I have not encountered any flaw in the design of the language and I like expressing abstract stuff in a language... There are currently only three loops in the whole library (except in my Util library). There will probably only be one more. ;-)
    Can something microsoft made to catch up with another thing ever be good? =D
    I also had this attitude for a long time. But Microsoft Research has a very nice portfolio and top and unique technologies. I think they designed most of C#. F# is fully developed by them and seems to be extremely advanced and includes state-of-the-art research.

    @den: There is no big difference between scn and scx and Conquerors can open both! It will only be a library for others to build upon. An additional console program will be able to convert all versions (aoe1 - conq) between each other. Maps can be replaced with bitmaps. And of course, all text can be exported and imported (hints, triggers, scripts). Campaign files will also be fully supported.

    I uploaded an example .scn file: Opening-nobmp.scn It is the popular scenario "Opening Moves" in the Hittites campaign of the AOE1 demo. (This was actually the motivation to start the project) ;-)

    [This message has been edited by ScenLib (edited 01-22-2013 @ 11:25 AM).]

    posted 01-22-13 01:23 PM CT (US)     24 / 28  
    I see. So how do we convert the images back to scenarios? The fromBmp creates a .map file and you mention manual hex edit insertion is required?
    You mean that we have to move the terrain data from the .Map file into a .scn file?
    posted 01-22-13 01:40 PM CT (US)     25 / 28  
    Yeah, that's the part I'd like explained as well.

    "And Matt is a prolific lurker, watching over the forum from afar in silence, like Batman. He's the president TC needs, and possibly also the one it deserves." - trebuchet king
    posted 01-23-13 03:42 AM CT (US)     26 / 28  
    =) That's the part that's not fully implemented yet. That's also the reason why there is an underscore in the command name, because it is not fully functional.

    For the two demo maps, I inserted it manually. I had this idea only as a proof of concept before.

    I will work on the code in two weeks again. The preview version is released to proof that this is not an empty promise and for other developers to already see the infrastructure and maybe even start coding other useful tools.

    The ObjSpy uses an external library which originally was intended only for WinForms: .NET Object Spy. I abused it with reflection to display arbitrary objects. But unfortunately, it is not possible to edit them. It would be a great possibility, but I do not intend to improve ObjSpy. It would be great to find a volunteer for that.

    So to answer den's question: I will include XML de-/serialization (which then allows to edit the entire scenario in a text editor).

    Also, I read about some issues of AOKTS with corrupting files. I will make sure that it won't be the case with my library.

    Anyone with skills in a .NET language (Visual *) is able to contribute to the functionality!
    posted 01-23-13 05:48 AM CT (US)     27 / 28  
    I'd love to help but I'm afraid I don't have the knowledge to work in .net. However I can do something with the provided xml files and bitmaps.

    See you over 2 weeks then and good luck with your exams.
    posted 01-23-13 07:42 AM CT (US)     28 / 28  
    Anyone with skills in a .NET language (Visual *) is able to contribute to the functionality!
    I have some VB.NET knowledge, but I don't think I can help much...
    Age of Kings Heaven » Forums » Scenario Design and Discussion » Scenario editing library
    Top
    You must be logged in to post messages.
    Please login or register
    Hop to:    
    Age of Kings Heaven | HeavenGames