Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...

Westwood Font Editor [Development thread]


Nyerguds
 Share

Recommended Posts

Current version: 1.13.3 (2019/03/21 16:28)

fonteditor_20_vcr_1.7.1.png

The project is built on the .Net framework v3.5
Its code is licensed under the WTFPL.

Download:
Downloads folder
Full readme

Source code: (C#)
Sources folder

 

Full list of supported types / games:
 

WWFont v1:

  • Wargame Construction Set
  • A Nightmare On Elm Street
  • DragonStrike
  • Circuit's Edge

WWFont v2: (Note: the save routine for this type is currently set to optimise the size by removing duplicate image data, but I'm not sure if the games support this)

  • BattleTech: The Crescent Hawk's Revenge
  • Eye of the Beholder
  • Eye of the Beholder II: The Legend of Darkmoon

WWFont v3:

  • The Legend of Kyrandia
  • Dune II
  • Lands of Lore The Throne of Chaos
  • The Legend of Kyrandia Hand of Fate
  • The Legend of Kyrandia Malcolm's Revenge
  • The Legend of Kyrandia Malcolm's Revenge Installer
  • Command & Conquer
  • Command & Conquer Installer
  • Command & Conquer Red Alert
  • Command & Conquer Red Alert Installer
  • Lands of Lore Guardians of Destiny
  • Lands of Lore Guardians of Destiny Installer
  • Command & Conquer Sole Survivor
  • Lands of Lore III

WWFont v4:

  • Tiberian Sun
  • Tiberian Sun Installer
  • Tiberian Sun Firestorm
  • Tiberian Sun Firestorm Installer
  • Lands of Lore III Installer

IGFont (Dune 2000 was made by Intelligent Games, not by Westwood)

  • Dune 2000

BitFont:

  • Red Alert 2 (internal developed use only)

Unicode BitFont:

  • Red Alert 2

Original first post:


As I sort of mentioned a while back, I got tired of the lack of font editor for C&C1, and even more tired of Siberian_GRemlin sitting on his (working) version for about 10 years now.

So I've decided to make my own in c#. With the help of the RA++ team (Omniblade, CCHyper & Tomsons26, anyway) I figured out the font format itself, and managed to make code to read it and show it as image. Apparently this format is used for quite a bit more than C&C1 and RA1; we used fonts from Legend of Kyrandia as test material as well, and apparently this should support Dune II too.

Fonts have no colour palette of their own. They are 4-bit (meaning, 16 colour) images that, much like SHP files, receive colours from the game at the moment they're drawn. So I started off by generating a simple black-to-white fade for the palette, with black as the background color. This version also already moved the character down according to the extra Y-offset in the file.

fonteditor_00.png

Next step: making an actual editor. I already had a zooming pixel image viewer from a little C&C-N64 project I worked on in the past few weeks, so that part was no problem (as already seen in the previous image). So the next step: drawing an editing grid on it. Well, I say "on it", but actually I needed three extra image layers positioned both behind and in front of the original image to pull it off, lol. Transparency is a strange thing in .Net controls.

fonteditor_02_grid.png

Next was getting a pixel drawn on that to indicate your editing position. That was easier than expected, really, and now I had a nifty giant pixel following my mouse around. Also note the fancy program icon; Tomsons26 made that :)

fonteditor_03_mousetrackpixel.png

I decided, around this time, to switch to a more colourful palette that would let you easily distinguish the different indices when editing. I just basically went over all hue values and made a nice little rainbow. I also coded in some extra behaviour to allow disabling the grid, and the red frame that shows you which part of it is actually editable.

fonteditor_05_rainbowpalette.png

Of course, an editor is utterly useless if it can't actually save files, a little detail Siberian_GRemlin seemed to forget when he released a "demo" of his editor... eight years ago now. So after editing worked, I went into the mess of trying to save the image data back to palette.

It took a few tries to get it right. :huh:

But, finally, I managed to get a saved file!

HO0ulQxp.png

No, wait, crap, that's one of the failed ones. Ahem. Anyway. The pic I linked before shows the final successful attempt. There's a little pixel I made transparent, in the middle, to prove it was actually edited. Trust me, it was orange originally :P

Now, there's just one thing still missing from the editor... and that's, well, the actual editing, more or less. I could only change the colour to one specific one with the left mouse button, and to background (transparency) with the right mouse button. So I dug up another nice control I had lying around for one of my older projects, namely a palette-loading colour selector. Took some time to adapt it, since the original was meant for 256 colours, but, I'm happy with the final result!

fonteditor_07_palette.png

It's starting to look good, no? :)

At this moment, it's still missing some vital features, though; you can't change the size of the images or their Y-offset, and you can't add new character images to a font. These will come later, but at this moment, I do actually have a working editor.

It's obviously still beta at the moment, but to anyone who wants to mess around with it, here it is:

Westwood Font Editor v0.4

The source code is in the folder too, for those who are interested.

Link to comment
Share on other sites

Not ANOTHER tool Nyer! You're hooked making extremely useful things for us all :P

 

I will try to resist the urge to make a new font for my C&C game as scope creep is a leading cause of death among mod developers but even so, sweet work dude! :cncsmirk:

 

Your 2 looks very Hotline Miami in that editor :P hehe

Link to comment
Share on other sites

New progress: editable Y-offset! Also, a revert button to undo all changes to the current character. I also changed the internal architecture somewhat, by putting all different properties of one character entry into a single object, so I only have one list of internal data instead of four parallel ones. Much more manageable.

 

fonteditor_08_y_oh_y.png

 

After I implement editable width and height, and X and Y shifting of the image data, I'll make another public release :)

 

Dune 2000 fonts are not supported I guess?

I honestly have no idea, but given the fact that game barely uses any WW file formats, I suppose not. If you got any specs and test files, though, I might be able to implement it. You never know; might not be too hard. The current editor is focused on 4-bit fonts though.

Link to comment
Share on other sites

Two of the main features finished:

  • A real list of characters, replacing the small index based number selector.
  • A listing of text encodings, so you can immediately compare your characters with the target encoding.

Showcased on the Central European font used in the Polish language pack:

fonteditor_09_list.png

Link to comment
Share on other sites

A little experiment for possibly implementing Dune 2000 font support (since that's an 8-bit font)... dynamic changing of the palette control to adapt to a larger amount of colors. Basically, they're calculated to use 1/8th of the color label size as in-between spacing.

The hardest part was actually modifying the font size for the transparency/empty indicators so they'd still be visible.

fonteditor_10_eightbitpal.png

Link to comment
Share on other sites

v1.0 is finished! This adds pretty much all features I wanted for it:

  • Changing image dimensions
  • Shifting image data up/down/left/right
  • Copying/pasting entire characters
  • Color picker
  • Adding/removing characters
  • Changing the overall font's maximum size

Note that the mouse scroll wheel is specifically disabled in the main font's settings (number of character and max width & height) to avoid accidentally messing stuff up; decreasing the amount of characters simply removes the excess without prompt, and decreasing the font size cuts all characters in the entire font down to the new size.

fonteditor_11_firstrelease.png

The only thing still left to do for now is figuring out how to add some kind of real palette loading/saving support. Currently, colours can be edited by double-clicking them, but these palette changes can't be saved inside the program, and the only way to reset the palette is to restart the program.

Link to comment
Share on other sites

Cool

 

Dune 2000 fonts are not supported I guess?

I added experimental Dune 2000 support in the new version (1.2.1), but the format is pretty weird, and several of the letters in the font seem to have errors even when read exactly like the header describes, and there's no extra info anywhere in the file that could fix it. Could you give it a test run, and see if the game accepts the fonts produced by the editor?

 

It's possible that you need to edit the first byte in the file to 00 to make it work. Please test that too.

 

By the way, I couldn't match the characters to any existing text encoding... really weird. I even disabled my internal filtering on ascii-compatible and 1-byte-only encodings, and still nothing matched.

Link to comment
Share on other sites

Well, it's more like, 5 formats, now. I added the games list tomsons26 so kindly provided :P

We've been digging through some really ancient Westwood games, lol.

On 2016-11-28 at 1:51 AM, Kilkakon said:

Ah you are right, I see that now :) I've never tried putting numbers there. Heh, lose a mission and get "Error code: 2"? :P

I took the number 2 mostly because its center showed off all the colours nicely  :P

Link to comment
Share on other sites

Um. The TS ones? Inside the .mix files, where else? Anything ending with .fnt is a safe bet.

 

I just implemented a new feature: color tracking. In color picker mode, the palette will highlight the color entry you're currently hovering over in the image, and a popup with the color index and value will appear on the editing grid.

 

fonteditor_15_colorpicker_upgrade.png

 

Next is palette support. When that's finished I'll be making a new release.

Link to comment
Share on other sites

Whoo, did some bug fixes, and ended up adding some new features.

v1.4:

  • Clipboard copy can now also be pasted as image in other applications.
  • The correct symbol will be opened even when the grid columns are reordered.
  • Added preview pane at the bottom.
  • Opening a file by double-clicking in the dialog can no longer paint a pixel.
  • The symbol image now refreshes correctly after a palette revert.
  • Symbols in the grid are no longer centered but drawn at the correct position.

fonteditor_17_preview.png

Link to comment
Share on other sites

lol. "Here's a test with special characters! Very pretty, isn't it?"

It's funny, actually; for the characters listing in the grid I only needed to make that Dune 2000 text encoding one-way (byte -> character), but I decided to implement the other way (character -> byte) while I was at it anyway. And because of that, this thing worked with it right away :D

Then again, the Dune 2000 reordering system was only ever meant for character -> byte (well, character to font index, but that's the same thing, really), so that one was easy compared to the one I originally needed.

On the actual preview generation side, the thing that took the longest was actually auto-wrapping (yes, it does auto-wrapping, though, character based, not word based) and support for line breaks, heh.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Similar Content

    • By CnCRedAlertFan
      Mods that use Ares require to launch the mod through RunAres.bat, how can i run my mod using Ares with CnCNet?
    • By GganbuFondue
      Sometimes on Cncnet lobby the Quickmatch room shows 1/2 when it's 0 in the ladder client.
      Sometimes players seem to unready when they are actually ready. (Unconfirmed)
      Sometimes takes long time to connect and connection fails, repeatedly.
      Sometimes (less often) client randomly freezes, crashes, needing to restart or logoff or reinstall to get back in queue.
      Sometimes client has higher chance to work when not logged in to Cncnet lobby.
      Others have also recently noticed ladder acting weirdly like pre-disconnecting games and ladder page giving connection errors.
      Sometimes client works great without problem.
      Ladder when it works is great avenue for 1v1 and potentially helps the dedicated playerbase grow.
      Here's hoping that things can be tweaked and issues solved or improved.
      Whoever develops the ladder thank you for efforts!
    • By sgtmyers88
      Hey guys as I mentioned about a month ago in another post I recently started RA Redux. Using XCC Mixer (yes I got the latest version) I am having issues with the campaign cutscene videos getting corrupted or being a colorful mess during playback. I am extracting as the recommended .avi as I did for the TD videos. Also I cannot seem to find the map layouts for the RA missions and whatnot. I know in the past I used Nyerguds database as a reference which proved invaluable for finishing the TD Redux campaigns. Example: https://nyerguds.arsaneus-design.com/cncstuff/mappics/n64-testmaps/sct15ea-nomap.png Is there a section for Red Alert that I am somehow missing?
    • By Nyerguds
      With Kamuix writing a guide on inserting maps into the N64 version, I got busy looking into how it would be possible to more-or-less automatically generate height maps of C&C maps, so inserted maps actually look good in N64.
      It took me a couple of tries, but finally I managed to create a set of tools to convert maps to height maps. All of these are contained inside the CnC64 File Converter. (v1.0.3 or higher)
       
      The basics:
      C&C terrain is not three-dimensional, but gives an illusion of 3D with the images on the cliffs. However, this illusion falls flat (literally) in a real 3D environment. To remedy this problem, they added greyscale images to the missions in N64 that indicate the elevation of the terrain (brighter = higher). So if you want to import maps into an N64 ROM and have them actually look good, they are going to need a height map too.
      Elevation is not done per cell, but on the four corners of each cell. Because of this, the height map images have a size of 65x65, whereas C&C maps are only 64x64 cells. However, the converter takes care of that automatically, so we'll just focus on making a 64x64 height map.
      The basic steps to make an image using the CnC64 File Converter:
      Open a map file, and convert it to a basic terrain levels image. This image will contain only the cliffs of the map. Save the terrain levels image and edit it in an image editor, and fill areas surrounded by cliffs with the colour for that level. If multiple levels are needed, use the brighter colors in the image's palette. There are 4 elevation levels that can be used. Open the map in the File Converter again, and generate the height map, using the terrain levels image you created. Convert the final image to 65x65 height map, and save it as paletteless N64 IMG format. The detailed steps:
       
      1. Convert a map to a basic levels image:
      Open the map you want to make a height map for. The process works best if there's a .ini file with it that tells the program which theater the map is, and how big the actual used area on the map is. The ini file itself will not be accepted by the program, so open either the .bin file, or the already-converted .map for the N64.
      Open the "Convert" menu, go to "Height map generation", and select "To basic levels image (from map)". This option will only work if you have a map loaded.

      You will end up with an image which has a dark gray background, and only the cliffs on it, in a slightly brighter gray. Note that this is a paletted image with five colours; even if the image is later saved as high-colour, it will be matched back to these five colours to be interpreted as height levels.

      As you see, the image has some modifications compared to the original; the conversion takes the last terrain types encountered at the edges of the actually used portion of the map, and stretches them to the full frame. This is done so cliffs placed outside a map's border to control reinforcements would not influence the height map.
      Note that the image is not saved yet at this point, so press Ctrl+S and save it to disk.
       
      2. Create the height levels image:
      Now the real work. Open the saved image file in your favourite image editor, and connect the cliffs to form closed areas. To do this correctly, open the map itself in a map editor so you can see the directions of the cliffs, and see what kind of elevation each area should have. Here's my process in a few steps:

      It doesn't matter if the image is saved in high colours, but as noted before, the converter will match it back to the five colours in the original image's palette, so there's no use in making detailed slopes in this. Its only function is to separate the terrain into levels.
      For the record, the grey tints used for the five levels are:
      #000000 (R=0, G=0, B=0) : Pure black. Shouldn't be used, since water creates a slight depression into terrain, and you can't do that on the lowest level. #404040 (R=64, G=64, B=64) : Basic terrain. This will be the starting level on the image, and should be seen as lowest level you can use. #808080 (R=128, G=128, B=128) : Cliffs elevation #1 #C0C0C0 (R=192, G=192, B=192) : Cliffs elevation #2 #FFFFFF (R=255, G=255, B=255) : Cliffs elevation #3. Note that this is the highest possible level, and no more terrain details can be put on top of this. Rivers should work, though, since they decrease the terrain. Anyway, with that done, we end up with our terrain levels image:

       
      3. Creating the actual (64x64) height map
      Now we got our levels image this is fairly simple. Once again, load the map into the converter program. Open the "Convert" menu, go to "Height map generation", and now select "To height map using levels (from map)".

      It will ask you to select the height levels image. Select the final product of our work from the previous step.
      Now the real magic happens. It will generate an image that adapts the terrain to the new heights, and if your cliffs match your levels image correctly, it will make sharp elevations for the cliffs and smooth slopes for the openings where the level decreases on non-cliff terrain. Furthermore, the height of rivers and other water will be applied on each specific level.

      Once this step is done, feel free to save the image if you want to add some more specific tweaks to it, or fix any errors the generator might have made. If you think the map is good enough, though, you can continue straight to the next step.
       
      4. Converting the height map to the final format
      So we got a 64x64 height map image now, loaded into the converter. The N64 game not only needs the image to be 65x65, but also needs it saved in the specific paletteless IMG format.
      First things first: go to "Convert", "Height map generation", and select the final option: "To 65x65 height map image (from image)". As you see, this is the only option in there that doesn't use a C&C map as input but an image.

      Select it, and the 64x64 data will be centered in a 65x65 frame, creating smoother edges everywhere.

      Starting from v1.04, the image in the editor will automatically identify itself as paletteless N64 image, so all you need to do is press Ctrl+S to save it in the correct format.
      ...and that's it! You have your height map, ready to insert into the ROM. The name format the game looks for is exactly the same as for the .ini and the .bin, just with .img as file extension.
    • By Niko5557
      As the title says, whenever I try to launch the CnCNet launcher for Yuri's Revenge, it opens up the Mental Omega launcher.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...