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.

Newcomers DBPro Corner / Help with subtitles please

Author
Message
Levanthus
16
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 1st Sep 2014 18:38
Working on a 3D puzzle game akin to myst in DBPro and i'd like to have subtitles when a character speaks since they speak in a funny dialect and i would like the translation on screen. now i looked through forums and found something about subtitles/scrolling text over 3d using the D3DFunc.dll so i downloaded the sample code but the code will not run saying a variable isn't valid and whatnot so i was just wondering if there is any other way to do it

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 7 GB Ram, Radeon HD 4650, 3.6 TB HDD
Bossley
10
Years of Service
User Offline
Joined: 19th Jul 2009
Location: Germany
Posted: 1st Sep 2014 19:48
Is there any reason why you can't print the subtitle directly on the screen or use sprites?
You have to synchronize the subtitle with the text but that shouldn't be a big problem.
luskos
12
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 1st Sep 2014 23:52
I've seen the demo you talk about.It's working, but you need to replace the offending variable.Maybe it became preserved or something.Just replace it as you see fit and it will work.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 2nd Sep 2014 00:06
You probably want to look at LUA as well...

Derek Darkly
8
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Sep 2014 00:59
I've attached a demo file which shows that you can easily use sprites to make scrolling text.

*You must have the ARIAL BLACK font.

The technique is to print the text to the screen, capture as image and finally make sprite. In this case, I did each line as a separate sprite.

666GO†O666

Attachments

Login to view attachments
luskos
12
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 2nd Sep 2014 18:19
Is this tehnique supposedly faster than drawing the text itself?

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Derek Darkly
8
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Sep 2014 19:52
Quote: "Is this tehnique supposedly faster than drawing the text itself?"


If you mean my example, I'm not sure about the speed.

However, the sprites are created during setup, so all they require is to be pasted to the screen. As you can see I added text shadowing simply by printing one line of text slightly offset over another color before capturing the image.

Another advantage is that we can fade the sprites for a nice smooth effect.

666GO†O666
luskos
12
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 2nd Sep 2014 22:50
Yes i ment your example.I wanted to know because i'm trying to squeze every frame possible.Making fairly simple game that runs 120FPS at best on core i7 and my goal is to make the game available to as many machines as possible, but i can't find any good tips on optimization.And everytime i check if something runs faster than another i make amendmends to the code but still no effect in the game.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Derek Darkly
8
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 3rd Sep 2014 15:26
Quote: "Making fairly simple game that runs 120FPS at best on core i7 and my goal is to make the game available to as many machines as possible"


Just my opinion here, but the human eye only tracks at 60fps, so it seems like overkill to go 120. (Personally I think 30 fps looks fine for any game.) After all, your animations only have so many frames in them, and there are only so many pixels on the screen to cover.

Someone correct me if I'm wrong, but you'd be saving a lot of game speed if you settled for a much lower sync rate.

BMacZero
14
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 3rd Sep 2014 19:06
Quote: "Someone correct me if I'm wrong, but you'd be saving a lot of game speed if you settled for a much lower sync rate."

Setting the frame rate only sets an upper bound on how fast the game will run (how many loops per second). You don't lose anything by setting it higher, and the only thing you gain by setting it lower is you put less load on the user's hardware.

However, most monitors refresh at between 60 and 72 Hz - if your game is running faster than that, you are rendering frames that the user will never even see because the monitor can't display them fast enough.

Derek Darkly
8
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 4th Sep 2014 02:02 Edited at: 4th Sep 2014 02:10
Quote: "the only thing you gain by setting it lower is you put less load on the user's hardware."


Right... I guess my point was, if you set your sync rate to 120 (just for example - not saying luskos wants it that high) and then code your game, all the movements and any non-clock based timing will be reliant on that sync rate to perform correctly.

Since many older machines can't even run at 120 FPS in a blank loop, seems like we are limiting the amount of users who may be able to run the program at the intended speed.

If we set the bar low, say 30 fps, then we open up a wider range of machines that can possibly run it without lag, if there aren't too many polygons on screen or subroutines happening in the loop, of course.

If my thinking is fuzzy, someone shave my brain, plz.

BMacZero
14
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 4th Sep 2014 18:04
You're spot on. However, there are other ways to guarantee the game moves at the same rate regardless of what the frame rate is - commonly, games will measure the number of seconds each frame takes and move things based on that. This lets your game run at the highest frame rate you can get without having to cater to the lowest common denominator, and is a good idea because the frame rate can be fickle anyway (say the user is running some big task in the background).

Example:


The has the added benefit of letting you think about movement in your game in terms of "pixels per second" rather than "pixels per frame", which is difficult to visualize.

Going a bit off-topic, but I hope it's helpful.

luskos
12
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 4th Sep 2014 19:55
I plan to cap it at 60fps anyway, i uncap it only when testing.Can't tell if the code runs well while it's at 60 all the time, it surely runs well for me but my laptop is only 3 years old.

Recently made some optimizations and more are on the way so now the game runs on 270fps without bloom and blur effects.Removing some unnesecery text draws and replacing them with sprites and expecting at least 320fps.Currently the main loop takes 2-3ms.Polygon count is expected to be maximum 320 at any given time.

Originally planned to make so the game runs on netbooks.But the one i have is not capable of this.It's old one, maybe some newer machines could do better.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!

Login to post a reply

Server time is: 2020-01-19 16:26:04
Your offset time is: 2020-01-19 16:26:04