Jump to content

  • Log In with Google      Sign In   
  • Create Account


Creating a Text Field for in-game dialogs as in WoW (AS3.0)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 JETeran   Members   -  Reputation: 275

Like
0Likes
Like

Posted 01 August 2012 - 07:11 PM

Hi everybody, it's good to be here.

I'm trying to make a small game that has some good dialogs, some of them are speaked by the main character and some others by NPC.

So I thought I can make a text field very similar to the one used in World of Warcraft, where texts are display in different colors and keeps adding as character talks.

Posted Image
In this case, text is displayed in the right-corner of the game.

Is there a good way to do this? I'm not looking to do something complex. Just an area that keeps tracks of all the dialogs said during the game.

I'm totally new to AS3 but I'm a fast learner. I'm reading/studing right now the Rozensweigh's book.

Thank you SO MUCH for your time. It's good to be back around gamedev.net !!

JET

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account


Sponsor:

#2 prototypical   Members   -  Reputation: 301

Like
3Likes
Like

Posted 02 August 2012 - 02:12 PM

Obviously, a TextField gets populated with a string text. Are you asking how to color the text ?

In this particular case, I'd suggest that you use the htmlText functionality of a TextField. This would also require some coding to prepare the string appropriately with tags etc.

An example of doing so can be found here : http://www.ilike2fla...our-in-as3.html

Edited by prototypical, 02 August 2012 - 02:13 PM.


#3 JETeran   Members   -  Reputation: 275

Like
0Likes
Like

Posted 02 August 2012 - 06:49 PM

Hey prototypical thanks so much for your response.

About coloring the text, the idea you gave me plus the example helps me a lot, thank you.

My other concern is about the Text Field. How can I add strings that goes one behind the next? and the old ones be pushed up?

I will try to do it by myself, but if you have any idea, it's very welcome.

Thank so much for your time prototypical !!

JET

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account


#4 greenvertex   Members   -  Reputation: 510

Like
1Likes
Like

Posted 02 August 2012 - 06:59 PM

You might want to use a (FIFO) queue of TextFields to get that effect. Push new ones to the end of the queue, test whether or not the oldest draws outside the top of your text box (of so, dequeue it), and render them from oldest to youngest.

#5 JETeran   Members   -  Reputation: 275

Like
0Likes
Like

Posted 06 August 2012 - 06:48 PM

Good to know greenvertex, thanks so much for your response.

BTW, do you know any good tutorial or guide that can teach me about the FIFO queue? I know what FIFO means but I don't think I know how to use it in the AS3, any ideas?

Thanks once again !!

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account


#6 prototypical   Members   -  Reputation: 301

Like
1Likes
Like

Posted 07 August 2012 - 12:59 PM

I don't know that I would have a queue of textfields. I would probably have just one textfield sized to the dimensions of the chat window and just update that with a generated HTML text string each time an update is needed. The source data might be stored in a queue/list/array. But before you even get to that, you need to think about what kind of data you are storing, and how it will be used.

I assume that you'll be storing what someone chats, and possibly other notifications as well. The type of message will most likely determine the color of the text. right ?

There are multiple ways you might approach this. One might be a simple array that stores strings. Each string would be an html encoded version of the text, with the appropriate formatting for color/font/bold.

But even with that approach, you might have to consider what other requirements your chat widget might have. For instance... What if it needs to filter messages ? Like you might have the ability to only see a certain kind of notification/message based on a criteria that might or might not even be "custom" based on user preferences.

You can see how that design aspect might completely change the data and the way you handle the data, to facilitate only displaying the ones desired. Because now you need to be able to make logical decisions and it might not be enough to just store a string, but you might also need to store other data defining the purpose of the string (chat message, notfication, npc message etc)

I say all this, because as you will learn, sometimes just deciding to do something by perceived steps without evaluating the full scope of your design goal... can lead to alot of extra work in redesigning to facilitate new functionality you introduce.

In terms of learning, I'd not focus on just FIFO. I'd suggest that you explore arrays/list to start and then move to different methodology in organizing them etc.

You can google "Arrays AS3 Tutorial" and maybe "FIFO AS3 Tutorial" to search for resources.

As a note, I think that these forums are of great use for specific issues, but am not a fan of threads where you have a goal of creating a widget and go through the step by step development and all it entails in a single thread. So I'd suggest that you post topics that are not so broad, and focus on the specific issue at hand. ie -- FIFO. That way someone looking for information on FIFO in these forums is likely to find a useful discussion on that topic with any answers someone might give on that topic (links to tutorials ect) and not the development of a chat dialog widget.

In my opinion, the topic of this thread has been resolved as it has given information on how to create a textfield with color formatting, a general suggestion as to using a queue for storing the data, and a note about the importance of design in what approach you might choose with a widget like this.

Hope that doesn't come across as rude! Posted Image Good Luck my friend.

Edited by prototypical, 07 August 2012 - 01:14 PM.


#7 JETeran   Members   -  Reputation: 275

Like
0Likes
Like

Posted 07 August 2012 - 02:53 PM

Hey prototypical, thanks so much for your explanation, and NO OFFENSE TAKEN !!

Yes sorry about not specifying the subject; I just was looking a general guide to approach it.

But awesome !! What you told me makes more sense to mee, I will keep working on it and when I get, I will post it here ;)

Thanks once again prototypical !!!

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS