Need more examples in .NET platform

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
the_rising

Need more examples in .NET platform

Post by the_rising »

hello everyone,

I have just started wroking with this 3D engine. The SDK of this engine contains only 2 examples in .NET platform which are not sufficient to understand how it works. Please suggest me some links or websites which contain more examples for .NET platform.

Regards,
WalterWzK
Posts: 72
Joined: Wed Jan 12, 2005 2:57 pm
Location: Netherlands
Contact:

Post by WalterWzK »

Here is an example from a fellow .NET developer :)

Create a module 'GameEngine' and use this code:

Code: Select all

Imports Irrlicht
Imports Irrlicht.Core
Imports Irrlicht.GUI
Imports Irrlicht.IO
Imports Irrlicht.Scene
Imports Irrlicht.Video

Module GameEngine

    'This can be fully adjustable, but has defaults
    Public engDriver As Irrlicht.Video.DriverType = Irrlicht.Video.DriverType.OPENGL
    Public engFullscreen As Boolean = True
    Public engScreenHeight As Integer = 1024
    Public engScreenWidth As Integer = 768
    Public engScreenColor As Integer = 32

    'Running-state boolean (Not nessesary)
    Public EngineRunning As Boolean

    Public Sub StartEngine()

        'Initialize engine
        Dim Engine As New Irrlicht.IrrlichtDevice(engDriver, New Irrlicht.Core.Dimension2D(engScreenWidth, engScreenHeight), engScreenColor, engFullscreen, True, True)

        'Dimension some other handy stuff
        Dim EngineGUI As GUI.IGUIEnvironment = Engine.GUIEnvironment
        Dim EngineScene As Scene.ISceneManager = Engine.SceneManager
        Dim EngineDriver As Irrlicht.Video.IVideoDriver = Engine.VideoDriver

        'Hide cursor?
        Engine.CursorControl.Visible = False

                'If you want to display 3D Objects add a cam:
                Dim Cam As Irrlicht.Scene.ICameraSceneNode = EngineScene.AddCameraSceneNode(Nothing, New Vector3D(0, 0, 50), New Vector3D(0, 0, 0), 0)

        'Let the poop hit the fan
        Engine.Run() : EngineRunning = True


        While Engine.WindowActive
            'Running Boolean set to False? Quit engine
            If EngineRunning = False Then Engine.CloseDevice()

            'Render the scene
            EngineDriver.BeginScene(True, True, New Video.Color(0, 0, 0, 0))
            EngineScene.DrawAll()

                'A simple text to test if its working:
                EngineGUI.BuiltInFont.Draw("MY GAME ROCKS!" & Application.ProductVersion, New Core.Position2D(10, Engine.VideoDriver.ScreenSize.Height - 30), New Video.Color(0, 100, 100, 100))

                'Wanna have a custom Cursor ? (BMP 32x32)
                Dim CursorPos As Position2D = Engine.CursorControl.Position
                Dim CursorTex As Video.ITexture = EngineDriver.GetTexture(Application.StartupPath & "\cursor.bmp")
                EngineDriver.MakeColorKeyTexture(CursorTex, New Position2D(31, 31))
                EngineDriver.Draw2DImage(CursorTex, New Position2D(CursorPos.X, CursorPos.Y), New Rect(0, 0, 32, 32), New Color(255, 255, 255, 255), True)

            'Scene rendered, so stop and begin from the start again (Frames)
            EngineDriver.EndScene()
        End While

        'Engine is stopped, boolean was false for example
        msgbox("Engine stopped!")

    End Sub

End Module
Now just configure that this module starts when the application does ( Dont forget to rename the sub to Main() ) OR just add a form at wich a button has the code:

Code: Select all

GameEngine.StartEngine()
A handy tip is to add some settings related to initializing the engine on the form aswel, like the fullscreen boolean and resolution for example. Just remove the defaults like this:

