Recent Posts

Pages: [1] 2 3 ... 10
1
I'm glad it worked out!

-Brett
2
Outpost 2 Programming & Development / Re: OP2 Mission SDK Version 4.1.0 in development
« Last post by TechCor on January 15, 2020, 01:24:50 AM »
I made OP2MissionSDK a submodule in DotNetMissionSDK.

Everything looks good!

Thanks for the merge, guys!
3
Projects / Re: OP2 Mission Editor
« Last post by TechCor on January 14, 2020, 12:50:54 AM »
Very cool. I want to expand HFL to include some of these items so I can view the contents, and maybe add the ability to control the day/night cycle speed. :)

I assume "Map.lightLevelBrightnessAdjustment" is referring to "54F854   0x5C   char[] lightLevel". What size is this array? numTiles?

Trying to understand this:
actualDaylightPosition is the current tileX daylight is on which wraps at map.tileWidth i.e. if the map is 256 wide, actualDaylightPosition is 0-256. Kind of a clever way to avoid a conditional wrap.

It looks like the "lightLevel" is the distance from the "actualDaylightPosition". To avoid a negative value, it adds 512 to it (max map width).
tileX - actualDaylightPosition + 512 = lightLevel:
0 - 512 + 512 = 0 (dist = -512, lightLevel = 0)
511 - 512 + 512 = 511 (dist = -1, lightLevel = 511)
511 - 256 + 512 = 767 (dist = 255, lightLevel = 767)
511 - 0 + 512 = 1023 (dist = 511, lightLevel = 1023)

Trying to envision what this would look like, but it seems like something is off. Maybe actualDaylightPosition/lightLevel is not related to the actual daylight, but instead lightLevel is an index into the "lightLevelBrightnessAdjustment" array (size 1024). Then the value returned from that array is used as a multiplier. This would give you "bands of light".

Total speculation, of course. :D
4
Projects / Re: OP2 Mission Editor
« Last post by Hooman on January 13, 2020, 07:58:18 AM »
It's been a while since I looked at the day/night cycle code. I don't think it was ever understood in great detail, though there were a number of calculations that were noted down. Well, the integer math was noted down. This is one of the few places in the code where floating point was used.

In OllyDbg, there was an object marked as DayNight. Internally, there is a daylightPosition field, which ranges from 0..65535. There is also another associated field actualDaylightPosition, which is set to daylightPosition * Map.tileWidth / 65536. Despite the name, it's possible that point actually represents the darkest point on the map.

During the update cycle, daylightPosition is incremented by 4. I'm not certain, but I suspect this update cycle is called every 4 ticks, so that may be why. The actualDaylightPosition is then updated according to the formula. The game engine doesn't have any other global references to the daylightPosition field, though does have a number of references to the actualDaylightPosition field.

When drawing unit graphics, the internal graphics API has a lightLevel parameter. It is calculated as Unit.tileX - actualDaylightPosition. There is some code that artificially bumps up the lightLevel by 512 when bDaylightEverywhere is not set. I had to check that a few times to make sure I was reading it right. From the looks of it, it might actually be a darkness level rather than a light level. In other places, if bDaylightEverywhere is not set, it bumps up the lightLevel by Map.widthInTiles.

There is also a Map.lightLevelBrightnessAdjustment array, which is an array of bytes (char). I believe that array somehow maps on to the bands of day/night across the map, though I don't think that area is well understood. In particular, I've never been too certain on how it determines the width of day/night regions.
5
Feedback/Suggestions/Problems / Re: SVN server is down again
« Last post by Vagabond on January 11, 2020, 07:49:57 PM »
Thanks for getting the svn up and running again. Also, thank you for posting the mission code for all the green world missions and the updated pie charts. Nice to see it make the public repository. I'll make the effort to message you on chat next time. I'm the opposite and tend to not be on IRC at all.

-Brett
6
Feedback/Suggestions/Problems / Re: SVN server is down again
« Last post by Leviathan on January 10, 2020, 09:05:37 AM »
Its online again.

Nope not really been checking forums for a long time.

Leave me a message on IRC anytime and I will see it :)
7
Projects / Re: OP2 Mission Editor
« Last post by TechCor on January 07, 2020, 12:52:43 PM »
Thanks for the feedback.

I can have some code pull the most commonly used cell types for a tileset + graphic index from a bunch standard OP2 maps and  write it to a config file. Those can then be painted at the same time as the terrain graphics.

I haven't been focusing too much on the map capabilities since map editors already exist, so mission work is taking priority. Eventually, I want to add the ability to edit tilesets, mappings, terrain types, and create and paint tile groups.

