Create an account


Thread Rating:
  • 4 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Vore Tournament (game forked from Nexuiz)

Considering this has to do with QC maths, code logics, and other painful but fun stuff... I thought I'd post about it here as well. It involves the custom HUD panel responsible for listing players in a tree view, based on who's nomming who... something far more complex to do than one would at first imagine:

After 3 days of non-stop work on code algorithms, I was finally able to piece together a seemingly working mechanism for player list sorting. I had no idea this specific part of the code would prove to be such a problem, dwarfing my early concerns on the difficulty of reading player entity fields. Right now I feel like a mathematician or high level programmer for succeeding in finding a way to get it all working... obviously I am neither. As an update, I thought I'd explain a bit of what went on:

The first problem was that players are added to the table in a random order, as the base loop iterates through their entity numbers. This means that players can be detected in any order at all! So how would you make sure that each prey is listed under their predator, who in turn might be listed under another predator? Let's say you first notice that prey A belongs to predator B, so you list A below B and move on... then you detect that predator B is getting gobbled up by predator C, so you move B under C next... however prey A is already set in stone, so now it's left floating in an invalid position as B was pulled away from over it! One solution is running the sorting mechanism multiple times until it no longer detects any changes, which I actually went ahead and tried at first... however that's not only inefficient, but also prone to creating infinite loops that easily crashed the game once ran.

I ultimately managed to find a smart solution yesterday, by separating the process into two separate loops: One for columns and one for rows. The first only detects how far the predator chain of a player goes, and sets the column based on that knowledge. The second then goes through each column, and for each entry in that column (prey player) goes through the previous column and finds the matching entry (pred player) then positions the prey under the pred. This way preys are always positioned after their predators in order, and the random manner in which players are discovered no longer poses a concern.

After figuring this out, I thought all my problems had ended. But I was wrong... for there was another, far more problematic circumstance: Recursive vore loops. Suppose you have player A swallowing player B, player B swallowing player C, and player C swallowing player A: In a system where each prey is analyzed to detect its predator, A sees B, B sees C, C sees A, A sees B again, and we have an infinite loop! Not only that, but you logically cannot create a tree view in this case, as each player needs to be listed under the next forever!

The solution was ultimately to detect vore loops, then cause a break in the chain at one point. The code for this still isn't optimal and has several TODO notes attached to it, but for now it works. If it's only two players swallowing each other, the one with the most swallow progress will always be listed on top... if the chain goes further than two players however, it may be cut at a random position, and I fear that more than just one cut may currently occur in certain conditions.

All in all, Git master now has a decent listing system that does the job right most of the time. It will need to be optimized over time... both to account for every possible circumstance, and to be more loop efficient. For now I think I might take a few days break, as dealing with the maths involved left my brain a little bit fried. After that, the easy part should come last: Creating the icons and rings, and adding more details to the entries.

If by change anyone's curious to see the code in cause, and for bonus points tell me how the same result could be achieved with half the code using a different approach I wouldn't have thought about just to make me suffer, here are the highlights and my own solutions:
Reply



Messages In This Thread
Hands and bulges - by MirceaKitsune - 03-13-2017, 08:20 AM
RE: Vore Tournament (game forked from Nexuiz) - by MirceaKitsune - 04-05-2017, 08:37 PM
Vehicle & Graphics update - by MirceaKitsune - 05-03-2017, 09:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question How popular was Nexuiz? Gwlanbzh 11 10,432 08-21-2021, 01:18 PM
Last Post: [CISN] Neigdoig
  Hi guys, this is me winning the xonotic pro elite super turbo tournament 2019 ***** SUPER FALLITO ***** 5 4,695 08-26-2019, 03:17 PM
Last Post: Antibody
  Well you guys held a tournament Antares* 15 11,869 09-29-2016, 05:55 PM
Last Post: kaadmy
  Nexuiz (Steam) Back from the dead? Totally_Cool 15 14,255 04-24-2016, 04:05 AM
Last Post: tZork
  Gave the Unreal Tournament pre-alpha a spin, here's my breakdown Lee_Stricklin 2 6,608 03-27-2015, 12:23 AM
Last Post: Lee_Stricklin
  Q3 and Nexuiz for Xonotic. grigorii 13 17,816 01-10-2015, 07:52 AM
Last Post: grigorii
  How do i play Nexuiz servers with Xonotic? MarkJonez 6 18,055 10-06-2014, 04:10 PM
Last Post: Mario
  Nostalgic Nexuiz unfa 0 8,084 05-30-2014, 05:48 PM
Last Post: unfa
  New Unreal Tournament frostwyrm333 33 44,056 05-09-2014, 07:32 AM
Last Post: asyyy
Question [SOLVED] N from NEXUIZ - What means? play3r0 4 7,448 03-09-2013, 05:07 AM
Last Post: play3r0

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-