Scripts / A question for Amen Moses

Author
Message
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 6th Dec 2017 22:46 Edited at: 6th Dec 2017 22:47
lol Hey m8 this spung to mind while i was re writing some scripts for vcity you know we have Text or TextColour, now heres the question using your quarts or similar could we actually attach them to a character e.g like a bubble text? or is there a way to do this as in GG atm all we can do it text to a part of the screen or use a prompt most modern games have bubble text which appears above the character thats talking? just a thought and i know this maybe your kind of bag cheers m8
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Dec 2017 23:38
Well Lee has added a Prompt3D command but it seems very limited at the moment:



Not sure if he will add to this so we can change the text size/colour or have more than a single line etc. It would be easy enough to display the text in front of a speech bubble, you would need to create some 3d entities, just a flat plane should do it.

Here is the script if you want to play around with it.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Dec 2017 23:48
If you wanted a more professional looking speech bubble you could just make them as 3d entities with the text in the texture and pop them up at the appropriate time in the game. Would be expensive on memory though unless you did them as decals I suppose. If you did it this way then you could control the scale of them depending in how far away the player is as well.

You would need one decal per 'speech' and enough 'bubble' entities to fit them all in, at run time simply display the appropriate size of 'bubble' rotated to the players view and place the appropriate decal in front of it then 'Show' both of them. Once done simply 'Hide' them.

If you had say 20 characters each with 4 different speeches you would need 80 decals and probably about 10 'bubble' entities of different shapes to fit the speeches sensibly.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 7th Dec 2017 12:09 Edited at: 7th Dec 2017 13:35
Thanks m8 will have a play with that didnt see we had that command will try it with colours see if it will work think as long as its at the character and not at the prompt location might just look right. Oh i see that displays whats in the name field and uses a prompt so can this not use the
function TextColor(x,y,size,txt,r,g,b) command here say for e.g red text?
hmm or maybe i can just switch scripts when the player gets closer..the decals idea sound interesting

What I'm trying to do here is e.g the player approaches a character in this case the bounty removal imp and he will have a short convo and remove the players bounty. Problem is the text is not displayed at the imp atm just on the bottom of the screen which kinda looks abit cheap and nasty and would be much better if possible above his head.

Heres what i have : ( I just dont understand the angles thing atm trying to get my head around it) changing it to a colour im cool with re: pic








and with a decal kinda like that

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Dec 2017 19:25 Edited at: 7th Dec 2017 21:34
If you can create decals like that for the 'speech' parts and a 'bubble' entity to go behind it I'll write the scripts for you to marry the two together and position them above the character.

Something like this:

Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 7th Dec 2017 22:45 Edited at: 7th Dec 2017 22:47
righty ok m8 will have a bash at those tomorrow and post them when done ty once i have an intitial script to work with i think im cool to edit it for the rest.
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 01:27 Edited at: 8th Dec 2017 11:00
Do all your characters have separate scripts or do you have one generic character script? I'm thinking of having a single Lua call that a character script could make that registers a list of 'speech' names and 'bubble' names which match the entity names for the decals. Then you can simply call a 'ShowSpeech'Bubble command with the list index to display the appropriate bubble.

For example in your character script have:

local speeches = { {'speech1','bigbubble'},{'speech2','mediumbubble'}}

... first time processing, for example when character spawns
SpeechBubbleRegister(e, speeches)

... later in script

SpeechBubbleShow(e, 1)

... bit later

SpeechBubbleShow(e, 2)

You would call this each frame, as soon as you stop calling it the bubble would stop being displayed.

Does that sound sensible? (a simpler version of this is what I show in the video)
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 12:50 Edited at: 8th Dec 2017 12:53
Think there are 3 types shops, general convo (intro scripts) and the bounty removal Ive included 1 of each type in the zip also all the new bubble decals for the bounty removal script Ive gone with a basic static type decal for the bubbles as the animated ones danced around too much. Yes the more simple the better m8 that way it would be easier for me to edit for the other scripts still working on making them abit brighter as they came out abit dark in the editor will maybe need to add an I_dds.
P.s all the decals are numbered to corrispond with the line number in the bounty removal script
Cheers

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 12:53
Here is a video of the ideas I had above in action:



I'll try it out with your decals later.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 12:55
lol wicked
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 13:24 Edited at: 8th Dec 2017 13:25
Ok so a bit of miscommunication somewhere along the line.

You have the speech bubbles as decals whereas I was assuming you wanted the speech bubbles to be a 3d shape and the speech text would be decals overlaying it. That way you could have a restricted number of 'bubbles' that all characters could share but lots of different speech parts that that could all have different fonts and colours and sizes etc. As decals are very cheap performance wise (especially non-animated ones) but look rather naff on their own, you could make it look very professional that way as the 'bubble' part could be textured and have a normal map and real 3d borders and all that flash stuff (even metallic PBR type stuff now!) but as you would only need a few of them to suit different texts it would overall be very cheap on memory usage and performance.

I envisaged a long thin bubble, short fat one, tall skinny one, a cloud style sort of 'dreamy' one etc .. which you could use to hint at different personality types for the characters, if you get my meaning.

I can dumb down the scripts to use the simpler decal only style if you wish but it wouldn't look as good I reckon.

Btw is it easy to make plain decals, i.e. just with text only, in a variety of font styles and colours? Something anyone could knock up in gimp or paint.net?

If so you could put a set of just the bubbles themselves on the store, maybe in different styles to suit different game types and have a tutorial on here somewhere showing people how to make the text part for themselves.

