topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday April 29, 2024, 12:47 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kyrathaba [ switch to compact view ]

Pages: prev1 ... 112 113 114 115 116 [117] 118 119 120 121 122next
2901
DC Member Programs and Projects / The Gradiator
« on: March 07, 2008, 04:26 PM »
I've put a little utility program up on my little corner of DC.  It allows the user to view different possibilities in the area of linear gradients with which to decorate Windows forms.  The program allows the user to cycle through randomly generated gradients.  If you find one you like, you can take a snapshot of it.  Optionally, the snapshot can contain text showing exactly which two colors form the endpoints of the gradient.  Different sizes are possible, and the program provides a quick shortcut to access the images subdirectory.  There is a help file included that can be accessed from the main form.  If anyone finds this useful, I could refine it with suggested features:

The link is:

http://www.dcmembers...ograms/Gradiator.zip

(requires .NET 3.5)

2902
Developer's Corner / Re: The DC Coders' Breakfast Club
« on: February 26, 2008, 11:39 AM »
Today, I'm continuing to flesh out an area editor for the CRPG I'm developing.

2903
Living Room / Re: about to switch to a Widescreen LCD.
« on: February 17, 2008, 09:27 PM »
Mine's an I-Inc TW191D.  No complaints.  Been using it about a year.  Good sharp images at 1440x900.

2904
Living Room / Re: Who is running the site?
« on: February 16, 2008, 11:15 PM »
Hello all :)

Just wanted to let everyone know that I'm working on the next series of C# tutorials.  They center around creating an adventure game.  The tutorial series will walk the reader through the entire coding of a game by way of a lengthy series of assignments.  Each assignment will have one or more objectives.  The accompanying PDF file will explain design decisions and code rationale as work progresses, and there will be matching snapshots of the project after the completion of key assignments, so that the reader has access to the working C# solution directory as the project exists at various points in its development.  It'll be awhile before it's ready for release.  Right now, I've been working on it in my spare time the past six weeks and I'm currently working on Assignment #24.  I've been away from the site quite a bit in recent months, but I'm looking forward to putting all this together and sharing it.  Mouser, can you shoot me my ftp password, please.

2905
Living Room / Re: Who is running the site?
« on: January 10, 2008, 08:07 PM »
I've been away quite awhile, have a new PC system, and have misplaced some data I need that Mouser can access :)

2906
Living Room / Who is running the site?
« on: January 09, 2008, 05:59 PM »
Is Mouser still on sabbatical?  I've been absent quite awhile and I thought I read something about him taking a 3-month break from the site.  Need to know something that someone will admin privs could help with...

P.S.  Happy New Year, everyone :)

2907
Living Room / Re: Thank you for this site and the people here.
« on: June 19, 2007, 10:27 AM »
My sincere condolences, Jeff.

2908
Developer's Corner / Re: Introductory C# web-based tutorials
« on: May 31, 2007, 08:19 AM »
Maybe I'm a glutton for punishment, but I'd rather roll-my-own than learn one of the existing IF systems.  The compiler is a console application, but the interpreter will be a WinForms app.  Once I have the most basic of frameworks established, I'll upload it for some critiques.

2909
Developer's Corner / Re: Introductory C# web-based tutorials
« on: May 30, 2007, 09:22 PM »
I haven't shelved the C# tutorial series.  Future tutorials will be more fun for me to write, as they will cover more advanced material.  I found the topic-matter for the first series (Completely Uninitiated) rather dry, although very necessary. 

Right now, I'm taking a break from the tutorials and working on an interactive fiction compiler.  Fun stuff :>

2910
I've used iDailyDiary for the past two years.

2911
Very helpful.  Thanks Hollowlife :>

2912
Yeah, I'll upload the entire dummy project.

2913
Take your time, I'm on no timetable.  Besides, I'm at the mercy of your samaritanism ;>

2914
Hollowlife, here is the dummy interpreter EXE and the text file similating a game file.  Unzip, then open folder and run the EXE.  You'll see my intentions.  If you can provide source code on wrapping these two inside an EXE, I'll have learned two useful things today :>

2915
I'll whip up those files for you now, Hollow.

