HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

SEE : Simple Entity Engine

12-01-2007, 08:24 PM#1
HINDYhat
SIMPLE ENTITY ENGINE
********************************


Version 2.4

The third system of its kind created by me, this one will hopefully be more succesful and will live up to my expectations. The two others were Simple Particle System, and then Simple Particle System Mark II. The first of the three was buggy, very slow, and extremely inaccurate. The second used procedural-style coding, which people didn't seem to appreciate. I finally created this: SEE - Simple Entity Engine. It uses object-oriented style scripting, which makes things alot easier to read and understand. I've worked a lot on getting this system to where I want it to be.

Please only report bugs or give criticism RELATED to this system!
This system requires JassNewGenPack for the use of vJass syntax!
This system uses UnitUserData!


Quote:
Features:
  • Easy to use, easy to read layout.
  • Efficient and fast system.
  • 'Realistic' bouncing off other entities and the ground.
  • Spherical collisions between entities.
  • Easy to create custom entity types.
  • Mass and volume play important roles in entity behaviors.
  • Documented just for you! :D

Credits go to HINDYhat for the creation of this system.

Thanks to Earth-Fury for helping me a lot and teaching me how to use object-oriented programming. Also thanks to him for coming up with this system's neat name, SEE: Simple Entity Engine.
------------------------
Thanks to PurplePoot for teaching me some things in Jass.
------------------------
Thanks to moyack for helping me on a nagging collision problem, and for being nice and helpful. :D
------------------------
Many thanks to grim001 for helping with a couple of bugs in collision detection.
------------------------
Thanks to anyone and everyone who might use this system in a map of theirs.


And now the code:
Expand SEE core:
Expand SEE entityData:

Additional triggers, such as the plugin triggers, can be found inside the map.

********************************

And now, documentation:
Implementing

*******************************************
****** ~ Implementing instructions ~ ******
*******************************************

Follow these steps to succesfully implement this
system into your map.

1. Import the "dummy.mdx" model from this map to yours,
and be sure to keep the same model path for it.

2. Copy the dummy unit 'e000' from this map to yours.
You can change the rawcode if you want, you'll just
have to change another value later in the code.

3. Copy these triggers into your map:
"SEEentityData"
"SEEcore"
"SEEdatalib"
"SEEplugin"
"SEEheight"

