Scripts / New library script to play with : Sprite based text library.

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Jun 2018 22:48
So I've been tinkering with this for a while and think it's ready for people to play with and hopefully to get some feedback from.

Instructions:
1) Unzip the test_fonts into the scriptbank\images folder.
2) Put the textlib.lua and text_test.lua scripts in scriptbank folder.
3) Attach text_test.lua script to an always active entity.
4) Enjoy!

The text_test.lua script shows how to use the commands, the test_fonts folder contains two sprites sets to play with and the textlib.lua has headers on the user callable functions explaining what they do.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
JPH-GAMES
3D Media Maker
9
Years of Service
User Offline
Joined: 13th Feb 2015
Location: Belgique
Posted: 27th Jun 2018 23:32
Very good work, works great on my PC, big thank you for your work of great value ,

Intel Pentium CPU G3220 3.000 GHz , 8 GB Ram , NVIDIA GeForce GTX 745 2GB , Windows 10 64-bit.
GameGuru , S2Engine HD , Shoot EM Up , CopperCube 5 , Clicteam Fusion 2.5 , Platfinity .
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 28th Jun 2018 08:52
Wow, this is fantastic. Thank You
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth, Roland D05 Synth Module, Bluedio Victory V Headphones, AKG K141 Studio Headphones, Lenovo Ideapad, with Windows 10 64bit, 8Gb Ram and AMD A10 7th Gen Graphics.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Jun 2018 09:33 Edited at: 28th Jun 2018 09:41
Word of warning, make sure the call to display a new text string only happens once *not* per frame, in my script I check to see if the text identifier is nil before the call to ensure it only happens once. Also make sure to call the delete function when the text is done with.

If you start to see a drop in frame rate then the most likely cause is a repetitive call to create text as under the covers that will keep generating new character sprites and will eventually cause a crash when the sprite storage is full.

If you want to practice making your own sprites here are a couple different raw 'fonts' to play with.

You need to work out the best height for the characters then chop up the font image into separate pngs for each character you want to use. You don't need to use all of the characters btw, if you were creating a numerical display for example you would only need the numbers.

Make sure to make all the images the same height and that the characters are correctly positioned within the image, i.e. such that when placed side by side the characters line up properly. Then make the images as narrow as possible whilst still having a small margin around the outside and 'clean up' the images (depending on how you sliced them up you may have parts of adjoining characters along the edges).

I bet someone out there with some high end graphics package like PS and the skills to use it would find this a doddle but it took me hours for the first two 'fonts'.

Edited to add:
The rather ugly looking method of registering the sprites with the ['a']= LoadImage("<path>\\<file name>.png") part is important and shouldn't be changed by for example putting the path in a separate string and doing LoadImage( path .. "a.png" ) or anything similar otherwise you'll find you can't make a standalone!
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Jun 2018 14:09
like the messy/creepy looking font, i bet that would look nice for a horror game in blood red with some blood drips
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
tdreisinger
6
Years of Service
User Offline
Joined: 23rd Jan 2018
Location: Indiana
Posted: 28th Jun 2018 14:26
Thank you Amen! Greatly appreciated it
Timothy D. Reisinger
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Jun 2018 17:19
@smallg: I didn't *make* the font, it is just one that happened to be on a computer that I was using as are the others. All I did was created a text box in an artsy app, probably Gimp, maybe paint, type away and then export as png. Weird thing about Fonts is that every machine I use seems to have a different collection of the darn things and I have no idea where they came from!

So bearing all that in mind I don't think you could legally sell these sprite sets. I'm no lawyer though.

I imagine that particular font would not look good at different sizes, the simpler the shapes the better they work when scaled, I'm thinking that one would look a right mess in some screen formats too.
Been there, done that, got all the T-Shirts!
PM
Peri
Game Guru Backer
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 29th Jun 2018 13:02
Thanks!!
devlin
10
Years of Service
User Offline
Joined: 12th Feb 2014
Location:
Posted: 30th Jun 2018 06:12
thank you
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Jun 2018 12:12
Just to clarify, by 'feedback' I mean suggested additions or improvements, any problems you have trying to use it, questions about how to use it for more complex things, e.g. if you want to display the ammo count with it instead of the default and can't figure out how to do it yourself.

I intend to push this to GitHub when I'm satisfied that it is 'user-ready' but it's hard to judge that without some more detailed user feedback.
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: 1st Jul 2018 18:58 Edited at: 1st Jul 2018 19:00


Added a 'background' parameter for text boxes and also added a demo of the 'depth' setting.

Oh and have another font to play with, this one is the one I originally used in the LEM demo where I used it for the quest givers. It is supposed to be an LCD style font, hence the background colour.
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: 18th Jul 2018 19:07
Bumping this as I'll be adding a couple of 'fonts' to this thread soon(ish). In the meantime I've attached the images for those who want to chop them up themselves.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
granada
Forum Support
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 18th Jul 2018 21:21
Fantastic AmenMoses,I don’t comevthis way much as code gives me a headache ,but this is great thank you

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 20th Jul 2018 15:51 Edited at: 20th Jul 2018 15:51
New 'Font' all chopped up and ready for use. The blue one from the previous post. When I've recovered my soul enough to do the other one I'll post that too.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 22nd Jul 2018 21:31
Thanks, AM. You are a jewel to GG.
Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Jul 2018 23:58
Nice stuff. I remember doing similar things in DB and of course GG for a 2D shooter I made. Reminds me of the AGK font system which works nicely A way to add new fonts is a great addition to GG in general. Might be I can convert some AGK fonts I have to GG I'm busy resurrecting an old game (I'm loving the new update) but if I get chance will have a play.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Login to post a reply

Server time is: 2024-04-19 20:07:27
Your offset time is: 2024-04-19 20:07:27