2916
I did a little experimentation and came up with a C# program that can, itself, compile C# source code.  The downloadable zip contains a folder with two files: (1) temp_app.exe, and (2) myfile.txt.  The first file is the physical executable I created with the Visual C# Express IDE.  The second file contains a brief C# program source code listing.  

Make sure you have the .NET Framework 2.0 installed, then open the folder and double-click on the EXE.  Read the program's console output and wait for it to exit, and you'll see that the text source file has been compiled into "myfile.exe" :> 

Here's the source code:

Code: C# [Select]
  1. using System;
  2. using System.IO;
  3. using System.CodeDom;
  4. using System.CodeDom.Compiler;
  5. using Microsoft.CSharp;
  6.  
  7. namespace CompilationTest {
  8.  
  9.  
  10.  
  11.     class Comp {
  12.  
  13.         public static int Main(string[] args) {
  14.  
  15.            
  16.             CodeDomProvider cdp = new CSharpCodeProvider();
  17.  
  18.             bool result = Comp.CompileCode(cdp, "myfile.txt", "myexe.exe");
  19.  
  20.             Console.WriteLine("\tProgram will exit on its own in 7 seconds...");
  21.             System.Threading.Thread.Sleep(7000);
  22.  
  23.             return 1;
  24.  
  25.         }
  26.  
  27.  
  28.         public static bool CompileCode(CodeDomProvider provider, string sourceFile, string exeFile) {
  29.  
  30.             string PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  31.             CompilerParameters cp = new CompilerParameters();
  32.             CompilerResults cr = null;
  33.  
  34.             // Generate an executable instead of
  35.             // a class library.
  36.             cp.GenerateExecutable = true;
  37.  
  38.             // Set the assembly file name to generate.
  39.             cp.OutputAssembly = exeFile;
  40.  
  41.             // Generate debug information.
  42.             cp.IncludeDebugInformation = true;
  43.  
  44.             cp.ReferencedAssemblies.Add("mscorlib.dll");
  45.  
  46.             // Save the assembly as a physical file.
  47.             cp.GenerateInMemory = false;
  48.  
  49.             // Set the level at which the compiler
  50.             // should start displaying warnings.
  51.             cp.WarningLevel = 3;
  52.  
  53.             // Set whether to treat all warnings as errors.
  54.             cp.TreatWarningsAsErrors = false;
  55.  
  56.             // Set compiler argument to optimize output.
  57.             cp.CompilerOptions = "/optimize";
  58.  
  59.             // Set a temporary files collection.
  60.             // The TempFileCollection stores the temporary files
  61.             // generated during a build in the current directory,
  62.             // and does not delete them after compilation.
  63.             cp.TempFiles = new TempFileCollection(PersonalFolder, true);
  64.  
  65.             Console.WriteLine();
  66.  
  67.             if (provider.Supports(GeneratorSupport.EntryPointMethod)) {
  68.                 // Specify the class that contains
  69.                 // the main method of the executable.
  70.                 //cp.MainClass = "Comp";
  71.  
  72.  
  73.                 // Invoke compilation.
  74.                 cr = provider.CompileAssemblyFromFile(cp, sourceFile);
  75.  
  76.                 if (cr.Errors.Count > 0) {
  77.                     // Display compilation errors.
  78.                     Console.WriteLine("\tErrors building {0} into {1}",
  79.                         sourceFile, cr.PathToAssembly);
  80.                     foreach (CompilerError ce in cr.Errors) {
  81.                         Console.WriteLine("  {0}", ce.ToString());
  82.                         Console.WriteLine();
  83.                     }
  84.                 } else {
  85.                     Console.WriteLine("\tSource {0} built into {1} successfully.",
  86.                         sourceFile, cr.PathToAssembly);
  87.                     Console.WriteLine("\t{0} temporary files created during the compilation.",
  88.                         cp.TempFiles.Count.ToString());
  89.                 }
  90.             }//end if
  91.  
  92.             // Return the results of compilation.
  93.             if (cr.Errors.Count > 0) {
  94.  
  95.                 return false;
  96.  
  97.             } else {
  98.  
  99.                 return true;
  100.             }
  101.  
  102.  
  103.         }//end method CompileCode()
  104.  
  105.     }//end class Comp
  106.  
  107. }//end namespace CompilationTest

