rough list of todo for openra

removed (c)TOSHIBA from Openra.TechTree - beedee fails
added first-pass c# support to corfu
converted ijw internet's todo file into the form corfu likes
palette usage analysis tool for openra, so we can find a good slot to hijack

git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1319 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
(no author)
2007-07-22 16:10:57 +00:00
parent dde1852b12
commit a22d2487d6
9 changed files with 227 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ using OpenRa.FileFormats;
namespace OpenRa.Game namespace OpenRa.Game
{ {
// todo: synthesize selection color, and generate duplicate palette block!
public class HardwarePalette public class HardwarePalette
{ {
const int maxEntries = 16; // dont need anything like this many, const int maxEntries = 16; // dont need anything like this many,
@@ -27,8 +28,7 @@ namespace OpenRa.Game
AddPalette(pal); AddPalette(pal);
foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" }) foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" })
AddPalette(new Palette(pal, new PaletteRemap( AddPalette(new Palette(pal, new PaletteRemap(FileSystem.Open(remap + ".rem"))));
FileSystem.Open( remap + ".rem" ))));
} }
void Resolve() void Resolve()

View File

@@ -15,8 +15,6 @@ namespace OpenRa.Game
TechTree.TechTree techTree = new TechTree.TechTree(); TechTree.TechTree techTree = new TechTree.TechTree();
SpriteRenderer spriteRenderer; SpriteRenderer spriteRenderer;
//Package package;
Sprite blank; Sprite blank;
Dictionary<string, Sprite> sprites = new Dictionary<string,Sprite>(); Dictionary<string, Sprite> sprites = new Dictionary<string,Sprite>();
@@ -30,15 +28,15 @@ namespace OpenRa.Game
techTree.Build("FACT", true); techTree.Build("FACT", true);
spriteRenderer = new SpriteRenderer(renderer, false); spriteRenderer = new SpriteRenderer(renderer, false);
LoadSprites("../../../buildings.txt"); LoadSprites("buildings.txt");
LoadSprites("../../../units.txt"); LoadSprites("units.txt");
blank = SheetBuilder.Add(new Size(64, 48), 16); blank = SheetBuilder.Add(new Size(64, 48), 16);
} }
void LoadSprites(string filename) void LoadSprites(string filename)
{ {
foreach (string line in File.ReadAllLines(filename)) foreach (string line in Util.ReadAllLines(FileSystem.Open(filename)))
{ {
string key = line.Substring(0, line.IndexOf(',')); string key = line.Substring(0, line.IndexOf(','));
sprites.Add(key, SpriteSheetBuilder.LoadSprite(key + "icon.shp")); sprites.Add(key, SpriteSheetBuilder.LoadSprite(key + "icon.shp"));

View File

@@ -4,6 +4,7 @@ using System.Text;
using OpenRa.FileFormats; using OpenRa.FileFormats;
using System.Drawing; using System.Drawing;
using BluntDirectX.Direct3D; using BluntDirectX.Direct3D;
using System.IO;
namespace OpenRa.Game namespace OpenRa.Game
{ {
@@ -40,6 +41,16 @@ namespace OpenRa.Game
return (1 - t) * a + t * b; return (1 - t) * a + t * b;
} }
public static string[] ReadAllLines(Stream s)
{
List<string> result = new List<string>();
using (StreamReader reader = new StreamReader(s))
while (!reader.EndOfStream)
result.Add(reader.ReadLine());
return result.ToArray();
}
public static T[] MakeArray<T>(int count, Converter<int, T> f) public static T[] MakeArray<T>(int count, Converter<int, T> f)
{ {
T[] result = new T[count]; T[] result = new T[count];

View File

@@ -2,34 +2,14 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenRa.TechTree")] [assembly: AssemblyTitle("OpenRa.TechTree")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TOSHIBA")] [assembly: AssemblyCompany("IJW Software")]
[assembly: AssemblyProduct("OpenRa.TechTree")] [assembly: AssemblyProduct("OpenRa.TechTree")]
[assembly: AssemblyCopyright("Copyright © TOSHIBA 2007")] [assembly: AssemblyCopyright("Copyright © IJW Software 2007")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("af5f7d2f-f905-4a72-9542-f86acbe508ec")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.BlockCacheVisualizer
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.DataStructures", "OpenRa.DataStructures\OpenRa.DataStructures.csproj", "{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRa.DataStructures", "OpenRa.DataStructures\OpenRa.DataStructures.csproj", "{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteUsage", "PaletteUsage\PaletteUsage.csproj", "{54577061-E2D2-4336-90A2-A9A7106A30CD}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -101,6 +103,16 @@ Global
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Mixed Platforms.Build.0 = Release|Any CPU {2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Win32.ActiveCfg = Release|Any CPU {2F9E7A23-56C0-4286-9C8E-1060A9B2F073}.Release|Win32.ActiveCfg = Release|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Debug|Win32.ActiveCfg = Debug|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Any CPU.Build.0 = Release|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Win32.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -0,0 +1,49 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{54577061-E2D2-4336-90A2-A9A7106A30CD}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PaletteUsage</RootNamespace>
<AssemblyName>PaletteUsage</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

51
PaletteUsage/Program.cs Normal file
View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace PaletteUsage
{
class Program
{
static void Main(string[] args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.RestoreDirectory = true;
ofd.Filter = "PNG Image Cache (*.png)|*.png";
if (DialogResult.OK != ofd.ShowDialog())
return;
Bitmap bitmap = new Bitmap(ofd.FileName);
int[] f = new int[256];
foreach (byte b in ImageBytes(bitmap))
++f[b];
for (int i = 0; i < 256; i++)
{
if (i % 8 == 0)
Console.WriteLine();
Console.Write("{0} -> {1}", i.ToString().PadLeft(3), f[i].ToString().PadRight(8));
}
}
static IEnumerable<byte> ImageBytes(Bitmap bitmap)
{
int width = bitmap.Width;
int height = bitmap.Height;
for( int i = 0; i < width; i++ )
for (int j = 0; j < height; j++)
{
Color c = bitmap.GetPixel(i, j);
yield return (byte)c.R;
yield return (byte)c.G;
yield return (byte)c.B;
yield return (byte)c.A;
}
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PaletteUsage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PaletteUsage")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("93fb03d7-e484-45a8-bfe0-c0560814553a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

64
todo.todo Normal file
View File

@@ -0,0 +1,64 @@
OpenRA
------------------------------------------------------
[ ] Automagically work out unit rendering offsets based on SHP size
[ ] Ore
[ ] Better harvester logic - seek out more ore when harvesting, until full
[ ] Fix weird delegate names - Provider<T>, Comparison<T>, Converter<T>, Action<T>
should be used where appropriate. `Func` says nothing, and is damned misleading
when the delegate isnt referentially transparent... IE, not a `function`.
Note that the lack of referential transparency for Provider<T> cannot be helped,
it's in the nature of an object that converts () -> T.
[ ] Palette hax for selection outlines. Basically, just hijack a palette entry that's not
getting used, and draw the selection borders into the SHP images using that color.
Then we double up the hardware palettes, and we can draw selection with no extra cost.
(Except maybe losing any alpha=0 optimization the backend of the shader hardware does)
[ ] Weapons
[ ] Consume more caffeine!
[ ] Multiplayer!
[ ] Unit turn rate as specified in rules.ini
[ ] Infantry squishing logic (tracked vehicles do this)
[ ] Time-to-build overlay on sidebar
[ ] Mod support
[ ] Get rid of all the damned static classes! Makes it REALLY HARD to reuse code,
dependencies aren't easily visible (or even substitutable, which matters more)
[ ] Group pathfinding logic
[ ] Special-case pathing for floating units, flying units...
Does existing pathing work for boats? float=?? speeds should tell us everything required..
[ ] Shroud rendering. This is going to be ugly, and it's going to hurt perf, unless we can optimize
the hell out of the other rendering based on where shroud blocks happen to be..
[ ] Optimize ground renderer, so we only submit visible chunks, not whole rows.
For machines with severe vertex-rate issues, use 2x2 chunks or larger for some things.
[ ] Configuration option for choosing which tuned solution to use:
- Cope with lack of HW VP
- Cope with lack of fast texture memory (although UMA makes this almost a non-issue)
- Cope with REALLY WINFUL FAST HEAVENLY HARDWARE (The boss might want to play this :P )
[ ] Console
[ ] Ditch special unit classes, use templates extracted from rules.ini instead.
Push the special-case logic into code that can be named.
[ ] Remove all remaining `../../../` bullshit from the code. We should be able to set our datapaths
externally, then `just go`. The FileSystem class is there to facilitate this.
[ ] Read/write distinction on IFolder implementors. I think Package should be read-only,
FS folders can be mounted read-only or read-write, (or even write-only, but that's odd...)
Use FileSystem.Create() to automatically place output files on sensible mounts.
[ ] Factor duplication out of Sheet, HardwarePalette. Both contain logic for converting bitmaps to
hardware textures on demand.
[ ] Refresh hardware image of a Sheet if its bitmap content changes. This will kill the prefetch
bugs permanently!
[ ] Solid buildings, units