I was going to propose an idea to Lee for generating decals on the fly from within Lua by redirecting sprite/text output to an internally generated texture and then painting that onto a 3d object like a wall or plane but GG doesn't currently have different fonts (or at least the font selection system it inherited no longer works) or built in 2d rendering primatives so it would be very limited to begin with. Using decals may be a far easier and cheaper way of doing it.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 14:20 Edited at: 8th Dec 2017 14:59
OK just bubbles without text np, yeah they are pretty easy to rattle up m8 just draw them out in paint.net or whatever make the outside transparrent and just edit the fpe's in that zip to match oh copy one out as a .bmp for the icon and your done. yeah tis a shame about fonts i'll do a couple seperate for you to play with.
Heres a few plain untextured bubbles let me know how you would like them changing



and some random text statments for these open a new paint.net doc or whatever you use, select all and delete to make the page transparrent then just write on your text. as before whatever name you give it must match in the fpe and the decal .x.dbo needs to be present in the folder

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 17:24


Lua scripts attached so you can see how they work but I still need to tweak a few things, like positioning the bubbles off to the side of the character.

The bubble decals don't display very well, I know there are issues with decals in the preview version so I assume it's because of that.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 17:36
Very cool ty will play around with them see what i can come up with Cheers
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 19:03 Edited at: 8th Dec 2017 19:54
Tweaked:



I'll let you adapt your scripts to use this, if I did it I wouldn't be able to resist completely re-writing them.

As you've probably realised, I renamed some of the entities for use with the scripts. The names don't matter but you must follow the following rules:

1) Only one bubble or speech decal of a particular name can be present.
2) Multiple characters can use the same named entity but not at the same time.
3) This means that, as it stands, you can only safely have one character 'speaking' at a time, if you had two and they tried to access the same named entity I'm not sure what will happen! (probably a lot of flickering at least)
4) Currently each character would have to have their own script but that's probably how you would want to use it anyhow.

I could expand on this quite a lot to remove these limitations and could go crazy with it to be honest but I think simplest is best until you feel you need more functionality.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 19:31 Edited at: 8th Dec 2017 19:40
right ok m8 ty will toy around with them thanks for that oh ps the what script go on what lol i know it sounds dumb but that way i get it right first time
Tbh these could prove really useful in alot of games done right, give a real game feel cheers m8
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 19:53 Edited at: 8th Dec 2017 20:14
The bubbles.lua script goes on the speech bubbles, set it always active, physics off.
The speeches.lua script goes on the text decals, set it always active, physics off. (probably easiest to set this in the .fpe file!)

Scale the bubbles in the editor so they look right placed next to the character, then scale the text decal so that the text fits nicely in the bubble.

** Make sure you name the entities different names! **

Copy the code from the ai_neutral_sb.lua script as you need it into your character scripts, basically you need to set a 'speeches' list similar to the one there, in which you specify which bubble to use (by name) and which text decal (by name) to put in it plus the offset values to make them appear in the correct place (this will be trial and error but once you've done it a few times you'll get a feel for how much to tweak the values by. The rows in the list are the 'speeches' that the character can make which are specified by number, i.e. first entry is 1, second 2 etc.

The SpeechBubbleRegister command simply links the characters entity_id with the list, after that whenever you want a speech bubble simply call SpeechBubbleShow(e, number) where 'e' is the entity_id of the character and 'number' is the 'speeches' list entry you want to use. Remember that the call must be made every frame, as soon as you stop calling it the bubble will disappear. The reason for this is that the speech bubble needs to be moved to respond to player movements so it is always readable (as long as you are looking in the direction of the character of course! ).

You don't have to make the call from the characters script btw, you could have a central script controlling which character is speaking, in fact if you had two characters having a conversation it may be easier to do it that way, just remember that the 'e' value must be the one for the character doing the talking and not the entity_id of the trigger object.

You will notice that in the example code in ai_neutralSB.lua I control the action with time values and leave a short gap between speech bubbles, I recommend doing something similar; 1) because it reduces the chances of two characters trying to use the same speech entities, and 2) it's more natural, people usually try to avoid speaking over each other (unless having an argument) so another way you can give 'personality' to characters and create more depth to the game is have different characters pause for different lengths of time or have the speech bubbles 'time-out' at different rates for different characters.
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 21:37 Edited at: 8th Dec 2017 21:39
K get it now thanks would be seriously cool if we could run these on multiplayer
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 21:49
It would be nice to be able to run ANY scripts on multiplayer!

I think for this to become reality we would need several 'Lees', maybe he could be cloned? Nah, can't see him giving up his black helmet for a white one anytime soon.



Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2017 21:55
Btw the weird visuals on the decals went away when I chose the entity shader 'medium' option in the tab-tab menu.

Do decal textures have a prescribed size? Your text.dds files have an awful lot of empty space! Couldn't they be cropped to the text?
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Dec 2017 23:20 Edited at: 8th Dec 2017 23:23
hmm Lee clone *goes to his lab* hmm i wonder if the imp dna would be suitable rofl scripts on multiplayer = local server!!!!!!!!!!!!!!!!! meh Think ive just cracked Vcity dx11 testing now yay can release this for xmas....well funny
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
warlock12
8
Years of Service
User Offline
Joined: 12th Sep 2016
Location: Argentina
Posted: 9th Dec 2017 22:40
Wow !!!! a very very very creative thread!
The game is a serious thing (El juego es una cosa seria)

Login to post a reply

Server time is: 2024-12-23 00:12:26
Your offset time is: 2024-12-23 00:12:26