2917
Thinking about it further, if I supplied you with a text file containing the string "I am a string", and an EXE interpreter that when executed would write that file's string to the console, could you in turn show me how to include those two files into an EXE wrapper such that executing the EXE caused the string to be written to the console?

2918
Excellent.  I don't have the compiler anywhere near a functional level, yet.  I'm still working on methods to extract, from the source file, data for rooms, items, actors, etc.  I'll work on it.  If I can just get enough done to compile a simple game (say, two connected rooms), and can provide an interpreter to run the compiled game file, I can probably learn enough by seeing how you implement that for me to extend your source code as I add further functionality.


2919
I've discovered that .NET 2.0 contains a compiler class that permits runtime compilation of sourcecode.  So it's possible to have a C# program that can itself produce a physical executable.  This opens up more possibilities.

2920
Thank you all for the input, it's much appreciated.

Obviously, I'm only doing this project in my spare time, as a learning exercise (an exercise made more interesting/fun because I like text-adventures).  I have no aspirations to one-up mature authoring tools like Inform 7 or TADS 3.  However, I am going to incorporate such elements in my game language that -- to me -- are easier to use.

HollowLife, thank you for your offer.  It's much appreciated.  If I understand you correctly, you're staying that if I can come up with a working interpreter EXE, I can supply that, plus a binary game file produced by my game compiler, and you can give me source code that would incorporate those two files into an EXE.  What language would you supply this in?  I am only familiar with C# and (to a lesser extent) Visual Basic.  However, I do have a couple of different C/C++ compilers.

Eoin, thank you for the link, and the advice.

You'll need your interpreter to not be fussy about where it gets the binary source data from. So it should be able to read it from a file, and also quite happily accept being given a raw pointer to the data already in memory.

I was planning on using .NET's object serialization capabilities, so that my compiler would read in the source file, syntax check it, and if it doesn't fail any syntax checks it would incorporate the data read in from file into game objects (rooms, items, actors, etc.).  The resultant compiled game file would be a master game object (containing all other objects), serialized to disk.

Then, the interpreter would deserialize the file and cast it to the master game object, then proceed to use that master game object's properties and methods to produce the interactive game that the end-user experiences.

2921
Yes, I was thinking of a game compiler that would take the text source file, convert it to a serialized binary file of game objects (derived from the source file information), and bind this game file and the interpreter into one EXE.

My idea was for game authors to have the option of releasing their games as EXEs, or as binary game files that come with a separate interpreter.  Magnus Olsson wrote this sort of thing for z-code games using something called Jzip (I think that's what it was called).

2922
Here's one option I found, while searching:

http://support.microsoft.com/kb/304655

One could have a C# program that contains all interpreter methods, and then use the ICodeCompiler compiler execution interface of the .NET framework to create an EXE, based on game source text read into the program.

2923
So, in effect, what I would need to do is write a program that

(1) can compile plain-text game source files into binary game files ready for interpretation

(2) can interpret the binary game file produced by compilation

(3) can itself produce an EXE housing the binary game file and interpreter rolled together.

Sounds challenging.  I've never considered how C# might be capable of producing a program that can, in turn, produce its own EXEs.

I'm interested in doing this mostly for the learning involved.  In the world of Interactive Fiction games, generally one uses an interpreter to open and play compiled game files.  There's nothing wrong with that.  And, in fact, many end-users would probably be more comfortable with that arrangement than with running an EXE, even if their virus-scanner gave a thumbs-up.


2924
I'm writing the game compiler in C#.  The game compiler will take game source files, which are plain text files, and read their data into game objects that will then be serialized to disk during compilation.  This is the binary game file the interpreter (a separate program) will run for the user.  I'll also be writing the interpreter in C#.

The reason for asking about this is that I noticed on Adam Cadre's homepage (he's a well-known Interactive Fiction game author) that he had some of his Inform games available for download as standalone EXE files, even though normally you'd have to run an Inform game with an interpreter such as Glulx.

2925
I want to bundle the EXE interpreter and the binary game source file.  These two files would be contained by the EXE and when the user launched the EXE, it would, in effect, cause the interpreter to load the game file and run it.  To the end user, it would appear that the EXE is itself the game.

Pages: prev1 ... 112 113 114 115 116 [117] 118 119 120 121 122next