Jump to content
  • entries
    50
  • comments
    173
  • views
    103,235

OOP's I did it again ....


Marleys Ghost

4,514 views

 Share

I started out yesterday morning looking to improve my understanding of types and methods in Blitzmax, and figure out how to use object-oriented programming (OOP) with it. I have only been programming in Blitzmax since the beginning of December last year, and only programming with C++ since the middle of October last year and The Leadwerks Engine since the beginning of October last year. So I am still on a very high learning curve in this regard.

 

As usual, for me, I started out on one thing and ended up on another. I found a link on the old forum for a small tutorial on Object-Oriented Programming in BlitzMax By John Judnich. But by the time I had got to page 6 of 21, I was already off on a tangent and found myself working on a simple NPC type containing a creation method and simple seek behaviour method, after all I was now an expert :) after only 6 pages lol.

 

I had already been "playing" around with some simple AI which showed vague promise, for an Idea for a small project.

 

bugrs.th.png

 

An hour and a few more "tangents" later I had managed to restructure the basic code for NPC creation and basic seek behaviour into an NPC Type using methods. This now allowed the easy creation of an NPC, in this case a rather nifty bug, created by ‘Psionic’, with its walking animation handled by its Lua script on load.

 

 

The test scenes buildings are by GIMPY73 and the Freebeast model is by ‘Psionic’.

 

 

Updated:

Test of Basic NPC creation : Seek : Pursue : Attack Behaviour using OOP in Blitzmax running the Leadwerks Engine. Extra flags added for behaviour to the NPC Type with extra methods to communicate with the NPC model's Lua scripts for animation control. Although I did manage to hardcode a typo in the "Pursuit" flag.

 

Of course this basic AI is nothing like the calibre of AI work being done by Chris Paulson or Pixel Perfect, but I had to start somewhere and this seemed the best place, so far I am pleased with my meagre results.

 

I recall Josh showing interest in integrating Recast into the editor, this would truly be a useful addition. Leadwerks could really use an integrated AI starting point. Thats not a complaint just an observation. ;) Recast integrated into the engine and editor could be that starting point.

 Share

14 Comments


Recommended Comments

Hi Chris, sure I'll give it a shot, basically each NPC is autonomous to the extent of simple collision avoidance a raycast left-forward and right-forward takes care of that. But then the NPC's would just scurry off into the "sunset" eventually. So a third raycast is made for distance to player to act as an anchor, if the NPC is too far away from the player then a course correction back in the general direction of the player is made. There is also a LOS made, if true then that's the heading the NPC will take. It took a lot of tweaking value wise, but turned out better than I thought. Still a WIP but one of the main objectives was to keep the code to a bare min.

Link to comment
@Franck : Thanks .. yes Recast integration would be good

 

 

I guess if you've seen all my previous posts you'd not be shocked if I agreed strongly with this one.

 

If recast (or any other navmesh/pathfinding) was integrated in everyone would have a really big head start on doing AI. We would then we would start seeing real graphics with moving pictures, instead of lots of nice oil paintings.

 

It's a shame that I'm not a blitz/C++/Lua integration wiz else I'd do it tomorrow. It just needs the right person to find the time and it could be done.

 

Trouble is it's not sexy like all the other graphical fluff...

Link to comment

Thanks for your answer Chris, im agree with you, i think that AI programming can be very insteresting and once recast will be in engine we will see a lot of things moving on the screen :)

 

I have a request for you, as i said in private message, it would be good if you were doing a special project to show a simple recast demo (moving a cube trought a path generated with recast for example) in LW engine in c++ :) a small visual c++ project would be excellent.

Link to comment

Great Vid MG :)

 

And thanks for the link to the BlitzMax OOP tutorial.

 

Ive had BlitzMax on my comp for years and still don't know how to use it fully lol

 

Oh i don't think much of the building in the video ( lol ) , but the main character looks great . did you model it yourself ??? :)

Link to comment

I guess if you've seen all my previous posts you'd not be shocked if I agreed strongly with this one.

 

Not shocked at all Chris :)

 

If recast (or any other navmesh/pathfinding) was integrated in everyone would have a really big head start on doing AI. We would then we would start seeing real graphics with moving pictures, instead of lots of nice oil paintings.

 

Yes it certainly would be a really big head start, a good selling point to for the engine. Whilst I do enjoy the great "still life" being generated, gameplay mechanics need a boost too, especially in the AI dept. Even as a "plugin" thats chargable. Torque do a Universal AI plugin for ~$40 its not "Fantastically Awesome" but something like recast/detour integrated into LE would go a long way to being the foundation for great AI in LE, and get some of these great scenes and wonderful characters being created by the community moving.

 

It's a shame that I'm not a blitz/C++/Lua integration wiz else I'd do it tomorrow. It just needs the right person to find the time and it could be done.

 

I'd love to help but you have already read my programming resume lol

Link to comment

@ Pixel : Thanks, yes I am a fan of K.I.S.S. but only because I can't do the complex stuff :) but you are right sometimes in certain situations a simple solution can work. This will, I think work for the small project I have in mind and was initially coded for, but would be probably unsuitable anywhere else I feel. Hence it would be nice to get something like Recast/Detour integrated into LE and the editor.

Link to comment
Guest
Add a comment...

×   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.

×
×
  • Create New...