Code: Select all

    Public engDriver As Irrlicht.Video.DriverType
    Public engFullscreen As Boolean
    Public engScreenHeight As Integer
    Public engScreenWidth As Integer
Public engScreenColor As Integer
And add some controls to the form:
- Control: 'Button', Name: 'btnStartEngine'
- Control: 'Button', Name: 'btnExitApplication'
- Control: 'Radio button', Name: 'rbn32'
- Control: 'Radio button', Name: 'rbn16'
- Control: 'Checkbox', Name: 'chkFullscreen'
- Control: 'Combobox', Name: 'cmbRender'
with this list:
- "OpenGL Renderer"
- "DirectX 9.0c Renderer"
- "DirectX 8.0 Renderer"
- "Software Renderer"

Now add this code to the 'start engine' button:

Code: Select all

 Private Sub btnStartEngine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        '-------------Fullscreen---------------
        If chkFullscreen.Checked = True Then
            GameEngine.engFullscreen = True
        Else
            GameEngine.engFullscreen = False
        End If
        '-------------Colors------------------
        If rbn32.Checked = True Then
            GameEngine.engScreenColor = 32
        Else
            GameEngine.engScreenColor = 16
        End If
        '-------------Render-----------------
        Select Case cmbRender.Text
            Case "OpenGL Renderer"
                GameEngine.engDriver = Irrlicht.Video.DriverType.OPENGL
            Case "DirectX 9.0c Renderer"
                GameEngine.engDriver = Irrlicht.Video.DriverType.DIRECTX9
            Case "DirectX 8.0 Renderer"
                GameEngine.engDriver = Irrlicht.Video.DriverType.DIRECTX8
            Case "Software Renderer"
                GameEngine.engDriver = Irrlicht.Video.DriverType.SOFTWARE
        End Select
        '-------------Resolution-----------------
        'This is hard-coded but you can make a nice combobox too
        GameEngine.engScreenHeight = 768
        GameEngine.engScreenWidth = 1024

        'Start the engine
        GameEngine.StartEngine()
    End Sub
Good luck mate!
Current Project: Don Salvatore's Mafia
Genre: 3D Shooter \ RTS
Programming Language: VB .NET
Engine: Irrlicht 11 [.NET Wrapper]
JonasB

Post by JonasB »

That's because there's not much you can do with the .NET version yet;)

What I understand from looking at the docs and reading forum posts, the .NET interfaces are missing an awful lot of functionality.

You can play around with some of its features, but that's about it.

Elric has made some important additions to the wrappers, but much much more needs to be done before the full Irrlicht API is accessible.
WalterWzK
Posts: 72
Joined: Wed Jan 12, 2005 2:57 pm
Location: Netherlands
Contact:

Post by WalterWzK »

JonasB wrote:That's because there's not much you can do with the .NET version yet;)
Exactly, but for every problem is a solution. Since im working with the wrapper from the beginning im pretty familiar with it and im able to create some neat stuff even with a lack of functions. For example my game 'Don Salvatore's Mafia'
Current Project: Don Salvatore's Mafia
Genre: 3D Shooter \ RTS
Programming Language: VB .NET
Engine: Irrlicht 11 [.NET Wrapper]
JonasB

Post by JonasB »

You got a link?

BTW, as far as I can see, it should be pretty easy to implement the full API - it's just that it's tedious work.
There doesn't seem to be any collective effort from the .NET crowd here to put in those hours, but I can understand that if an official update is expected soon.

...is there?
WalterWzK
Posts: 72
Joined: Wed Jan 12, 2005 2:57 pm
Location: Netherlands
Contact:

Post by WalterWzK »

Well I would love to enhance the current Wrapper with new functionality but my C++ knowledge is basic and When i tried to compile the source of the version 10 engine i got many errors wich i dont understand. Maybe its because i used the 'C++ 2005 Express' IDE to compile, but when i read the bug-threads it came to my attention the version 10 source is buggy and more people cant compile it..

