# Unity "Victory" function. Your opinion wanted.

This topic is 3611 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.

• ### Similar Content

• I'm working on a system for my game that will allow the player to stack pick ups in a queue. As one pick up expires, the next automatically activates. I'm having an issue though where if I pick up the first one, it activates fine, but if i pick up a second directly after it, it overrides the first one, activates the second one, and then once it has run it's course, everything goes back to normal gameplay, no first pick up. I'm not sure why this is happening. Hopefully someone can spot what I'm doing wrong in my code.
Here is the code for the pick up manager:
// Update is called once per frame void Update () { if (pickUpQueue.Count != 0 && !pickUpActive) { pickUpActive = true; pickUpQueue[0].ActivatePickUp(); } DeactivatePickUp(); } void DeactivatePickUp () { if (pickUpQueue.Count != 0 && pickUpActive) { Destroy (pickUpQueue [0]); pickUpQueue.RemoveAt (0); pickUpActive = false; } } And here is the PickUp:
public override void ActivatePickUp () { ball.GetComponent<Ball>().Speed = 2.0f; //increase ball speed... ball.GetComponent<Ball>().StartCoroutine(timer); //...set time that power up is active }
There is also a Base Pick Up:
public void OnCollisionEnter2D (Collision2D collision) { Vector2 tweak = new Vector2 (Random.Range(0f, 0.2f),Random.Range(0f, 0.2f)); this.gameObject.GetComponent<Rigidbody2D>().velocity += tweak; //if the pickup makes contact with the paddle or ball.... if (collision.gameObject.tag == "Paddle" || collision.gameObject.tag == "Ball") { GameObject.FindObjectOfType<GameManager>().GetComponent<PickUpManager>().pickUpQueue.Add(this); Destroy(gameObject); //...and finally destroy power up object } } As a side note, I am trying to find a solution to this that will work for all of my pickups. Some pickups are ammo based, some are timed.
• By D34DPOOL
Edit Your Profile D34DPOOL 0 Threads 0 Updates 0 Messages Network Mod DB GameFront Sign Out Add jobEdit jobDeleteC# Programmer for a Unity FPS at Anywhere   Programmers located Anywhere.
Posted by D34DPOOL on May 20th, 2018
Hello, my name is Mason, and I've been working on a Quake style arena shooter about destroying boxes on and off for about a year now. I have a proof of concept with all of the basic features, but as an artist with little programming skill I've reached the end of my abilities as a programmer haha. I need someone to help fix bugs, optomize code, and to implent new features into the game. As a programmer you will have creative freedom to suggest new features and modes to add into the game if you choose to, I'm usually very open to suggestions :).
What is required:
Skill using C#
Experience with Unity
Experience using UNET (since it is a multiplayer game), or the effort and ability to learn it
Compensation:
Since the game currently has no funding, we can split whatever revenue the game makes in the future. However if you would perfer I can create 2D and/or 3D assets for whatever you need in return for your time and work.
It's a very open and chill enviornment, where you'll have relative creative freedom. I hope you are interested in joining the team, and have a good day!

To apply email me at mangemason@yahoo.com

• Is there a way to automatically change the start position of an animation? I have a bunch of animations set up on 3D models in unity. The issue is that I need to move the 3D models, however when I do so the animation start positions are not updated and I have to do it manually.

Changing the transform of key frames is time consuming with the amount of animations I have, so I was wondering if there was a way to do it automatically?
• By MoreLion
hey all! We are looking for members for our Unity horror game!
Here’s the story:
After a deadly virus plunges the world into chaos killing 85% of the human population there are now what they call “zones” these zones are watched very closely by the surviving government, people are checked every day for the virus, even if you touch the spit or any human waste or fluids of the victim who is infected, you will die. But one day, people in the west zone start to go missing, 1 woman goes outside the walls to uncover the mystery, is there more to the virus than meets the eye?, That is where your story starts.
This game is not a long development game, I have loads other game ideas,
I will also allow you to have a bit of creative freedom if you wish to add or share a idea!
And no, it’s not a zombie game lol I feel like zombie games are too generic, in this game you will encounter terrifying beasts!
There is some concept art one of our concept artists have made
If interested email liondude12@gmail.com

• GOVERNOR is a modernized version of the highly popular series of “Caesar” games. Our small team has already developed maps, written specifications, acquired music and performed the historical research needed to create a good base for the programming part of the project.

Our ultimate goal is to create a world class multi-level strategic city building game, but to start with we would like to create some of the simpler modules to demonstrate proof of concept and graphical elegance.

We would like programmers and graphical artists to come onboard to (initially) create:

A module where Province wide infrastructure can be built on an interactive 3D map of one of the ancient Roman Provinces.
A module where city infrastructure can be built on a real 3D interactive landscape.
For both parts, geographically and historically accurate base maps will be prepared by our team cartographer. Graphics development will be using Blender. The game engine will be Unity.

More information, and examples of the work carried out so far can be found at http://playgovernor.com/ (most of the interesting content is under the Encyclopedia tab).

This project represents a good opportunity for upcoming programmers and 3D modeling artists to develop something for their portfolios in a relatively short time span, working closely with one of Canada’s leading cartographers. There is also the possibility of being involved in this project to the point of a finished game and commercial success! Above all, this is a fun project to work on.

Best regards,

• So I have hundreds of moving objects that need to check there speed. One of the reasons they need to check there speed is so they don't accelerate into oblivion, as more and more force is added to each object.
At first I was just using the Unity vector3.magnitude. However this is actually very slow; when used hundreds of times.
Next I tried the dot-product check:  vector3.dot(this.transform.foward, ShipBody.velocity) The performance boost was fantastic. However this only measures speed in the forward direction. Resulting in bouncing objects accelerating way past the allowed limit.

I am hoping someone else knows a good way for me to check the speed with accuracy, that is fast on the CPU. Or just any magnitude calculations that I can test when I get home later.

What if I used  vector3.dot(ShipBody.velocity.normalized, ShipBody.velocity)?
How slow is it to normalize a vector, compared to asking it's magnitude?
• By Ds ds
Hi, my name is Andres, I'm a programmer with a technician degree and a Diploma in C#, looking for a project in Unity to start my career in game development. I don't do it for a paid but a recognition and start a portfolio, preferably a 2D game. Thanks for read, have a nice day.

• Hi there! Is the first time that I'm posting here so I'm sorry if I'm doing it wrong ha.
So here it comes, my doubt is, I'm doing a game with different levels, each of these levels in one different scene. Each scene contains to cameras that you can change pressing a button. Everything works fine.
The only problem is that I would like it to look a bit more professional, and I would like that if you finish the level with camera2, the next level start the same way. I've been thinking about using dontdestroyonloadon both cameras, but obviously this cameras need to be attached to the player to make the movement work, what do you recommend? Sorry If I've explained it in a messy way, and feel free to dm me for anything. Thanks in advance!

• Hello everyone
I am a programmer from Baku.
I need a 3D Modeller for my shooter project in unity.I have 2 years Unity exp.
Project will paid when we finish the work
If you interested write me on email:
mr.danilo911@gmail.com
• By markoal
Hi,
I'm Unity developer from Croatia and I'm looking to work on the paid project in my spare time.
I have 5+ years of experience in Unity and I'm familiar with almost anything, including all platforms (also Switch, PS4 and Xbox).
Feel free to contact me.

• 38
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631365
• Total Posts
2999583
×