• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Pixelated_Nate
      Hello all!
      I'm currently designing a 2D, Puzzle/Action RPG, in a similar vein to Legend of Zelda: Link to The Past, in Unity and require a Programmer partner in which to work with me.
      The project, yet to be titled, will feature:
      A semi-open world, represented through pixel art, in which the player traverses to enter dungeons and advance the story. A handful of side-quests that require memorizing details and using puzzle-mechanics. A fast-paced, melee combat system that will include dodging, blocking and utilizing four different attack types that can be switched on the fly. A simple inventory of "Key Items" to be used in order to advance the story. Day & Night system and Weather Effects, with weather effecting combat.  A very simple Dialogue System to convey information via colored text. Saving/Loading via exporting and importing a physical save file. Majority of the project is already planned out, with plans to release commercially and splitting the profits equally among the two of us. 
      I would request that the applicant is able to work semi-independently, following an outline, and that they have experience in both C# programming  *and* putting those scripts to use inside Unity, whilst I will be creating the Art, Music/SFX and doing Level Design (Though if you are also comfortable in assisting me with these, I wouldn't be opposed.).
      Work will be shared in either Github or Unity Collab (Applicants preference), with communication done via Discord. 
      For more information and to apply, please contact me at nathan.jenkins1012@gmail.com
      Thanks for reading! 
    • By Just4lol
      I'm looking for my dream teammate(s) to help me work on my Unity game. I still dont know where Im going with that project but I want to make a good final product that I would be able to sell or publish it for free on Steam.  Here a video of the prototype (The only thing I dint made is the skybox) https://www.youtube.com/watch?v=y2Otmt9jRkc
      My discord : Just4lol#46982
      I want somone at least as competent as me : 
      - I want somone with at least one year of experience in Unity (already worked with scriptable object and know oop).
      - Already worked with shaders or can do editors tools is a plus.
      - Can do 3d models in Blender or can do 2d art for the ui or particles effects.
      - Can make soundtracks or sound effects a bonus.
      Im a french Canadian so mind my english I will do my best to edit any errors I see. 
    • By Enerjak
      protected void menuImage_ChildClick(Object sender, EventArgs e) { if(pbxPhoto.Image != null && sender is MenuItem) { MenuItem mi = (MenuItem)sender; pbxPhoto.SizeMode = modeMenuArray[mi.Index]; pbxPhoto.Invalidate(); } } I'm trying to make one click function to handle multiple menus. Using this code does not work when I click the menu buttons after the image is loaded in the picture box. Here is where I set the event handler of both menu items. 
      // // menuStretch // this.menuStretch.Name = "menuStretch"; this.menuStretch.Size = new System.Drawing.Size(152, 22); this.menuStretch.Text = "S&tretch to Fit"; this.menuStretch.Click += new System.EventHandler(this.menuImage_ChildClick); // // menuActual // this.menuActual.Name = "menuActual"; this.menuActual.Size = new System.Drawing.Size(152, 22); this.menuActual.Text = "&Actual Size"; this.menuActual.Click += new System.EventHandler(this.menuImage_ChildClick); Menu Stretch and Menu Actual are ToolStripMenuItems, which don't have an index variable as I've noticed. How do I get this to work? Otherwise I have to make a separate event function per menu item, which, depending on the amount of image properties, could be a a lot. 
    • By Dave Haylett
      Hi there,
      I need a simple(ish) MP3 player for my C# WPF project. Sound isn't a major player in my project, but I do need to be able to play a couple of MP3s at the same time (loaded in as Content).
      I'm currently using the standard MediaPlayer library just to get a placeholder in there, but it does not meet these requirements:
      * Looping - no matter what I try, there's always a split-second break in the sound when it comes to looping (a few of the sounds are short tune loops, and the brief pause when looping really stands out like a sore... ear...!)
      * Mixing - at times I need to play a couple of samples simultaneously, but I don't believe MediaPlayer can support this. Having said this I've not tried invoking more than one MediaPlayer class at the same time.
      Are there any suggestions? I've browsed through NuGet but I'm surprised I can't find anything really useful.
    • By Hitler!ewqe
      till now 
      i made almost perfect mouse selection unit 
      i mean rts style c# mouse scrtips 
      this works almost all of the warc3 game mouse function 
      now i want to unit to move with navmesh 
      please help me 
      this doesn work T.T 
      im so sorry guys i forgot if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
      this im so sorry 
  • Advertisement
  • Advertisement

Recommended Posts

Hey everybody,

So I have a situation where the player object is attacking the enemy object. My question is, in terms of best practices, should the player hit the enemy, and the enemy detect if it was hit and then deduct it's own health, or should the player deduct the health of the enemy? I know that in OOP every class should handle it's own behavior, but I'm not sure what the correct answer of this question is. Also, could anyone point me to good articles on how to take advantage of OOP in terms of game programming? I want to write the best code I can.


Share this post

Link to post
Share on other sites

Well, the other option which I tend to prefer is none of the above.  I try and encapsulate the concept of doing damage as a third object in the group.  The intention is to keep the details of how damage is calculated out of the entities so all the rules are in one place instead of split between attack and receive damage functions.  It also means that weapons can generate these objects such that you can have different rules for different weapons, or even multiple damage objects being generated by the weapon.  Additionally, this allows a better data driven design since you write a few damage type objects, parameterize them and then just fill in the details for each new weapon.

The utility of this of course depends on your type of game.  If you only have 5 weapons and they are generally just remove damage till zero, there is no reason to do this.  If you intend to have 10+ different weapons and many variations, that's when the separation becomes well worth the more indirect approach.

Share this post

Link to post
Share on other sites

However you do it in your system at the end, there are some fundamental thoughts to do for setting up such a system.

Who registers that any colision has been happen. This is important because using different weapons may result in different hit boxes, swords may trigger but a bow does not rather than its ammo.

How does a producer spread the information about a hit. Do you use directly connected objects so maybe a component on the sword or the ammo, or do they send an event to some kind of gameplay controller. I have seen both and it depends on the implementation what I would suggest, there exists good and bad implemenations of both, component driven and event driven systems.

Where will your damage been calculated. Again, is it a component or event target that will calculate the damage. The one or other way work but what happens when damage stacks for multiple buffs, e.g. for a burning sword with base 13 hit damage and +5 fire damage and how will your enemy react on that damage (for example an undead mummy could suffer incineration where a stone golem ignores the fire damage and reduces sword by half)

Share this post

Link to post
Share on other sites

Well, I would think that something like combat is not a property of either the player or the enemy, so I would not make it a member function of either.

If your programming environment does not allow things like free functions, then perhaps create a combat object that provides a function taking the two objects involved and arbitrates the results.  Such an object can also be handy for other state tracking, like driving animations or sound effects.

Share this post

Link to post
Share on other sites

Thanks for your input guys! I'm not experienced in OOP really, just getting started with it, and I want to make sure I'm really programming efficiently and taking advantage of the system. These responses helped a lot! @Bregma @Shaarigan@Hiwas

Is there any reference you guys could point me to in order to see some examples of gameplay programming and have a good picture of what to go for?

Edited by mothacluckinjoe

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement