Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 140
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: Being efficient with entities.  (Read 1905 times)

0 Members and 1 Guest are viewing this topic.

Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Being efficient with entities.
« on: March 03, 2010, 07:29:23 pm »
I've mentioned this in other threads but I think it's time to explain it a little.

The current limit for induvidual entities is 150. This includes heroes , enemies , projectiles , hitflashes , objects and so on. Quite a few members have hit this limit recently but I've been using a method that drasticly reduces the number of entities in my mods , allowing me to have many more induvidual characters than most other mods.

I went through a couple of stages to get to where I am now so I'll explain them both as they can still be useful in their own way.

First up is an example of what I now see as "the wrong way". When I first started out , I used different entities for my projectiles , sfx and whatever else I needed. This is the result.



A single character using up 8 entity "slots". Not good.

Then , I decided to bundle up all the sfx entities into one and give each character a sfx entity.



Now , the sfx entity contains the sfx so we simply spawn it and change the animation to match that of the parent. This was more efficient than before but still cut my number of unique entities in half.

Then I came to step 3. Now , all my entities contain all their own sfx , projectiles and even hit/blockflashes within their own text file as follow anims. You just tell the entity to spawn itself and switch to the desired animation. If you are using script (which you probably should be for this trick) you can also adjust any other properties you need to.

Spoiler
anim spawn
   loop   0
   delay   66
   offset   167 234
   bbox   0
   frame   data/chars/kyo2k3/kyo617
   delay   11
   frame   data/chars/kyo2k3/kyo343
   delay   15
@cmd spawnfx "0" "flame" "S" 0 0 1 0 openborconstant("ANI_FOLLOW20") 1
   frame   data/chars/kyo2k3/kyo618
   frame   data/chars/kyo2k3/kyo619
   delay   48
   frame   data/chars/kyo2k3/kyo386
   delay   9
@cmd soun001 "data/chars/kyo2k3/ike.wav"
   frame   data/chars/kyo2k3/kyo347
   delay   21
   frame   data/chars/kyo2k3/kyo348


# Flame fx for spawn anim
anim follow20
   loop   0
   delay   6
   offset   127 332
   bbox   0
   frame   data/chars/kyo2k3/kyo740
   delay   3
   frame   data/chars/kyo2k3/kyo741
   frame   data/chars/kyo2k3/kyo742
   frame   data/chars/kyo2k3/kyo743
   delay   6
   offset   141 347
   frame   data/chars/kyo2k3/kyo624
   delay   3
   frame   data/chars/kyo2k3/kyo625
   frame   data/chars/kyo2k3/kyo626
   frame   data/chars/kyo2k3/kyo627
   offset   147 355
   frame   data/chars/kyo2k3/kyo624
   frame   data/chars/kyo2k3/kyo625
   frame   data/chars/kyo2k3/kyo626
   frame   data/chars/kyo2k3/kyo627
   frame   data/chars/kyo2k3/kyo624
   frame   data/chars/kyo2k3/kyo625
   frame   data/chars/kyo2k3/kyo626
   frame   data/chars/kyo2k3/kyo627
   frame   data/chars/kyo2k3/kyo624
   frame   data/chars/kyo2k3/kyo625
   frame   data/chars/kyo2k3/kyo626
   frame   data/chars/kyo2k3/kyo627
   frame   data/chars/kyo2k3/kyo624
   frame   data/chars/kyo2k3/kyo625
   frame   data/chars/kyo2k3/kyo626
   frame   data/chars/kyo2k3/kyo627
   offset   157 297
   frame   data/chars/kyo2k3/kyo624
   frame   data/chars/kyo2k3/kyo745
   frame   data/chars/kyo2k3/kyo746

Now , in theory , I can have 150 unique entities in my mods. But this is the best thing! Using this method , we are suddenly one step closer to being able to create a single character that can be placed in any mod. A character that has many different sfx , projectiles and flashes that will use the correct animations regardless and the end user only has to enter one line of text in models.txt to get it to work.

I'll post example scripts and maybe a video or two soonish.
« Last Edit: March 03, 2010, 07:40:14 pm by Orochi_X »


* Orochi_X says : " Sore ga doushita? " :looney:

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Being efficient with entities.
« Reply #1 on: March 03, 2010, 07:58:10 pm »
Hah! Great minds an all. This is virtually identical to the technique I use.

Mine is for a different purpose though. I wanted to have dust, flash, and other such effects interchangeable for differing environments (dust becomes splashing, etc.) without individualized scripts or model switching. Also, it's a necessity for having true stereo sound effects.

For me entity reduction was just a nice side effect, heh.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Re: Being efficient with entities.
« Reply #2 on: March 03, 2010, 08:27:16 pm »
Lol. I've gone down the dust/splash/leaves route , too. Spooky!  :wow!:

Yeah , my motivation was purely to cut down on the number of ents I use. I want atleast 50 playable characters in NGC. Now I can do it quite comfortably.

@Bloodbane: You can easily apply this to your shot entities in your Contra mod. Put them all together into a single ent and switch the anim to suit. Simply apply all the properties you need on a per anim basis rather than per entity.
« Last Edit: March 03, 2010, 08:41:43 pm by Orochi_X »


