dcsimg
Page 1 of 2 12 LastLast
Results 1 to 40 of 43
  1. #1

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Demon Arena [Updated April 18th, 2015]



    This is actually a re-writing of a VB6 screen saver I created years ago. You can download the source for that one here. I no longer use VB6 so that one is pretty much stagnant. I've chosen to re-write it VB.Net rather than try to wrangle with that one.

    Simply run the application and click any of the three menu items to add creatures to the Form. The creatures would then engage each other in projectile fights to the death until creatures of only one type remain.

    For now there are only three different creatures but I'll be adding more over time. I'll also be adding new effects, and abilities for the creatures and eventually, sound, just like the VB6 version.

    Additional credit
    • The community members of ZDoom.org for the creation of those sprites.
    • ID Software for the creation of Doom which ZDoom is based on.


    DemonArenaV1.0.0.0 Source.

    Note: You need VS2010 or later to open.

    Update: Version 2.0.0.0

    • Added three new monsters.
    • Added glow effects to projectiles.
    • Added explosive projectiles, explosive physics and area of effect damage.
    • Added multiple attack types to certain monsters. The Creature base class now allows to define multiple attack types for derived monsters.
    • Moved the arena from the Form to a control. Inherits from Control and implements IArena.
    • Added a teleport fog which appears when new monsters are spawned.
    • Added explosion animation when explosive projectiles explode.
    • Added an Anomaly base class for creating simple entities. The teleport fog and explosion inherit from this class.

    Additional credit
    • Jemidiah for helping me with the math that powers some parts of the engine.


    I'll leave the original version up as well since its much simpler in comparison to this one.

    DemonArenaV2.0.0.0 Source.

    Update: Version 2.1.0.0
    • Added two new monsters.
    • Minor code changes.


    Note: This is the last version that can work without XNA.

    DemonArenaV2.1.0.0 Source.

    Update: Version 3.0.0.0
    • Added two new monsters.
    • Added a high performance XNA renderer. It will no longer slow down when there are too many entities in the arena.
    • Added dash defense for some creatures. Implemented in the Creature base class so every creature has the potential to use it.
    • Added dash blur for creatures that are dashing.
    • Added random spawning. This is configurable. You may configure ratios for how much of a particular creature will spawn as well as a duration between spawns.
    • Added NonAnimatedEntity base class which can be used to create entities that have no animation frames. The dash blur is implemented via that class.
    • Both NonAnimatedEntity and Anomaly based entities can fade out. The teleport fog now fades out.


    Additional credit
    • dday9 who's XNA scroll demo showed me how to use XNA to render to a Control as well as how to convert GDI+'s Bitmap to a Texture2D.


    IMPORTANT
    This version utilizes XNA 4.0 so in order to be able to run this in the IDE you would need to install XNA. If you're using Visual Studio 2010 then I recommend you install the XNA Game Studio 4.0. This may not work with Visual Studio versions other than 10. If you're using a later edition of Visual Studio then I recommend installing the Microsoft XNA Framework Redistributable 4.0.

    The redistributable will provide the components but for some reason when you start new projects, the IDE doesn't list the assemblies if you're trying to add references to them in a new project so you cannot develop new XNA applications with just the redistributable. You would need the whole Game Studio package.

    DemonArenaV3.0.0.0 Source.

    Update: Version 4.0.0.0
    • Added a new monster.
    • Monsters now implement the IDemon interface.
    • Added ComplexCreature base class which allows use to define creatures with a great degree of flexibility with respect to their behavior. The Afrits and the DarkCardinal creatures are defined using this base class now.
    • Added the ability to resize the arena on the fly using the "+" or "-" key.


    Note: Some things may be broken in this version. The random spawner hasn't been rewritten to consider ComplexCreature derived monsters so it may not spawn the new monster and the reworked Afrits or it may throw exceptions. It remains untested.

    DemonArenaV4.0.0.0 Source.

    Update: Version 4.1.0.0
    • Added a new monster.
    • Random Spawner now works with ComplexCreature based monsters.
    • Minor code changes such as the addition of a couple ECMD(Entity command) procedures to the ComplexCreature base class in order to facilitate melee type attacks.


    DemonArenaV4.1.0.0 Source.

    Update: Version 5.0.0.0
    • Added two new monsters.
    • All sprites are now rendered with their original aspect ratio.
    • Implemented new entity commands and functions for use in creature definitions.
    • Fixed bug where Lost Souls would repeat their dying frames without dying when caught at the edge of the arena.
    • Implemented global variables for use in creature definitions. It will allow more complex behaviors to be defined. For example, Spirits now swarm a single target at a time.
    • Made a few stat changes to some creatures.
    • Iron Lich, Wizard and Spirit creatures now inherit from the ComplexCreature class.
    • Fixed bug where the application crashes when run on a PC where the graphics hardware is low end.


    DemonArenaV5.0.0.0 Source.

    Update: Version 6.0.0.0
    • Added a ChangeLog text file to the DemonArena project. It would allow me to log changes as I make them. That's why this log is so much more detailed.
    • Increased Dark Cardinal's rocket damage.
    • Added some comments to code in the Arena class.
    • Minor code changes: Altered the EntityCollection class and how its used within the Arena class.
    • Minor code changes: Made collision detection slightly more efficient.
    • Minor code changes: Made XNA renderer slightly more efficient by caching Texture2D objects to Sprite objects instead of doing look-ups based on string keys.
    • Fixed bug where the XNA renderer would crash when the GraphicsDevice was lost. Changing the resolution while the app was running was one such way to cause the crash.
    • Decreased time ArachNorb's takes from preparing an attack to the actual attack.
    • Fixed bug in loop implementations of creature defininition execution where the loop would go one extra iteration.
    • Random spawner's maximum number of spawns per creature changed from 20 to 100.
    • Made PurpleAfrit more formidable. It attacks more frequently, it stays longer in its dashing attack and it selects a new target if it still has dash time instead of stopping. It also has a greater chance of executing the dash attack.
    • GetSprite now performs dictionary look-ups instead of a linear scan when retrieving sprites to render. However, linear look-ups are performed when sprites are requested for the first time.
    • Creature's definition execution engine can now execute multiple states concurrently. This makes more complex creature behavior possible. This is the most significant change of this version.
    • Added entity commands for changing creature alpha value.
    • Entity commands in creature definitions are now executed through the Action class rather than the Delegate class. It would improve performance of the definition execution engine as Invoke is much faster than DynamicInvoke.
    • The Wraith now inherits from the ComplexCreature class. It also uses the new capability of the definition execution engine to execute states in parallel in order to implement its new special ability.
    • Some DefinitionExpression derived classes now implement fields instead of properties since accessing fields are faster. The RenderInfo class also use fields instead now.
    • XNADrawImage now passes Rectangles by reference instead of by value.
    • Removed LINQ filtering when cycling entities in RefreshXNA.
    • Made the selection of targets by creatures more efficient by not recreating a list of potential targets every time a call is made to select a target.
    • The Size property of the ComplexCreature, Creature and Projectile classes were made more efficient by moving scaling calculations out of the property. Scaling is now done only when the entity's sprite has been changed and the value cached to a private field.
    • Changed SpriteBatch sorting mode from Immediate to Deferred. Deferred according to various online sources is supposed to be more efficient in XNA 4.0.

    DemonArenaV6.0.0.0 Source
    Last edited by Niya; Apr 19th, 2015 at 05:33 PM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  2. #2
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Demon Arena.

    Hi,
    I noticed you had a thread about this getting slow, just as a suggestion, look into DoubleBuffering. of the form and your custom arena: http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx

    it has always helped me smooth out things, although I have only ever used it on forms and flowlayoutpanels
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  3. #3

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena.

    Quote Originally Posted by bensonsearch View Post
    Hi,
    I noticed you had a thread about this getting slow, just as a suggestion, look into DoubleBuffering. of the form and your custom arena: http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx

    it has always helped me smooth out things, although I have only ever used it on forms and flowlayoutpanels
    The one currently there doesn't suffer. I've since added glows effects to it and GDI+ is beginning to buckle under the strain of having to do too many blend operations. It has nothing to do with double buffering at all. GDI+ is not hardware accelerated so you're going to take a severe performance hit when you start blending hundreds of images on a surface.

    I've since mitigated the performance hit by cutting the number of times blit operations have to be performed to render glowing projectiles in half. But there are a few other effects I plan on putting into this and soon GDI+ won't be enough. Currently I'm thinking of switching to plain old GDI for blit operations since GDI is fully accelerated on Windows XP and blit operations(BitBlt, StretchBlt, AlphaBlend) are accelerated on Win7. I really want to avoid anything based on DirectX like XNA or SlimDX since that would require others to download dependencies to get this to work.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  4. #4
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Demon Arena.

    This goes way past my experience or even remote knowledge, GDI and the like is just beyond me, never needed them but wished I could make something (always wanted to make a doom like game, soooo beyond me). all the "animation" I have in my programs is things like sliding or a custom button that shrinks then expands back when pressed. both basic and not very complex, just images and timers lol

    I will keep an eye on this though as it was at least fun to watch them jump around the screen ps do they actually kill each other? it looks like they do
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  5. #5

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena.

    Quote Originally Posted by bensonsearch View Post
    ps do they actually kill each other? it looks like they do
    Yes they do, via their projectiles. The projectiles of one type damages monsters of a different type.

    Quote Originally Posted by bensonsearch View Post
    This goes way past my experience or even remote knowledge, GDI and the like is just beyond me, never needed them...
    You have to know GDI in order to make custom drawn controls in VB6 which is how I learned it.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  6. #6
    Addicted Member evo74's Avatar
    Join Date
    Aug 2012
    Location
    Mars
    Posts
    133

    Re: Demon Arena.

    I tryed to open the sorce in visual studio 13/windows 8.1 and visual studio crahes just as it opens the source, no error....
    Time you enjoy wasting is not wasted time

  7. #7

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena.

    Quote Originally Posted by evo74 View Post
    I tryed to open the sorce in visual studio 13/windows 8.1 and visual studio crahes just as it opens the source, no error....
    Is it possible you can try it using either VS2010 on Win8.1 or VS2013 on Win7. I use Win7+VS2010 so one of these differences is causing problems. I have neither Win8 or VS2013 to test it myself.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  8. #8
    Member
    Join Date
    Mar 2014
    Posts
    53

    Re: Demon Arena.

    Cool! Good job on this, ima peek a little bit in the source code tommorrow haha.

    Maybe u actually should consider using directX, just compile to x86 and include DLL's in root folder of the
    Exe no need to download anything tested this on a few pc's. Not 100% sure.

  9. #9

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated 04/09/2014]

    Updated. See OP.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  10. #10

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated Apr 9th, 2014]

    Updated. See OP
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  11. #11

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated Apr 10th, 2014]

    Updated OP to include link to the VB6 version.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  12. #12

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated Apr 24th, 2014]

    Updated to version 3.0.0.0. See OP.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  13. #13
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Demon Arena [Updated Apr 24th, 2014]

    my goodness, you may as well start on an actual game now like doom i would so play that hehe, looking good!
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  14. #14

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated Apr 24th, 2014]

    Quote Originally Posted by bensonsearch View Post
    my goodness, you may as well start on an actual game now like doom i would so play that hehe, looking good!
    I've been trying to come up with an interesting way to turn this into a game but so far, I haven't been able to come up with anything solid. The simplest game would be a betting game where you place bets on which species would win if a select combination were placed in the arena. Another idea I have is to give you a set of creatures which you can put in the arena to fight for you and if they win, you get money which you can use to power them up by buying hit points or attack strength etc. I've have not really settled on the best way to make this into a game. Another idea is to give the player a unique entity which he can control via the mouse so he can fight in the arena with it. Its surprisingly difficult to come up with a good idea to "gameify" this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  15. #15
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Demon Arena [Updated Apr 24th, 2014]

    i like the idea that you can win money and spend it to boost things, im a fan of RPG type games. would need more background to it though like story and where do you go with it lol. hmmm
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  16. #16
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,342

    Re: Demon Arena [Updated Apr 24th, 2014]

    An issue that I have with the code(I haven't got to fully look at it yet...) is that it appears to use a timer for the game loop. You should really have a dedicated game loop, I personally use Threading so that it doesn't tie up the GUI thread:
    Code:
        Private game_thread As Threading.Thread
    
        Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            quit = True
        End Sub
    
        Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    
            game_thread = New Threading.Thread(AddressOf GameLoop)
            game_thread.Start()
    
        End Sub
    
        Private quit As Boolean = False
        Private Sub GameLoop()
    
            Dim s As New Stopwatch
            s.Start()
    
            'Update
            'Draw
            'Render
    
            'Loop
            While s.Elapsed <= TimeSpan.FromMilliseconds(16.6)
                Application.DoEvents()
            End While
    
            Console.WriteLine(s.ElapsedMilliseconds)
    
            s.Stop()
            If quit = False Then
                game_thread = New Threading.Thread(AddressOf GameLoop)
                game_thread.Start()
            End If
        End Sub
    The stopwatch is a high precision timing instrument if the computer will allow it to be one. Otherwise, if the computer cannot handle a high precision timer, then it defaults to the same accuracy as a regular Timer. Set the frames per second to 60(aka 16.6 milliseconds) if you live in the US or 50(aka 20 milliseconds) if you live in the UK. The reason for this is because the refresh rate for the monitors is 60 in the US and 50 in the UK.

  17. #17

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated Apr 24th, 2014]

    Updated to version 4.0.0.0. See OP
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  18. #18

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated Apr 24th, 2014]

    Quote Originally Posted by dday9 View Post
    An issue that I have with the code(I haven't got to fully look at it yet...) is that it appears to use a timer for the game loop. You should really have a dedicated game loop, I personally use Threading so that it doesn't tie up the GUI thread:
    Code:
        Private game_thread As Threading.Thread
    
        Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            quit = True
        End Sub
    
        Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    
            game_thread = New Threading.Thread(AddressOf GameLoop)
            game_thread.Start()
    
        End Sub
    
        Private quit As Boolean = False
        Private Sub GameLoop()
    
            Dim s As New Stopwatch
            s.Start()
    
            'Update
            'Draw
            'Render
    
            'Loop
            While s.Elapsed <= TimeSpan.FromMilliseconds(16.6)
                Application.DoEvents()
            End While
    
            Console.WriteLine(s.ElapsedMilliseconds)
    
            s.Stop()
            If quit = False Then
                game_thread = New Threading.Thread(AddressOf GameLoop)
                game_thread.Start()
            End If
        End Sub
    The stopwatch is a high precision timing instrument if the computer will allow it to be one. Otherwise, if the computer cannot handle a high precision timer, then it defaults to the same accuracy as a regular Timer. Set the frames per second to 60(aka 16.6 milliseconds) if you live in the US or 50(aka 20 milliseconds) if you live in the UK. The reason for this is because the refresh rate for the monitors is 60 in the US and 50 in the UK.
    Yes, I do use a single Timer for the game loop. It seems sufficient for now. Are you suggesting that I should actively seek to control the framerate ?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  19. #19
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,342

    Re: Demon Arena [Updated May 5th, 2014]

    Yes, most definitely.

  20. #20

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 5th, 2014]

    Yea, I've seen Jacob Roman talk about this a couple times. He always writes a LockFrameRate function for his games and such. But what I don't understand is why. It suggests that it's bad to let the game draw the frames as fast as it could which is essentially what I'm doing. I've thought about locking the frame rates but I haven't had a compelling reason to do so.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  21. #21
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,342

    Re: Demon Arena [Updated May 5th, 2014]

    What will wind up happening is something that compiles perfectly on your computer will glitch up(sometime really bad) on a slower computer. Locking in the frame rate will always provide consistent performance as one step will not go forward until at least X amount of frames has passed. Without a managed game loop you can expect to tearing graphics and if your application is very physics heavy, you can see the physics render after the drawing occurs which can eventually lead to a crash. And don't get me wrong, JR is a great game programmer, however there are a few things that I don't agree on with him... one thing is that he always loops on the GUI thread where as I always loop on a separate thread.

  22. #22

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 5th, 2014]

    Wait a minute, doesn't DirectX by default update the front buffer in sync with screen refreshes ? I've been reading up on locking in frame rates and its like you said, its used to avoid tearing but for some reason I've never gotten that glitch so I'm assuming that there must be some way to swap buffers faster than the refresh rate in DirectX which would explain why this can become an issue. I have to admit, there is still a lot about this that I still don't understand.

    As for game loops on a worker thread.....I've actually thought about it. I almost implemented that way but ultimately decided that I'd let every thing run on the UI thread since I'd have to invoke there anyway to render to the IArena control if the game loop was on another thread. However, I've recently done some testing with regards to performance when using multi-core systems. Heavy algorithms like collision detection would benefit tremendously on multicore systems if they were threaded.
    Last edited by Niya; May 6th, 2014 at 04:22 AM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  23. #23
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,346

    Re: Demon Arena [Updated May 5th, 2014]

    What are the other menu for next to the "Options" menu?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  24. #24

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 5th, 2014]

    Quote Originally Posted by Nightwalker83 View Post
    What are the other menu for next to the "Options" menu?
    They are dynamically generated based on the creature types defined in the assembly. Each one spawns a specific type of creature.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  25. #25

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Updated to version 4.1.0.0. See OP.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  26. #26
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Demon Arena [Updated May 7th, 2014]

    I have tried to run the latest version but get this error on startup
    Name:  Capture.jpg