4. Go to the top of the "SEEcore" trigger, and toggle the
constants of the trigger to fit your needs (if you
changed the rawcode of the dummy unit before,
you have to set it to the changed rawcode now. The constant
you have to change is called "DUMMY_ID".

5. Delete everything in between the library delimiters
in the "SEEdatalib" trigger.

6. Run your map once with SEEheight enabled. Follow the
on-screen instructions.

7. Have fun making your maps with this system! :D

8. And for GOD's sake, read the damned documentation!!!



Changelog

*******************************************
****** ~ Change Log ~ ******
*******************************************

Simple Entity Engine. Version 2.4

--- 2.4 ---
Rewrote ground collision detection script. It's now feckin great.
Replaced the debug messages to use SCOPE_PREFIX.
Added the SEEheight library. (neat idea, shamelessly taken from grim001)
Made SEEcore_FPS a constant again.
Fixed some stuff in the implementing instructions.
Removed the selection circle from the dummy unit.

--- 2.3 ----
Changed friction calculations once again. Now seems much better.
Now keeps default scale on entity.createFromUnit if no scale is specified.
Removed health bars on non-locusted entities from entity.create.
projectTowardsPointSpeed now works as desired.
Entity collisions are now prevented from being calculated twice.
Fixed some bugs in the demo.
onCollision is now executed after collision resolution.
Fixed a wrong entity collision calculation.
Added an extra term in terrain collision detection for better precision.
Added the SAMPLE_RADIUS constant for terrain collisions.
Entities can now slide on the ground. Added a THRESHOLD_VEL constant for this.
Added the setEntityFlyHeight method.
Added the entity.createAsUnit method.
Fixed an issue with resting non-affected entities.
Removed a useless parameter for the removeSpringConstraint method.
Added the removeHealthBar method.
Added a "Constant List" documentation page.
Moved the onLoop call in SEEcore's main function (fixed a bug in resting non-affected entities).
Added a new demo.

--- 2.2 ---
Added projectToPointSpeedEx and projectToPointTimedEx.
Added projectTowardsPointSpeed.
Added enumEntitiesOfPlayer/InRect/OfType.
Added createFromGroup and createFromUnitType.
Rewrote the applyTimedLife method into something much simpler.
Fixed an issue with rest on non-affected entities.
Improved collision detection (now there are two integrated methods)
Removed some useless operations.
Added COLLISION_VEL and THRESHOLD_VEL constants.
Removed some lame parts about the entity struct.
Added the appropriate scale for createFromUnit.
Added a new demo.
Fixed some parts about the documentation.
Most stuff that I've forgotten.

--- 2.1 ---
Fixed friction calculations. (1.0 friction is now no motion, 0.0 friction is no friction at all)
Added an enum method.
Added a new projectToPointSpeed which takes in account gravity.
Made a new demo. (Credits to WILLTHEALMIGHTY for the nuke effect)
Probably added more stuff but I don't remember.

--- 2.0 ---
Remade the whole thing from scratch.
Collision is now time-velocity based.
New collision resolution technique.
Added air drag.
Added spring constraints.
TONS of optimization.
Added a few onX methods to entityData.
COMPLETE makeover on the syntax.
Made a new demo.
Probably many more changes that I forgot about.
--- 2.0.1 ---
Fixed a bug in the demo.

--- 1.2 ---
Added a Bounceable property.
Inlined the GroundBounce function.
Inlined (and optimized) the CollisionBounce function.
Replaced Static entities with an Affected state.
Added a Rest tally for more precise resting states.
Collision optimization.
Added Offsetx/y/z coordinates.
Replaced the crappy Projectile plugin with a cool Vehicle plugin.
Added documentation.
Smaller fixes...

--- 1.1 ---
Patched up collision detection and prevention.
Optimized the GroundBounce function (just a little bit).
Fixed an Entity removal problem (double free).
Removed the use of TriggerAddAction. The system now uses TriggerAddCondition.
Fixed an onEvent method problem with the CreateEntity method.
Added a little debug function.
A couple of smaller bug fixes...

--- 1.0 ---
Public release of the system.

*******************************************
****** ~ Previous Systems ~ ******
*******************************************
- Simple Particle System (slow, buggy and bad)
- Simple Particle System Mark II (used procedural sloppy coding)



Expand Constant List:

Expand Member List:

Expand Method List:

********************************


Finally, an example on how to use this system (A MUCH more elaborate example is included in the attached map) :
Expand Example:
Attached Images
File type: jpgSEEImage.jpg (49.3 KB)
Attached Files
File type: w3xSEE-Simple Entity Engine 2.4.w3x (58.4 KB)
12-02-2007, 12:30 AM#2
Tide-Arc Ephemera
Please mention the vJass requirement... somewhere which is obvious...
12-02-2007, 12:35 AM#3
HINDYhat
Whoops, sorry 'bout that.
12-02-2007, 12:50 AM#4
cohadar
Well I must say this really looks promising.
It is much better coded than before, and what is most important it is modular!

Of course we will need to inspect his in detail
12-02-2007, 01:02 AM#5
HINDYhat
Well I'm thinking of replacing all of my use of triggeractions with triggerconditions because of this : http://66.166.149.149/showthread.php?t=93797

Would that be a good idea?
12-02-2007, 02:00 AM#6
moyack
Quote:
Originally Posted by HINDYhat
Well I'm thinking of replacing all of my use of triggeractions with triggerconditions because of this : http://66.166.149.149/showthread.php?t=93797

Would that be a good idea?
Yes, it's not bad, but if you can avoid the trigger usage, better. Anyways, it's up to the application.

One thing that I've seen is that you're creating timers to manage each projectile, IMO, it's a very bad approach, it's like saying that the time framework is different according to the object. Manage ALL your movement with only ONE timer.
12-02-2007, 02:07 AM#7
HINDYhat
Yeah, that's only for the projectile extension.

I suppose I made that really quickly. I could work harder on it, and make it actually a useful system.

As for now, I'm still fixing up collisions... they're really being nasty.
12-03-2007, 01:10 AM#8
grim001
Good to see that you use my GetTerrainNormal method...

You have a lot of work left to do on collisions... personally I would say that you should stop caring about those since they are impossible to get right unless you copy my system exactly. It's too much work for anyone who's not insane. That's just a fact.

Overall, this is definitely a step in the right direction compared to previous engines, and it looks kind of similar to mine as far as overall design and the user-end goes.
12-03-2007, 08:45 AM#9
MaD[Lion]
grim there is something with ur object vs object collision. u use 1 group for each object for preventing double check. but wat about use only 1 global group, and for each object tat u have checked collision, add it to this group.
Everything in this group wont be checked with anymore.
And after all the loop, just clear this group.
12-03-2007, 09:03 AM#10
grim001
That won't work... if A collides with B it doesn't mean C won't collide with A. And it's kind of off topic in this thread too.
12-03-2007, 09:46 AM#11
cohadar
Quote:
Originally Posted by grim001
Good to see that you use my GetTerrainNormal method...

Strange, I always thought Anitarf made that.
12-03-2007, 12:46 PM#12
HINDYhat
Earth-Fury has helped me alot, and gave me the idea of working with two temp locations and inlining the cross product.

I've recently gotten collisions to work a little bit nicer.

Anitarf made the GetTerrainNormal shiz in his Vector Functions, but grim just inlined it. It's not really a new method, I think, just a faster one.

Sorry if I copied your system too much... just that logically, spherical collisions is the way to go, and your system was awesome when I tested it. I guess I was just trying to make something good.
12-03-2007, 05:43 PM#13
HINDYhat
Updated the system. Collision safety shiz now works and can be changed (it's a constant).

Here's the changelog for 1.1:
Quote:
Originally Posted by Changelog
--- 1.1 ---
Patched up collision detection and prevention.
Optimized the GroundBounce function (just a little bit).
Fixed an Entity removal problem (double free).
Removed the use of TriggerAddAction. The system now uses TriggerAddCondition.
Fixed an onEvent method problem with the CreateEntity method.
Added a little debug function.
A couple of smaller bug fixes...
12-03-2007, 06:03 PM#14
Pyrogasm
I looked briefly at your code and noticed that you're using the EVENT_UNIT_SELECTED event. This has been known to be a very late-running event that doesn't fire at the proper time.

I don't know what you'll want to do about that, but I thought I should point it out...
12-03-2007, 06:06 PM#15
HINDYhat
Well it's to detect when an entity is selected (with the onSelect method). I could add an IsUnitSelected checker in the main loop, but that would be slow...

Besides, it's one of the onEvent methods that people would use the least. I don't think pinpoint precision is necessary in this case. But if you really want me to do something about it... meh.