Jump to content

Help figuring out creating custom Actors C++


TheConceptBoy
 Share

Recommended Posts

Unfortunately it wasn't that simple.  I don't know how it happens but sometimes the file gets corrupted.  I opened the header file in a Hex Editor so I could see every byte of info and found these funny symbols (circled in red).  After removing those it compiled fine :D

Before.thumb.png.edc1ea4ead7e6031a1ec1000eef798d7.png

Link to comment
Share on other sites

Ah, great. So there was literally no way an inexperienced C++ programmer would have ever been able to guess that one. 

Well at least I know now.

 

Any ideas if it was VS that caused it? Or perhaps the internet browser is designed to add scramble to potentially harmful files? Notice how the cpp file transfered ok but the .h file had all sort of a mess added to it's suffix?

Link to comment
Share on other sites

I'd say it was VS.  A few years ago I had a similar issue.  I think how I solved it was I just deleted all the white spaces between the functions and the error was solved.  Luckily it wasn't a big class.  Another thing I've noticed with VS, sometimes it will say you have an error but it will compile and run fine.  I think this is the intellisense kicking the bucket - the only way I've found to fix that is to restart VS.

 

Link to comment
Share on other sites

Now that I've gotten a single instance of the zombie class spawned, which, now that I've gotten a hang of it, was pretty damn straight forward.

Thank you for the help and patience btw

1) Creating a proverbial horder of zombie instances would require creating an array based on the actor entity class and storing all the zombies in that array?

Link to comment
Share on other sites

35 minutes ago, TheConceptBoy said:

Can we use an alternative to VS? Do we have to use VS? 

VS has a lot of good debugging tools.  Personally, despite some of the things that can go wrong with it, I would use it over the internal editor.

29 minutes ago, TheConceptBoy said:

Thank you for the help and patience btw

Welcome :D

29 minutes ago, TheConceptBoy said:

Now that I've gotten a single instance of the zombie class spawned, which, now that I've gotten a hang of it, was pretty damn straight forward.

Thank you for the help and patience btw

1) Creating a proverbial horder of zombie instances would require creating an array based on the actor entity class and storing all the zombies in that array?

How I would go about it is load 100 zombies in an Entity* array.  Then assign each entity a ZombieActor class.  Inside your ZombieActor class you make it control each entity.  E.g. In UpdateWorld() you would check the distance to the player, if the payer is close you make it attack.

Link to comment
Share on other sites

8 hours ago, Lethal Raptor Games said:

How I would go about it is load 100 zombies in an Entity* array.  Then assign each entity a ZombieActor class.  Inside your ZombieActor class you make it control each entity.  E.g. In UpdateWorld() you would check the distance to the player, if the payer is close you make it attack.

Ah, so far the array created with the Entity class method was the correct procedure. So that part lines with with the standard C++ game dev procedure. 

 

And I take it, then you can address each zombie in that array by using it's id in the entity array slots then?

  • Upvote 2
Link to comment
Share on other sites

5 hours ago, TheConceptBoy said:

Oh and from this point on, we are loading models and meshes inside the zombie actor class on Attach() right? When we detach, I believe I read somewhere that the engine handles removal of created instances automatically? Models. Sounds, Physics, Shapes? 

The best way is to load them outside of the actor class.  Then you attach the actor to each loaded zombie entity.  If you load them in the Attach function you would have to create a separate object (maybe a pivot) and assign the actor class to that pivot so that the actor functions are called.

Link to comment
Share on other sites

4 hours ago, Lethal Raptor Games said:

The best way is to load them outside of the actor class.  Then you attach the actor to each loaded zombie entity.  If you load them in the Attach function you would have to create a separate object (maybe a pivot) and assign the actor class to that pivot so that the actor functions are called.

Really? I figured the whole deal with using the Actors is that you can just handle all the zombie related stuff IN the actual zombie when it's created... like Load the sounds, load the Model, load the animations, textures, materials and what not - everything related to the zombie. Instead it's like you're but a stone throw away from just doing it with your own class and not using Leadwerks Actor.. The hooks are useful though.

 

I know that you should probably only load up the zombie 3D model once and instance it to all the actors. You really don't need to have 40 spawned zombies ALL load the model right? You can probably just Load the model once in the engine and then have the various zombies use that one loaded mode. Am I thinking this right?

 

Say if I load the Model in the main.cpp, can the zombie actor class access the model variables located in the main file? I know I can set the zombie model when I create the zombies in the main.cpp file, but I'd love to be able to just leave ALL zombie related code in the zombie, including the model assignment. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...