Results 1 to 20 of 20

Thread: Developing a game engine

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Developing a game engine

    Hi there I am a bit new to VB.NET and I am planning to develop a 2d game engine.

    The game engine will let you edit your own game levels (with collisions and monsters etc), using your own resources from a "Resources" folder (contains graphics and audio).

    And when you finish your game, my game engine will let you compile your whole game (including the resources) into one single .exe file and will let you share the .exe file with everyone (they simply have to run the .exe and can already play the game).

    I already finished my engine (in the sense of building game levels). But I have no idea how to do the compiling part.

    How can I do that? How can I make a button that, when pressed, will compile a whole project into one .exe file?

    What are your ideas?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Developing a game engine

    Welcome to the forums

    That functionality is already built into the .NET IDE - just "Build" your solution and an EXE file will be created for you.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Developing a game engine

    Hello Hack, and thank you.

    However, I don't think that's what I need. I know I can use the Build Solution option to create a .exe of my game engine. But what I need is that my users (my users being game developers, not players) will be able to build their games using my engine and then my engine (my application, not visual studio itself) will build a .exe of their game project. Basically, my users have no access to visual studio whatsoever.

    I develop a game engine --> I give it to my user --> My user creates a game with my engine --> My user asks my engine to "build" a .exe --> The resulting .exe is a game.

    I don't know how to make my application compile that for the user.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Developing a game engine

    You can't make an .EXE unless you run source code through a compiler.

    Your best bet would be to have your friends get the same version of .NET you have and they can use that to make their .EXE

    Otherwise, you will have to make your own compiler for .NET and that ain't gonna be easy, if it is even possible.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Developing a game engine

    Hmm... but, hey... I have seen 2d game engines that do just that and all I have to do is press one button. For instance, I believe Game Maker does export to .exe file or something.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Developing a game engine

    I'm betting it does the export to an "or something"....not an exe file.

    You can get something to export to a file (an exe is an executable set of programming code), but that is not the same as compiling source code into an executable exe.

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Developing a game engine

    Ah, so perhaps what I should do is export to "Some piece of data" along with an application that "reads the piece of data" to produce the game? That sounds about good.

    I think I know how to "compress some data" and read it from another application... but how would that work with graphics/audio? I don't want the players to be able to fiddle with them...

  8. #8
    Addicted Member
    Join Date
    Mar 2010
    Posts
    231

    Re: Developing a game engine

    You wan't to create something like Game Maker with VB.NET - you are kidding right

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Developing a game engine

    Quote Originally Posted by mitko29 View Post
    You wan't to create something like Game Maker with VB.NET - you are kidding right
    Did I say I was creating something like Game Maker with VB.NET? Really? Are you kidding me?

    In any case - no. It is a game engine, but something by far simpler and mostly for learning. I am curious about the "game compilation" mechanics used in various engines like Game Maker. In fact, I only mentioned Game Maker in my last post as an example of such mechanic - in the whole rest of this thread Game Maker is never mentioned.

  10. #10
    Addicted Member
    Join Date
    Mar 2010
    Posts
    231

    Re: Developing a game engine

    Quote Originally Posted by Solemni View Post
    Did I say I was creating something like Game Maker with VB.NET? Really? Are you kidding me?

    In any case - no. It is a game engine, but something by far simpler and mostly for learning. I am curious about the "game compilation" mechanics used in various engines like Game Maker. In fact, I only mentioned Game Maker in my last post as an example of such mechanic - in the whole rest of this thread Game Maker is never mentioned.
    Let just say it this way Visual Basic is not the right tool to create game or game engine,and if visual basic is your first programming language...... forget it.

  11. #11
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Developing a game engine

    Quote Originally Posted by mitko29 View Post
    Let just say it this way Visual Basic is not the right tool to create game or game engine,and if visual basic is your first programming language...... forget it.
    Whats up with the discouraging posts? Everything is possible.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  12. #12
    Addicted Member
    Join Date
    Mar 2010
    Posts
    231

    Re: Developing a game engine

    Quote Originally Posted by Atheist View Post
    Whats up with the discouraging posts? Everything is possible.
    I am not saying that is not possible , just the visual basic is not the right tool for this enterprise.

  13. #13
    College Grad!!! Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,339

    Re: Developing a game engine

    It is a good tool if he were to use a nice graphical library such as DirectX or XNA. I was able to make some pretty hefty games with zero slowdown using VB6 and VB.Net.

  14. #14

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Developing a game engine

    Quote Originally Posted by mitko29 View Post
    I am not saying that is not possible , just the visual basic is not the right tool for this enterprise.
    Perhaps, or perhaps not. Whatever the case, I did make clear this was mostly for learning purposes, and we are certainly going off-topic. It was my intention to understand how this kind of compiling mechanic works (particularly in game engines) - simple as that.

    Also, this is a VB.NET forum with a "Games and Graphics" category with decent activity and abundant topics within. It is plain obvious I can make games with VB.NET just fine - perhaps with more hassle than other choices, but not so dramatically.

  15. #15
    Hyperactive Member BillGeek's Avatar
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    440

    Re: Developing a game engine

    I am curious: Are you new to the .NET Framework or new to VB.NET only? I know you mentioned you are using VB.NET, though there is a way to compile an application from source in a C# application... Certainly worth mentioning?

    You actually make use of the C# Code Compiler to do this, and I have a project running in an enterprise environment that makes use of this... Try the following example. Note though that I do not feel the need to comment what anything does. It is pretty straight forward if you follow the documentation on the CodeDom and CSharp assemblies in MSDN.

    I know it's not quite what you were looking for, but I'm sure with a bit of logic in your "game maker" app you can actually generate the appropriate C# source file and run it through this compiler?
    Code:
    using System.IO;
    using System.Reflection;
    using System.CodeDom;
    using System.CodeDom.Compiler;
    using Microsoft.CSharp;
    
    static void CompileSomething()
    {
        string SourceCode = new StreamReader("c:\\test.cs").ReadToEnd();
        CSharpCodeProvider prov = new CSharpCodeProvider();
        CompilerParameters compParam = new CompilerParameters();
    
        compParam.ReferencedAssemblies.Add("System.dll");
        compParam.ReferencedAssemblies.Add("System.Windows.Forms.dll");
    
        compParam.TreatWarningsAsErrors = false;
        compParam.GenerateExecutable = true;
        compParam.GenerateInMemory = false;
        compParam.OutputAssembly = "C:\\temp\\test.exe";
    
        CompilerResults result = prov.CompileAssemblyFromSource(compParam, SourceCode);
    }
    The content of the "test.cs" file is basically just copied and pasted from a Windows Forms application, but to be complete, here it is anyway:
    Code:
    using System;
    using System.Windows.Forms;
    
    namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
        }
    }
    
    namespace WindowsApplication1
    {
        partial class Form1
        {
            private System.ComponentModel.IContainer components = null;
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                    components.Dispose();
    
                base.Dispose(disposing);
            }
    
            private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.Text = "Form1";
            }
        }
    }
    
    namespace WindowsApplication1
    {
        static class Program
        {
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }
    }

  16. #16
    New Member
    Join Date
    Feb 2012
    Posts
    1

    Re: Developing a game engine

    Hi my recomendation is to denvelop the game engine into a
    an access or mySql database... I did something like that for wc3 Dota
    an items searcher very similar to the warcraft's game layout

    but for graphics you can use XNA FrameWork and Directx Api

    when you use slq statement, you can access it from very diferents language...
    C++ vb.net php and from any Operative System

  17. #17
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Developing a game engine

    So... before you worry about the compilation problems... do you even have the basic code needed to create sprites yet? Having it compile into a single EXE is about step 953 on a project like this... I'm just curious if you're even at step 23 yet. If not, you really need to start smaller and simpler.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  18. #18
    Lively Member
    Join Date
    Aug 2008
    Location
    Denmark
    Posts
    85

    Re: Developing a game engine

    Its good advice Jenner, but.. on topic I would imagine there are two ways to go
    A) Compile .net as BillGeek suggests. Then you link the .net code with the game libs you need.
    B) Script your game engine. Merge and compact scripts into a dat file the your Game engine exe loads and excutes. Wintermute is a great example which combines both editors and scripting and compile it into a standard game runner + a data package.

  19. #19
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Developing a game engine

    Exactly, I've seen both methods.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  20. #20

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Developing a game engine

    @BillGeek: thanks! I will take a look at that and report later.

    Quote Originally Posted by Jenner View Post
    So... before you worry about the compilation problems... do you even have the basic code needed to create sprites yet? Having it compile into a single EXE is about step 953 on a project like this... I'm just curious if you're even at step 23 yet. If not, you really need to start smaller and simpler.
    Yes, I already have. As I said, it is a rather simple project - a very basic game engine. Otherwise I wouldn't be asking this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width