The Daily Click ::. Forums ::. Klik Coding Help ::. Pro's and Con's of my methodology
 

Post Reply  Post Oekaki 
 

Posted By Message

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
29th March, 2016 at 29/03/2016 05:32:32 -

Hi guys,

So I'm toiling away on a tabletop battle game which is just about to hit a reboot and 3rd build, taking in all the lessons I've learnt and giving rise to a much cleaner and clearer code blah blah blah. However there's one choice I have to make, and I can't really land on either option as I can't see a huge benefit either way. Thus, my question.

First some background though.

It's a tabletop battle game, so you should be picturing a single screen game, top down perspective, with buildings and terrain as scattered Actives across the battlefield. It's 2 player, so each player prior the game selects their army using a points system which is pretty standard, and can customize their units and unit makeup etc. For example, you can purchase a 10-man Orderguard squad for 50 points, you then have the option to buy a few heavy weapons, or a sergeant, or add another 1-10 guys, depending on the role you envision this unit taking up on the field.

So, when the game actually starts, each player deploys their units onto the game board. These units are in the form of a large circular active which is designated the Unit Marker, and there is one for each squad. The actual makeup of these Squads is then represented by smaller, animated (static, but actually drawn images as opposed to semi-transparent coloured discs) models I've called Mobs. For instance, your Orderguard squad from above might have 1 Sergeant mob, 10 Orderguard with Beamer mobs, 2 Orderguard with Beam Cannons, etc etc, all arranged relative to their Unit Marker.

Make sense so far? In a nutshell, lots of smaller actives buzzing around and underneath a larger one, times the amount of actual units you've selected to battle with.

My current code has all these Mobs as just a single Active Object. So the animation that displays is based on the Mob's ID value, as are all it's stats such as strength, movement, etc. There's no individual active for Orderguard General with Beamer, Orderguard General with Rail Rifle, just Player 1 Mob with Alterable Value A of X,Y,Z.

My question is, is this the right way to do it when I rebuild the code?

Here's my current thoughts.

All the code works for all Mobs regardless of what the Alt Value ID is, because everything is just Mob Active Object. However, if I was to make individual Active Objects for all Mobs, I could put them in a Qualifying group and it would work exactly the same.

In my current plans I will end up with at least 400 individual mob types. As it is, I have 70+ different animations loaded into the Mob active, to represent all the potential troop choices for just ONE ARMY. I've never heard of a limit to the amount of animations than a single Active Object can hold, but I assume one exists, and if it's lower than the amount of Mob ID's I end up with, I'm going to have to create P1 Mob 2 and apply all the rules to it, or something similarly messy. Essentially, I'm suddenly working with double the code, because everything that could be applied to P1 Mob 1 has to be written for P1 Mob 2. This looks like a situation where Qualifier groups would be the better option.

If I was to make individual actives for each Mob ID, the actual amount of lines in the code wouldn't change all that much, because I already have lines of code that pertain to each ID anyway. So as opposed to writing Mob ID = X, I would be just referencing the Mob directly. However, does having a couple of hundred Actives in a program increase the load at all, even if they aren't being used? I'm assuming Load On Call options would make sure the program isn't wasting cycles checking in anything applies to Mob Actives that aren't being used.



I'm leaning toward individual Actives for the next iteration. I'm basically just wondering if there's any reason why I SHOULDN'T do this. Cheers in advance for reading this ramble.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
29th March, 2016 at 29/03/2016 16:02:51 -

Try both methods out and see what works the best. There is really no right way to do things, but a different approach might be more optimized, or maybe easier to read, and sometimes an approach might be the best of both.

Remember there is a object limit, so make sure the amount of objects you plan to use fit within those limitations. Usually though the limit is high enough to not be a problem.

If you're having a specific issue with something not working I would be happy to help you out.

 
n/a

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
31st March, 2016 at 31/03/2016 00:42:24 -

I was going to bring up load on call. But I can see you are on top of that one. The only other thing I have a personal belief about is, if you're deleting lots of objects. Add a line of code to double check that the object really did get deleted.

 
https://www.facebook.com/nathon.brown.7

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
31st March, 2016 at 31/03/2016 02:16:23 -

@-UrbanMonk-

Are you talking about an object limit during runtime? Or a total amount of objects usable in construction?

I've had a few versions of this engine running pretty fine during playtesting at ~1000 objects total, which is what the final version will hover around. So that ain't an issue. If there is however a maximum amount of individual Active Object instances I can create and work with, then I could be in trouble if it's not too high, as I'm going to need around 500-700 individual objects more than likely.

But either way, you are right in that I need to go with what works and with what is comfortable to work with. As it is, I'm leaning toward individual mob Actives all grouped into related Qualifiers. All the benefits of individuality with regards to the objects, and with the qualifiers I get the added ease of events applying to any of them I need regardless.

@Pan-tosser

Have you had issues with Actives not being deleted before? I always have a DEBUG event group active at the top of my event list, and the first command is usually On Frame Start -> delete basically everything, and I've never run into problems. Then again, I've only had it remove maybe 60-70 objects from the frame at a time, not the multiple hundred I'd be dealing with in this situation.

I can't say I've ever really messed around with the Load On Call options, but I'm assuming it's not going to delete things from my frame. Because any object placed in the frame is, by default, called at the start of the frame, yeah?

...So what does it actually do, now that I think about it?

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
31st March, 2016 at 31/03/2016 16:49:08 -

If it's only a few hundred then you're fine. You can increase the frame object limit in the frame settings. The max is 20,000.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click