skriker

AnimeWorld
(3D Game Using DirectX 9 and C#)

författare - malyfred / 15. 12. 2004

AnimeWorld (school project) is small and VERY SIMPLE example of using C# and DirectX. I am a complete beginner on this field and I had to fight quite a lot with STUPID MSDN to finish this program. DirectX is badly documented piece of …… at the moment and most of examples that can be found on internet don't work as you need so I have decided to offer this example to other newbies.

It's 3D game (something like Half Life 2 or Doom 3:o) where you collect items and shoot at everything that moves.

Here are some screenshots:

Controls

  • W, S, A, D – moving
  • Mouse – look around
  • E – open hidden doors
  • U – reverse up/down mouse move
  • Mouse button – shooting
  • T – telescope
  • L – turn on/off the lights
  • F – change texture mipmaps
  • I – change skin
  • F1 – fullscreen
  • F2 – back to window
  • Esc – quit

Map

You can create your own map! It's located in /data/bludiste.txt. In the first line of this plain text file is specified size of your map. You can use these symbols:

  • space – space:o)
  • '*' + 'a'…'n' – walls
  • 'S' – starting position (MUST BE!)
  • 'A'…'G' – hidden doors
  • 'H'…'N' – walls
  • 'O'…'R' – targets
  • 'T'…'Z' – collectable item
  • '#' – not collectable item

Installation

You need DirectX (I think 9.0 or higher is necessary, but I have not tested lower versions.)
You need .Net Framework 1.1 (or higher?)
When you have DirectX and .Net installed you can try to run the AnimeWorld.exe but it probably doesn't work – you have to install the Managed DirectX. It means that you have to run mdxredist.msi from ManagedDX.CAB. This .cab file is in the directory where you have unpacked DirectX at the beginning of installation.

That's all – enjoy the game:o)

Source Code

Of course the example is good for nothing when you cannot see souce code – everything is located in src directory. (MS Visual Studio project and all source files) I am REALLY sorry for some czech words and error messages, but I am not going to fix it. This project is partly based on D3DUT framework that is being developed at University of West Bohemia. D3DUT should allow you in near future to move your DirectX projects to Linux and OpenGL…huh:o) But don't worry – I have used just some functions from this framework (fullscreen…).

Last Word

In the left upper corner: FPS, collected items/remaining items, hit targets/remaining targets, time from start in miliseconds – it stops when you have got all items and targets. Don't forget to turn on your speakers and look at your belly!

Download

AnimeWorld.zip – 596kB