* Orochi_X says : " Sore ga doushita? " :looney:

Offline zamuel

  • Commercial
  • Hero Member
  • *****
  • Posts: 564
Re: Being efficient with entities.
« Reply #3 on: March 03, 2010, 08:43:31 pm »
This looks to be quite useful.  I'm guesing that this would also be a good way to do "same but different" enemies like how a Foot Soldier in the Ninja Turtle beat em ups might have a sword while another has nunchucks.
FOLH Progress
Primary game: Done!
Extra mode: Done!

Street Team: Reign of the Iron Dragon - http://lavalit.com:8080/index.php/topic,6240.0.html

Offline Fightn Words

  • Hero Member
  • *****
  • Posts: 3264
  • Confectionary Country of the Nin-Nin
Re: Being efficient with entities.
« Reply #4 on: March 04, 2010, 11:36:04 am »
Very very clever, thank you. :cheers!:

Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Re: Being efficient with entities.
« Reply #5 on: March 04, 2010, 04:22:32 pm »
O.K. Here is a quick didhitscript that will spawn a custom hitflash. This is bare bones stuff. My actual script spawns different flashes depending on attack power , if a weapon is used , if the attack is blocked and some other stuff. One mod even remaps the flash to suit the victims blood colour!

Anyways , here it is...


Code: [Select]
void main(){
//initialising some stuff
void self = getlocalvar("self");
void opp = getlocalvar("damagetaker");
float x = openborvariant("lasthitx");
float a = openborvariant("lasthita");
float z = openborvariant("lasthitz");
void vSpawn; //Spawn object.

clearspawnentry(); //Clear current spawn entry.
    setspawnentry("name", "0"); //Aquire spawn entity by name.
    setspawnentry("alias", "hitfx" ); //Set alias.
setspawnentry("coords", x, z, a); //Set spawn location
   
    vSpawn = spawn(); //Spawn entity.
    clearspawnentry(); //Clear current spawn entry.

changeentityproperty(vSpawn, "position", x, z, a); //Set spawn location.
changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW22"));
changeentityproperty(vSpawn, "parent", self); //Set caller as parent.
changeentityproperty(vSpawn, "autokill", 1); //Set autokill.
changeentityproperty(vSpawn, "subject_to_gravity", 0); //Set antigravity.

Pretty easy stuff. For those wondering why I spawn an entity called "0" , all my ents are named by a numerical value so I can staore/call them from variables a little easier. That's a topic for a different tutorial , though.

Check out the following video. It shows Kyo spawning a flame. That flame is actually another version of Kyo forced to play anim follow 20 as shown in the example in my first post. It later shows him spawning crabs (I wanted something that would stand out for the video!) as special hitflashes. Normally I would have disabled the default flash but I reenabled it for the video so that you could see that it was working as described. Again , the crab is actually another copy of Kyo forced to play a different animation.

http://www.youtube.com/watch?v=1GF-bavDBYs#ws

Please excuse the obvious. I've only just started to create Kyo2k3.

Yeah , zamuel , that's a perfect example. A single ent with all the different weapons included in the txt file. Spawn the corresponding weapon by switching the animation based on the remap colour.


* Orochi_X says : " Sore ga doushita? " :looney:

Offline vies

  • Full Member
  • ***
  • Posts: 177
Re: Being efficient with entities.
« Reply #6 on: March 04, 2010, 09:42:13 pm »
Very nice, I'll have to keep this in mind when I eventually get to practicing script.

Offline MasterExploder

  • Sr. Member
  • ****
  • Posts: 326
  • You spin me right round, baby, right round
    • THE TWITTER!
Re: Being efficient with entities.
« Reply #7 on: March 04, 2010, 10:01:34 pm »
It's great to see you sharing this techniques, OX, this will open up greater possibilities for mods than what the current constraints of the engine allows.

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • Posts: 3963
  • Credit to Vyck_St.Judas, Edited by me.
Re: Being efficient with entities.
« Reply #8 on: March 04, 2010, 10:11:36 pm »
Nice posts OX! I gotta get up on this sometime, Since I'm currently at 46 chars in SBMM, and each one of them haa a separate enemy entity, which doubles the number of entities I have, not to mention normal enemies, like the bad guys from Streets of rage, and the robots from Sonic.

X)

Offline BRimstone-x

  • Jr. Member
  • **
  • Posts: 71
  • SALMON ARM!
Re: Being efficient with entities.
« Reply #9 on: March 05, 2010, 07:03:39 am »
Wow Jesus, its still at 150? Oh my. I remember reading that on the Wiki, which I figured was extremely out of date by this point and therefore that information was inaccurate. Yikes, 150. That'll be a definate problem making my Megaman game. I think I'll have to release different versions of it now.

Theres easily over 150 entities in that. Without a doubt. Not only do I plan to include ALL robot Masters, but obscure ones and some custom ones too.

Hmm. Oh well, now I can plan ahead. This method will definatly help, thanks OX ^_^

 



 0%




SimplePortal 2.3.3 © 2008-2010, SimplePortal