Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Open MMORPG Project's Autonomous Source Code Snippets (DBPro 5.9)

Author
Message
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 7th Jun 2006 11:02
Like the Skills code, these code snippets are independent codes that can provide functionality to various game projects (specifically designed for RPG's). Each one includes a demo as well. Rem out or delete the demo before using. These are all Open Source and available for anyone to use. I will be using this thread to post more code (instead of creating new threads for each snippet).
==============================================

Player Text Buffer: Control the speed of your output text to the player using these usefull functions. Includes a safety feature that prevents immediately duplicated messages from being entered into the buffer.



==============================================

Object Buttons: Take the concept of 2D buttons and apply it to 3D objects and you have object buttons. This self contained system allows you to assign an object as a Button Object, giving it a unique index value, a specific "Return Value" (which is usefull for categorizing), a Name, and and activation range. This code manages when the object is in range, when the mouse is over a specific Object Button, or can return which Object Button the mouse is over. It also manages depth priority (closer objects have priority over distant objects). If an object is behind another button object, it will not 'register'. Or if the object is too far away, it will not register. The demo demonstrates all the functionality. Rem out or delete the demo before using the code.



==============================================

Feedback is appreciated. Let's me know if I should post more.
Enjoy.


Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 7th Jun 2006 11:25
Ever find it difficult to keep track of who is attacking who, who is targeting who, and who is mad at who? This Combat Targeting system handles all that tracking for you. It manages Simple Targeting, Combat Targeting, and Aggro against various targets. Being autonomous, it is simple to add into any game. It can use Object ID's or any index/reference values you want (just keep it consistant). The demo shows adding several combat targets, then what happens if one of those targets is eliminated. It also demonstrates how aggro is handled is cumilative.

The output is text for demo purposes. In a game, you would use the results to help your AI determine what to do.





Open MMORPG: It's your game!
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 7th Jun 2006 13:26 Edited at: 7th Jun 2006 13:27
if you can add a function to the text buffer thingy to be shown in a box and scroll the messages up or down when the messages shown on screen are more than the text box' capacity, that will be handy.
Should be a simple task.
More important is how you handle the continuous input of more than 1 players in a loop with the add text function, how you do that?
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 7th Jun 2006 19:41
Quote: "if you can add a function to the text buffer thingy to be shown in a box and scroll the messages up or down when the messages shown on screen are more than the text box' capacity, that will be handy."

The text box is another autonomous function that we have, I just wanted to look it over and "clean it up" (if needed) before posting it here. I will take care of that soon. Also want to keep it seperate so folks can choose the output format they want. This functionality simply manages the text.

Quote: "More important is how you handle the continuous input of more than 1 players in a loop with the add text function, how you do that?"

These functions were designed with single player in mind, but here is a modified version that will accomidate multiple players. Just inlcude the Player ID (integer value) in the function calls. I also added some functionality to create an array of all players in the list (named BufferPlayerList()).

And last, but not least, I changed the delay to be timer based, so the text print out is consistant at any speed.



Thanks for the feedback - it is appreciated.


Open MMORPG: It's your game!
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 13th Jun 2006 17:53
@RiiDii-
Hey, the player text buffer code is great. Once again, ready made code has fallen into my lap.

Of course, I've changed a lot of the way it does business to make it dependent on my 3D environment, but the core is just great.

What should appear in the credits?


Come see the WIP!
Kenjar
19
Years of Service
User Offline
Joined: 17th Jun 2005
Location: TGC
Posted: 13th Jun 2006 18:16
Just mention the projects name and RiiDii's name, as he's basically doing all the code work right now.

Your signature has been erased by a mod because it's larger than 600x120...
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 14th Jun 2006 10:14
Thanks Cash (and Kenjar). I suppose technically nothing has to appear in the credits, but I certainly would appreciate a plug for the OMMORPG project (and me too ).


Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 24th Jul 2006 21:40
Here's a nifty little function for the mouse. I find it useful sometimes to only get an immediate click of the mouse. Of course, since the return is the first click of the mouse, we want to make sure the results are returned for that function call and the mouse click; and more importantly, that the next function call (not just the next sync cycle) is not influenced by the prior function call.

For example:

This would work okay:

Do
Print Single_MouseClick()
Loop

But this would not:
Do
Print Single_MouseClick()
Print Single_MouseClick()
Loop

Because the second call would never print a 1 (unless you happened to click during the few milliseconds between the function calls).

The solution is to provide a key code to the function so the function does not confuse function calls.

See the example and the code for more information.

As a bonus; there is a pretty funky, but completely useful, way of dimensioning an array in a function if you don't know if the array has already been dimensioned, or how large it is.




Open MMORPG: It's your game!
ZeroEon
18
Years of Service
User Offline
Joined: 5th Aug 2006
Location: Everywhere But Nowhere
Posted: 5th Aug 2006 17:34
Great Snippet Thanks For The Combat Targetting System

They Cant Change What You See and What You Hear But They Can Change What You Saw And What You Heard

There Are 10 Types Of People Those Get Binary And Those Who Dont
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 28th Aug 2006 17:23
Here's a simple one, but usefull. Instead of writing multiple timer countdown functions throughout one's code, simply use this Egg_Timer() function. Simply provide a unique identifier (ID) and the timer setting (Setting). When the Egg_Timer() reaches 0, it returns a value of 1 and the timer is reset, otherwise a value 0 is returned. You can have as many timers as needed; a new egg timer is created for each unique identifier.




Open MMORPG: It's your game!
Diablo 3D
19
Years of Service
User Offline
Joined: 23rd May 2005
Location:
Posted: 4th Sep 2006 14:12 Edited at: 4th Sep 2006 14:17
Just a quick question, i know I posted this question somewhere else before, but god knows where! How do you disguise digits when you enter say a password in DBP? I know how to enter strings, but converting it to display * instead of the characters... HOW DO YOU DO THAT? Also, how do you get it so that if you press Backspace, it removes the last digit of the string, and if you press enter, it doesn't add the ASCII value of enter to the string... :S BTW, I'm using the Entry$ Command to enter text, rather than Input lol
Jack LOL
18
Years of Service
User Offline
Joined: 4th Aug 2006
Location: Near the CPU Close to the graphic card
Posted: 4th Sep 2006 21:39
Well u need a text system for that, the backspace thing is kinda easy, what u have to do is something like that:



this will delete 2 chars from the end of the line, u can make it to delete 1 4 or 50, just change the 2 when calling the function,
never tested but it should definitely work.

for the enter thing just do:



hope i helped

(forgive my english) lol?! xD
Diablo 3D
19
Years of Service
User Offline
Joined: 23rd May 2005
Location:
Posted: 4th Sep 2006 22:52
Damn! It didn't work. It either freezes my app, or doesn't do anything, depending on how random DBP chooses to be... I tried in DPC on a fresh app and in DBP in a new app and I got the same results, or it had a heart attack when it declared a funtion. Thanks for you help tho dude, very appreciated
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 5th Sep 2006 08:05
RooMilne: Just a few points of forum ediquette:

1) This is the wrong board for questions like that. You should have posted over in the DBPro Discussion board. This board is for snippets. Comments or questions about those snippets are welcome and encouraged.
2) Your question is not related to any of the snippets posted in this thread. This is commonly referred to as hijacking a thread, and is very rude. You are free to start your own threads for your own topics, so there is absolutely no reason for this behavior. If you continue to do this, someone may report you for abuse on the forums.


Open MMORPG: It's your game!
Diablo 3D
19
Years of Service
User Offline
Joined: 23rd May 2005
Location:
Posted: 5th Sep 2006 10:32
Hey hey, hold your horses, your thread was about source code, and there was something in there about text, and I simply asked a question about the text code. There was something I wanted to know, which I can't find anywhere, and seeing as this was the most relavent bit of information I could find, I posted it here. And seeing as you are a well known member of TGC community, I simply figured you might be able to help me. Obviously I was wrong. I appologise for being mistaken about this thread
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 6th Sep 2006 01:23
Think about how many other threads posted "something in there about text" and how really relevent your question was to the snippets code posted.

I am only offerring you some insight on forum ediquette; that seems to me to be the help you are truly in need of. I regularly look through the DBPro Discussions to see if there is anything I can help with there. But right now, I am very busy with work, school, and our RPG project, so my time is limited. Regardless if I would help or not, this was simply not the correct place to post your question.

Please do not reply to this post. If you have any other comments for me, please direct them to my email address. If you would like assistance with your previous request, please post that in the correct place, and I will be quite happy to help.


Open MMORPG: It's your game!

Login to post a reply

Server time is: 2024-11-23 03:37:04
Your offset time is: 2024-11-23 03:37:04