Don Salvatore's Mafia is not yet publicly available since its in it BÉTA-Stage and needs to be completly trashed and tested by our Exclusive-IT Game-A-Holics so that we can repgrogram the last bits (and bytes :)). Although im sure our team posts some shots on the forum soon! Thanks for the interest!
Current Project: Don Salvatore's Mafia
Genre: 3D Shooter \ RTS
Programming Language: VB .NET
Engine: Irrlicht 11 [.NET Wrapper]
JonasB

Post by JonasB »

Aha... it's not so fun to write wrappers if you suspect that the source is going to change (because of the bugs). I hope the .NET development takes off when the next version is published.
Mafia: Well, screenshots are nice, but that's mostly the art department showing off;) What I'm really interested to hear about is more techy; what parts of the engine you're using, and if you've made any workarounds/hacks that could be useful to know about.
Sethy

another question.....

Post by Sethy »

Thanks WalterWzK for sharing your code! I very appreciate it!

So, how I understand, I can use all the feaures of irrlicht with vb.net? and what function work e what not work? like for my project I just need basics things like collision detection, some visual effects on object like trasparency and multitextring, ray collision with the objects with the mouse maybe pixel and vertex shader, becouse I want to create a glow effect around the objects with HLSL language.

Now I making a choice about 3d engine. In the list there is Nemo3d for vb6 very good with a lot of features, iRender for vb6 and net good and support also md5 and irrlicht. I really want to use irrlicht also becouse I know that this engine will be always update with the new rendering tecnologies. Anyway using vb.net I have hard time also with the API, becouse in vb.net I have to change the declaration of it. ( I love API!!!!) Anyway I am still look around.

p.s. I add a skybox object and I want to change the textures in executing so, I write this:
----------------------------------------------------------------------------------
' load some textures
Dim texUp As ITexture = device.VideoDriver.GetTexture("..\..\..\media\irrlicht2_up.jpg")
Dim texBk As ITexture = device.VideoDriver.GetTexture("..\..\..\media\irrlicht2_bk.jpg")
Dim texDw As ITexture = device.VideoDriver.GetTexture("..\..\..\media\irrlicht2_dn.jpg")
Dim texFt As ITexture = device.VideoDriver.GetTexture("..\..\..\media\irrlicht2_ft.jpg")
Dim texRg As ITexture = device.VideoDriver.GetTexture("..\..\..\media\irrlicht2_rt.jpg")
Dim texLf As ITexture = device.VideoDriver.GetTexture("..\..\..\media\irrlicht2_lf.jpg")
----------------------------------------------------------------------------------

and this line to apply the textures to skybox:
----------------------------------------------------------------------------------
device.SceneManager.AddSkyBoxSceneNode(texUp, texDw, texLf, texRg, texFt, texBk, Nothing, -1)
----------------------------------------------------------------------------------
but if I want to change texture I should load the new texture in the same variable (for example "texUp") and after I heve to rewrite the line:
"device.SceneManager.AddSkyBoxSceneNode(texUp, texDw, texLf, texRg, texFt, texBk, Nothing, -1)"
my question is, this line will substitute the textures or add new one? becouse I don't want to make busy the memory.

Thank again
Sethy
WalterWzK
Posts: 72
Joined: Wed Jan 12, 2005 2:57 pm
Location: Netherlands
Contact:

Post by WalterWzK »

@JonasB: True, developing the same piece of code is frustrating, know all about it haha..

@Sethy: NO, the wrapper only supports a few pieces of the actual engine.. its very incomplete yet.

P.s.: I've noticed more problems like that, while initialising its all good but when you want to change at runtime it fails. Maybe thats one of the missing part :(
Current Project: Don Salvatore's Mafia
Genre: 3D Shooter \ RTS
Programming Language: VB .NET
Engine: Irrlicht 11 [.NET Wrapper]
Post Reply