# Unity "Victory" function. Your opinion wanted.

This topic is 3827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
Well, I'm sorry, but I want to be honest.

I don't see any sense behind your idea and no practical use. I don't think this can be used to ommit thousands of lines of code. Logic is logic, and if you simplify it and simplify it you'll reach a level where it can't anymore be simplified. And there is surely no magic function to replace thousands of lines of low-level logic.

Alexander

##### Share on other sites
I have a victory equation already:
def is_victorious(): return enemies.empty()
Can you explain how yours would simplify my code?

##### Share on other sites
But what if there is a possibility of a tie? It wouldn't be able to tell me if the game ended in a draw. And as for the point you pass in (I say point because it's basically a 5-dimensional point, at least how you're using it), how would you know what to pass in? For my chess game, how would I know what point to pass into the function to tell me if there was a three fold repetition, stalemate, check mate, draw, fifty move rule, or the impossibility of a check mate (and yes, these are all possible outcomes of the game)? And even if I did know what to pass in, how would the function know how to deal with those numbers? And how would this function be a "universal" solution? How could it handle all the possible outcomes of chess, Halo, scrabble, sudoku, Snake, Pong, Portal, Tetris, Starcraft, Metal Gear Solid, etc...

No, I don't think it could ever do what I needed it to without me customizing it to my needs, which destroys its whole purpose. And if a game really truly does require thousands and thousands of lines of code, I'm going to guess it requires some special tests that a single, 5 float parameter fuction couldn't do.

##### Share on other sites
Quote:
 Original post by ItignitionI think that I have exhausted the attention and interest of my peers in the topic I am about to present to you

Might have to do with talking yet failing to present anything concrete.

Quote:
 It is a programming function that collects 5 arguments of game play, war-room data or the status of a pool game; basically anything.

[true,false] = f(a,b,c,d,e). Ok.

Quote:
 The inspiration of the victory equation is a result of writing code-block after code-block of conditional “if-else” code that I believe is unnecessary no matter what game you are creating or to what the theme or conditional is.

Then comes de-coupling of code, entity driven approach, polymorphism, and other programming concepts. Patterns such as factories also help reduce hard-coding values.

Furthermore, it can be shown that if/else condition can be implemented using logical operations only. Through that, they can be transcribed into pure FSMs, which is basically what current processors are.

Quote:
 The victory equation takes 5 arguments (at this point).
Why not 42? 38 of them can be the same as the 4th dimension.

Quote:
 Each of the 5 arguments takes into account a value from each xyz co-ordinate and includes the 4th and 5th dimensional coordinate that is happening on screen at a given frame.
This makes no sense.

Quote:
 The x-plane values, the –y-axis values, the z-axis values, omitting 4th dimension from Einstein theory of Time and light (for now; because I cannot see the applicability), BUT includes the 5th hyper-dimensional value (from within).
Oh-key.

Quote:
 The 5th dimensional value might perplex you at this point, but to best describe what it is, in game terms it is understood by (“INSTA-damage”) or better described as damage that has no vector, velocity or collision instance. Think of a 2D world where a force from the z-axis comes in to collide with an entity. The entity would be confused and not understand why he is losing health because he cannot see the 3rd dimensional co-ordinate.
So, Act of god?

Quote:
 Anyway, back to the “Victory” equation. I am asking this to the game community what they think about this. Would you use this?

Use what? You haven't shown anything, demonstrated anything, there is nothing, except a 3 things which kinda are, one which is omitted for no explainable reason, and one thing which is everything else.

What is the equation? For example, an existing application, when executed, returns either 0 (success) or non-zero (failure). As such, any existing application conforms to "victory" equation.

Quote:
 Do you think it has application in eliminating the “if-else” and looping conditionals of game programming? I assume that thousands of thousands of lines of code could be omitted because of the nature of the “Victory” equation

If something can be omitted, it's redundant in the first place. Turing complete languages allow same algorithm to be implemented in either of them. If the "victory" equation is Turing complete, then it can do the same.

But if-else, as well as looping, are merely one thing common to C-family of languages (in a broad sense). They are not by far the only way to implement algorithms.