Kommentarer

  1. Lemon 16. 3. 2005 / 14.48

    Nice.

  2. Hamid 24. 5. 2005 / 6.16

    Tank a lot
    I download this file for work with direct & c#
    if u Have any program i will happy recive that!
    with best wishes
    Hamid From C# World

  3. Euqil 10. 8. 2005 / 8.18

    Fakt super / pretty sweet !!!!
    Dikes za zdrojaky :) / Thx 4 src !

  4. abbas 28. 10. 2005 / 17.56

    hi dear.
    i’m c# programmer.
    i want to build c# application in directx technology.
    i want to use directx to show database list.
    my application is medical software and in all forms i use database.
    help me please .
    C# is good for build ir?

  5. malyfred 29. 10. 2005 / 13.23

    abbas> Are you sure that you want to use DirectX for database list? Do you have any special reason to do that?

  6. dotJEM 31. 10. 2005 / 21.09

    Hey…

    Ofc. the sample does not work for me (Dohh, nice gues)…
    But hey not the matter… im alreaddy deep in the DirectX and OpenGL world (Mostly OpenGL)… so i thougt i would share something with u if it was unknown…

    But check out GameDev.net, this is a really good resource for help on most things conserning game development… (DirectX, OpenGL, Game Physics, Game Math, Networking for games ect. ect. ect.)…

    (Note that theres aparently some problems with the site ATM, so be patient and try again)…

    And happy hunting… ^^

  7. le quang song 14. 1. 2006 / 14.21

    My name Song.I’m very glad when have a game to learn.But when I run it why it could’t run .A error is
    ”Soubor ’bludiste.txt’, obsahující mapu, není k nalezení.
    Press any key to continue”
    Please help me repair this error.
    I am student at VietNam.I am doing project at school about 3D Game about C# and DirectX.Can you for me some of game3D to consult ,learn and finish my project.
    Please send your idea by my mail.
    Thanks a lot for your help.

  8. malyfred 14. 1. 2006 / 14.44

    le quang song:: As I said I am sorry for czech messages but I’m not gona to fix it.

    Anyway – it says that the file ”bludiste.txt” is missing. You need that file because the map of the world is defined inside.

    Just check if you have unpacked the archive properly. The directory ”data” mus be in the same place as the .exe file.

  9. Samer W Al Qutob 1. 4. 2006 / 19.01

    Hi

    I’ve been working with C# for a while and now I would like to learn 3D programming using DirectX. I am looking for tutorials and examples when I found this page.
    Could you please point me to some good DirectX using C# Tutorials.

    Thank You

  10. Umut Uğrak 8. 4. 2006 / 11.02

    Hi.Im new to programming.Im learning c# and directx 9 and ı want to make a simulation for my school project.İn this project ,think that there is three floors and you can walk look with mouse and do the basic things in a fps game.there will be only collision.ı mean it will be a easy engine.which sites you suggest to me.can ı do this kind of engine in the animeengines method.can you give me some examples.
    sorry for my bad english
    really sorry:)but your english is bad too:)thank you

  11. malyfred 8. 4. 2006 / 21.05

    Umut Uğrak:: Well, the Animeworld is that simple that collisions are solved only in 2D but the main file could be useful for you to lear how to do the basic things in DirectX.

    That’s the main reason why I’ve decided put it on the web. There are not very many simple but useful examples about basics of DirectX in C#.

  12. Nizami 15. 6. 2006 / 21.06

    It’s good and plz help me more in creating games using C#

  13. Umut Uğrak 27. 6. 2006 / 23.50

    I want to ask what is D3DUT?What it does usual?Can you tell me a little?thanks

  14. Fareed Nizami 9. 7. 2006 / 9.51

    hey,
    you did marvelous work pal,
    it must be very important for beginers
    Regards

  15. nadir 3. 8. 2006 / 15.28

    i am very pleased to have a this kind of software ,i am actually a student of master in computer science,and i have a project of 3d game programming in microsoft c# plateform.i need more help regarding to this ,i will be thank full.

  16. Snake 13. 2. 2007 / 9.26

    hey
    firstly let me say nice work.
    i have been looking on the net for a sample for some time now.

  17. Dina 10. 6. 2007 / 18.05

    hi dear,
    i am a c# programmer and i want to be agame development using DirectX
    can you help me to start my long way?
    and how to start?

    and what is your device for me?

  18. MalkEvange 6. 8. 2007 / 21.36

    Interesting article!
    Where can I find more on this theme?

  19. XRage 1. 10. 2007 / 15.41

    Thanks buddy. Good job.

  20. sash 30. 10. 2007 / 19.08

    Hi

    I have VS2005, i can run the exe fine but when I compile i get 14errors??? heeeeelp :-(

    Error 4 The best overloaded method match for ’Microsoft.DirectX.Direct3D.Device.Device(int, Microsoft.DirectX.Direct3D.DeviceType, System.Windows.Forms.Control, Microsoft.DirectX.Direct3D.CreateFlags, Microsoft.DirectX.Direct3D.PresentParameters)’ has some invalid arguments D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 135 16 D3DUT
    Error 5 Argument ’5’: cannot convert from ’Microsoft.DirectX.Direct3D.PresentParameters[]’ to ’Microsoft.DirectX.Direct3D.PresentParameters’ D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 135 96 D3DUT
    Error 6 The best overloaded method match for ’Microsoft.DirectX.Direct3D.Device.Reset(Microsoft.DirectX.Direct3D.PresentParameters)’ has some invalid arguments D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 171 7 D3DUT
    Error 7 Argument ’1’: cannot convert from ’Microsoft.DirectX.Direct3D.PresentParameters[]’ to ’Microsoft.DirectX.Direct3D.PresentParameters’ D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 171 20 D3DUT
    Error 8 The best overloaded method match for ’Microsoft.DirectX.Direct3D.Device.Reset(Microsoft.DirectX.Direct3D.PresentParameters)’ has some invalid arguments D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 192 7 D3DUT
    Error 9 Argument ’1’: cannot convert from ’Microsoft.DirectX.Direct3D.PresentParameters[]’ to ’Microsoft.DirectX.Direct3D.PresentParameters’ D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 192 20 D3DUT
    Error 10 The best overloaded method match for ’Microsoft.DirectX.Direct3D.Device.Reset(Microsoft.DirectX.Direct3D.PresentParameters)’ has some invalid arguments D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 252 7 D3DUT
    Error 11 Argument ’1’: cannot convert from ’Microsoft.DirectX.Direct3D.PresentParameters[]’ to ’Microsoft.DirectX.Direct3D.PresentParameters’ D:\DirectX Samples\AnimeWorld\AnimeWorld\src\Runtime.cs 252 20 D3DUT
    Error 12 The name ’SpriteFlags’ does not exist in the current context D:\DirectX Samples\AnimeWorld\AnimeWorld\src\AnimeWorld.cs 356 20 D3DUT
    Error 13 ’Microsoft.DirectX.Direct3D.Sprite’ does not contain a definition for ’Draw2D’ D:\DirectX Samples\AnimeWorld\AnimeWorld\src\AnimeWorld.cs 365 14 D3DUT
    Error 14 The name ’SpriteFlags’ does not exist in the current context D:\DirectX Samples\AnimeWorld\AnimeWorld\src\AnimeWorld.cs 369 20 D3DUT
    Error 15 ’Microsoft.DirectX.Direct3D.Sprite’ does not contain a definition for ’Draw2D’ D:\DirectX Samples\AnimeWorld\AnimeWorld\src\AnimeWorld.cs 373 14 D3DUT
    Error 16 The name ’SpriteFlags’ does not exist in the current context D:\DirectX Samples\AnimeWorld\AnimeWorld\src\AnimeWorld.cs 378 19 D3DUT
    Error 17 No overload for method ’DrawText’ takes ’5’ arguments D:\DirectX Samples\AnimeWorld\AnimeWorld\src\AnimeWorld.cs 386 4 D3DUT

  21. malyfred 30. 10. 2007 / 19.41

    This code is old… very old. It’s written under .NET1.1 and it probably cannot be compiled with .NET2.0 or higher (.NET3.5 is the latest version I’m aware of). The other problem could be the incompatibility of DirectX.

  22. samaq 8. 11. 2007 / 9.54

    I have trouble when i begin with directx. This help me alot. Thank.

  23. jorgerosa 1. 4. 2008 / 21.36

    Thanks malyfred.
    Any C# OpenGL examples around?

  24. david 28. 6. 2008 / 21.21

    Thanks
    Good job.

  25. M. Gokhan BAKAL 12. 10. 2008 / 13.13

    before thank you for this application and web site. Which is Directx 9.0 SDK download but small time and not price? I will wait your answers. Thank you for all….

  26. Nescius 12. 10. 2008 / 18.49

    http://eisenstern.com/ http://sauerbraten.org/ and http://cubeengine.com/ are specially designed for easy map creation, they are both opensource and dont need directx, just opengl and some C – cool easy and ported to everything!

  27. asMe 16. 12. 2008 / 22.16

    hey! thats really nice ,i also new in this field ,Do you have any idea of how to load an animated mesh/.x model in C# using DirectX9.?

    Please help me ,i m done with static one ,but this animated mesh is creating problem.

  28. asMe 22. 12. 2008 / 18.03

    Hey there! i am trying to run this code , But its giving some errors like thiss

    -The type or namespace name ’MouseButton’ could not be found (are you missing a using directive or an assembly reference?)C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Check\Check\MouseEventArgs.cs 75 41 D3DUT
    -The type or namespace name ’Key’ could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Check\Check\KeyEventArgs.cs 14 13 D3DUT
    -The type or namespace name ’Key’ could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Check\Check\KeyEventArgs.cs 34 12 D3DUT
    -’ZCU.Graphics.D3DUT.KeyEventArgs.Key’ is a ’property’ but is used like a ’type’ C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Check\Check\KeyEventArgs.cs 43 61 D3DUT

    Can please tellme from where i can get this D3DUT library..So i can run this code.. as you have added reference of D3Dut.So please help me out.

  29. عباس 11. 2. 2009 / 9.40

    هستمC# Programmer سلام بچه ها منم مثل شما
    با DirectX9 نيزآشنا هستم

  30. reader 13. 8. 2009 / 10.53

    I didn’t have ne problems compiling or even playing this game. Nice work. But It would be nice to have a bit more in-depth explanation of whats happening in the code.

  31. Saeed 2. 9. 2009 / 23.43

    Hi
    Tnx 4 src
    i have a problem in my character movment
    can u help me?
    plz mail me if you can
    its got a tiny time of yours
    Tnx again

  32. Saeed 3. 9. 2009 / 5.00

    my mail is saeed_masoumi_1987@yahoo.com

  33. sadegh 26. 3. 2010 / 13.33

    saLLam saeed jan
    haLet khobe
    saLe jadid ro behet tabriiK migam
    ye zahmat vasat daram
    man mikham to c# 3d benvisam
    yani mikham Shoro konam
    shoro be 3d neveshtan
    vaLi nemidoonam bayad az koja shoro konam
    age ketabi hast ya siti ke bedard bokhore
    mishe behem moarefi koni Lotfan
    az Lotfet mamnoon misham
    ghorbane u
    bazam eydo behet tabriik migam

  34. fereshteh 27. 4. 2010 / 12.19

    thanke you for this file.

  35. Dag 27. 6. 2010 / 19.49

    Thanx! This was really fun to play around with. Seems the game is unable to use more than one of my processors core… So one of them is working at 100% while the other doesn’t do shit.. Further was I not able to compile the source code in .NET 2.0.. but any way, nice to see that it is possible to create games in C#.

Beklagar, kommentarsfunktionen är inaktiverad för närvarande.

© 2004 - 2024 malyfred