- I will increase the size of terrain buttons to match structures/vehicles.

- When you start up, you are already looking at a new mission (no map loaded). If you import a map and then create a new mission, you will notice that you are taken back to this screen. I would have liked to select a blank map of some size, but starting from scratch looks complicated (no tilesets, mappings, or terrain types), and OP2Utility does not seem to support it anyway.

---
I was actually looking for how the big window/column of light is calculated. I assume it is some multiplier like "1 is daylight" and "0.25 is night" with some X sized column width, and Y amount of falloff. Also important is how the "initial light level" is applied, and perhaps the movement rate when daylight moves.

Knowing the other stuff will be helpful later, since I could have vehicle lights and paint blight.
8
Feedback/Suggestions/Problems / SVN server is down again
« Last post by Vagabond on January 06, 2020, 09:46:18 PM »
Looks like the SVN server is down again. If Leviathan is checking the forums, would you mind restoring it again?

Thanks,
Brett
9
Projects / Re: OP2 Mission Editor
« Last post by Vagabond on January 06, 2020, 09:44:10 PM »
TechCor,

The editor is looking great. I downloaded it and give it a try. A couple of thoughts below. I'm overall very impressed, so don't take these as negative. It is a pretty massive project.

A big feature request is to store the cell index associated with a terrain tile and automatically update the cell index when the tile is placed. I spent many hours in the old mapper updating cell indexes to match my terrain types, when I usually just wanted to change the cell index to the default value of the terrain image. It would be nice to maybe disable this feature temporarily if desired, but default to updating the cell index. I know mapping all the cell indexes to tiles could be a pretty big time suck.

1. The initial dialog to change screen resolution and grid color doesn't seem to have an accept or ok button. I just used the top right X, but might be nice to add an OK button as I was a bit confused if it would cancel my settings or not.

2. I tested it on a laptop. The terrain tiles on the right side of the screen are pretty small. I had a difficult time distinguishing the tiles. It would be nice if they could be maybe doubled in size or more.

3. I tried creating a new mission. It just flashed a small dialog box too small for me to see and didn't seem to do anything else. When I tried opening an existing map everything seemed to work.

I appreciate that you allow saving maps in the original format. This would allow people who want to use C++ for mission development to still use your editor for map editing.

----

Concerning the lighting. Do you mean the shadows on buildings and vehicles or the day night cycle or building/vehicle lights in the dark?

The unit shadows are simply 1 bit bitmaps that are added to each image. They are contained in the .prt/.bmp file like other sprites.

The day night cycle and edge of light is produced by applying a mask over the tiles. The same principle is used for the blight but a different color is used. Hooman wrote a sample program to show how it works and you can find some details here: https://wiki.outpost2.net/doku.php?id=outpost_2:helper_programs:virus_mask. The program is written in Visual Basic and the source is available, so you could inspect it. I have a hard time reading Visual Basic code not being fluent in the language.

Quote from Hooman in how light/dark tiles are completed internally:
Quote
When determining which tile to display, it examines 4 tiles in a 22 setup, using 1 bit from each tile to get a 4 bit index. (There are 16 tiles in VirMask.raw). It's probably easiest to think of the actual virus display as being off by half a tile.

I believe VirMask.raw is contained in Art.vol.

----
EDIT: It appears the SVN repository is down again, so you might not be able to pull the source code. Someone might have a copy of it though if you want to inspect.
10
Projects / Re: OP2 Mission Editor
« Last post by TechCor on January 05, 2020, 11:46:22 PM »
Mission Editor v0.3.0:
https://github.com/TechCor8/OP2MissionEditor/releases/tag/0.3.0

This version focuses on usability improvements for existing functionality.

  • Added player colors to units
  • Added menu shortcuts
  • Option to toggle grid overlay
  • Option to toggle unit overlay
  • Added Unit info text (upper-left corner)
  • Added console window
  • Display cursor grid coordinates on status bar
  • Added paint overlay
  • Placement now considers a structure's bulldozed area
  • Increased minimap resolution (4x)
  • Optimized map loading (~400% faster)
  • Added units on minimap
  • Minimap changes aspect to match map
  • Units are updated when deleting players and changing colors and colonies
  • Paint window shows the correct player unit color in the pane

Upcoming:
  • Walls/Tubes pane
  • Mission variants (including difficulty variants)

Note: Guard post crashing has been fixed in the DotNetMissionSDK, which is included in this release.

If anyone knows the lighting algorithm used by the game, please let me know about it. I'd like to emulate the light settings in the editor. Thanks!
Pages: [1] 2 3 ... 10