Views: 621
Size:  25.6 KB
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  27. #27
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,342

    Re: Demon Arena [Updated May 7th, 2014]

    Quote Originally Posted by bensonsearch View Post
    I have tried to run the latest version but get this error on startup
    Name:  Capture.jpg
Views: 621
Size:  25.6 KB
    Whenever you initialize the GraphicsDevice(which Niya does in the Arena class) you need to target the appropriate GraphicsProfile based on what the console(or computer) can handle. In this case, your computer cannot handle the HiDef profile. So either change it to the Reach profile or setup a Try/Catch statement to try and set up the HiDef profile and if that fails then set it to the Reach profile:

    Code:
    Dim graphix As GraphicsDevice
    Try
        graphix = New GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, New PresentationParameters With {.IsFullScreen = False})
    Catch ex As Exception
        graphix = New GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, New PresentationParameters With {.IsFullScreen = False})
    End Try

  28. #28

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Quote Originally Posted by bensonsearch View Post
    I have tried to run the latest version but get this error on startup
    Name:  Capture.jpg
Views: 621
Size:  25.6 KB
    Search for this line in the solution:-
    vbnet Code:
    1. g_xnaGraphicsDevice = New GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, pparam)

    It's inside the Arena class in the PrepareDevice method. Then you try changing the second to last parameter to GraphicsProfile.Reach. The line should then look like this:-
    vbnet Code:
    1. g_xnaGraphicsDevice = New GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, pparam)

    If this works for you, all subsequent updates would use this setting.

    [EDIT]

    Just noticed that you double posted and dday9 answered. He's right. Your graphics hardware probably isn't advanced enough to using the HiDef profile. I would do as he suggested and wrap that call inside a Try...Catch in future versions.
    Last edited by Niya; May 15th, 2014 at 09:25 AM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  29. #29
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Demon Arena [Updated May 7th, 2014]

    ok the change to reach worked like a charm. i wish i knew all this, all i can say is AMAZING. we need to make a game from this ASAP lol.

    i went as far as changing the spawn rate to every tick and each monster just 1 of each and let the chaos happen. To my shock and surprise the graphics didnt slow down at all and the memory usage stayed the same as with 1 monster on the field. CPU went up of course but thats a given.

    Well done is all I can say. wish I had the ability to get my head around game programming, all I do is business apps (like to run a biz on).

    here is some chaos

    Name:  Capture.jpg