And one thing missed by "victory" equation is this;
- You go to store, and buy WoW. Thousands of hours of fun promised.
- You go home, install it
- The game prints: "true"

And that is it....

Or perhaps this topic is so far above my modest understanding of universe that I can't comprehend what it's about.

##### Share on other sites
Some of the responses so far have been blunt, to say the least.

However, I'm afraid to say I don't quite understand what exactly your equation does. I understand it in the general sense but cannot see the practicality of the equation. It may because I'm not getting the full scope of the things. Since you understand what you are doing far more than us I think that to convince us and well enlighten us perhaps a demo would be good. Otherwise I don't really see how it could be like a magic bullet. I'm not one to cut corners or do anything that makes the job 'easier' so it may just be a bias. It is a cool idea and thanks for sharing it with us, but I think maybe a visual would assist us in understanding what exactly your aim is.

##### Share on other sites
I'm finding many of the responses for this community not very friendly. I agree with Jinroh when he said they are blunt but I do want to address one of them.

Mike you raise a very good point. I do not have an answer for your chess game. I think you could be correct because the game possesses a 3rd value "a tie" which then does not have applicability with the victory equation because the game does not end in a boolean answer. there is a 2 ( 0=lose, 1=win, 2=tie) a tie.

Keep in mind, there is no existence of the Victory equation. Think of it as the absolute perfect example of polymorphism.

As for Anthus, amid your sarcasm and willfulness to be aggressive towards this idea (I have no idea why it make you so mad??):( I am trying to example the concept of this as best I can to you the reader. To elaborate on the 2 dimensional entity that I explain of (that you somehow took offense to) I steer you to this great video on the explanation of flatland, to gain understanding into what I am talking about.

From the way that I see it, most games that involve a live or die boolean as to what mesh or sprite gets deleted all follow a similar trait. "Does the A sprite get deleted or does the B sprite get deleted" and if the programmer can represent an amount to this question to a simple float value represented by force then we can predict who wins.

2d war game:
player1xplane = forceValue(1000 troops)
player2xplane = forceValue(200 troops)
bool player1 = 1

2d shmup
player1yplane = forceValue(64.4) // strength of shots on y-geometric plane
NPCyplane = forceValue(20) // strength of enemy NPC

now for 3d mesh
who wins:

The point here is the possibility of matching the victory function against an object and having one generic collision evaluation equation returned back by the Victory equation.

the point is just trying to omit

while (!health == 0)
if....
if.....
if ....

It just a thought, and again, I am not a physicist just a open-minded programmer.

[Edited by - Itignition on July 10, 2008 3:02:13 PM]

##### Share on other sites
Quote:
 Original post by ItignitionIt just a thought, and again, I am not a physicist just a open-minded programmer.

No one is getting after you for not being a physicist. What no one understands is why you're trying to mix physics and boolean logic. As Antheus said, you don't have to use a bunch of if-else statements to test if the game is still running. There are more advanced methods, all of which are practical. Attempting to force physics into game logic is a bad idea. And your example has nothing to do with Einstein, Hawkings, quantum mechanics, or even classical physics. And why would anyone want to omit their main game loop (what you used as while (health != 0))? That's when you play the game. Why the heck would you want to remove your game loop and tell the player that he lost before he could even click a unit and tell it what to do. Again, as Antheus helped showed, if a person tries to play such a game, they're gonna be one pissed off person.

##### Share on other sites
Either this is a joke, or I just don't understand what you're saying. Give us a simple but actual example of this "Victory function", because right now what you say makes absolutely no sense to me(actually, it sounds like Star Trek pseudo-science technobubble).

##### Share on other sites
You're not making too much sense though. Are you proposing this as collision detection? There's already algorithm's for calculating collision of various geometric primitives.

From the way you've described it it just sounds like you're trying to say

if (collision(a1,b1,c1,a2,b2,c2))
then if ( e1 > e2 ) return true
else return false

There's nothing revolutionary there and it definitely doesn't have an application in most games. I guess I'm just in the majority here that don't really understand what you're trying to say. I mean no offense it's just what your proposing doesn't really fit into games at all.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 33
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015637
×