Views: 627
Size:  45.3 KB

    EDIT

    I should add that most times out of many, when matched evenly the blue afrit is a great unit, next to that if in numbers the iron lich hands down
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  30. #30

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Quote Originally Posted by bensonsearch View Post
    ok the change to reach worked like a charm. i wish i knew all this, all i can say is AMAZING. we need to make a game from this ASAP lol.
    Yea, I'm still thinking about a game of some sort. I haven't decided how to change this into a game yet. I want to upgrade all the monsters first by having them inherit from ComplexCreature instead of the older Creature class. I also wanna add a few more monsters too.

    Quote Originally Posted by bensonsearch View Post
    i went as far as changing the spawn rate to every tick and each monster just 1 of each and let the chaos happen. To my shock and surprise the graphics didnt slow down at all and the memory usage stayed the same as with 1 monster on the field. CPU went up of course but thats a given.
    The XNA renderer uses DirectX which is blazingly fast. I was also very careful with the handling of resources. Lessons I learned from the last one I wrote in VB6. However, there are a couple of inefficiencies. The collision detection system for one. You can see this if you spawn an excessive amount of Cacoliches. They fire a tonne of projectiles and you'd see quite a performance drop due to all the collision checks. I have to revise the collision detection system.

    Quote Originally Posted by bensonsearch View Post
    Well done is all I can say. wish I had the ability to get my head around game programming, all I do is business apps (like to run a biz on).
    Thank you

    To be honest, this type of thing isn't really all that difficult. Don't get me wrong, there are a lot of gotchas if you're doing something like this for the first time but after you figured it out, it's actually fairly easy. I had actually done this before so I pretty much already knew how to approach it.

    Quote Originally Posted by bensonsearch View Post
    here is some chaos

    Name:  Capture.jpg
Views: 627
Size:  45.3 KB
    You know you can resize the arena if you want to give them more room to fight. Use "+" to make it bigger and "-" to make it smaller.

    Quote Originally Posted by bensonsearch View Post
    I should add that most times out of many, when matched evenly the blue afrit is a great unit, next to that if in numbers the iron lich hands down
    Yea, I made the Afrits pretty powerful. As of now they have to most complex behavior of all the monsters. The BlueAfrit is my favorite unit. Spent a lot of time tweaking its definition. The Ironlich is something of a boss creature. It has the most powerful projectile and the most hitpoints.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  31. #31
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,342

    Re: Demon Arena [Updated May 7th, 2014]

    Niya,

    I had forgotten that I had a codebank contribution in the game programming codebank where I go game loops. It was a bit dated so I updated it today. I highly suggest that you check it out: http://www.vbforums.com/showthread.p...oop&highlight=

  32. #32

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Quote Originally Posted by dday9 View Post
    Niya,

    I had forgotten that I had a codebank contribution in the game programming codebank where I go game loops. It was a bit dated so I updated it today. I highly suggest that you check it out: http://www.vbforums.com/showthread.p...oop&highlight=
    Thanks. I will check it out.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  33. #33

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    What the ????
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  34. #34

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Could you please stop spamming with this nonsense.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  35. #35
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,342

    Re: Demon Arena [Updated May 7th, 2014]

    I keep getting it on my threads too. Is it all hieroglyphs with the occasional links?

  36. #36

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Quote Originally Posted by dday9 View Post
    I keep getting it on my threads too. Is it all hieroglyphs with the occasional links?
    Yea. The Mods have since removed the posts and banned the user. Thank God.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  37. #37
    Addicted Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Posts
    179

    Re: Demon Arena [Updated May 7th, 2014]

    Niya, I'm working on a game where players will have the option to capture the action and save it as mp4 video. Maybe even the ability to upload it to a players YouTube account. I think this would be a great option to add to your game.

  38. #38

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated May 7th, 2014]

    Quote Originally Posted by Peter Porter View Post
    Niya, I'm working on a game where players will have the option to capture the action and save it as mp4 video. Maybe even the ability to upload it to a players YouTube account. I think this would be a great option to add to your game.
    Not a bad idea. I'll look into it.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  39. #39

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated March 27th, 2015]

    Updated to version 5.0.0.0. See OP.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  40. #40

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,624

    Re: Demon Arena [Updated March 27th, 2015]

    Made a correction in the OP: Forgot to include the bug fix for the error reported in post 26 in the list of changes for version 5.0.0.0
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

Page 1 of 2 12 LastLast

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width