Screen Recorder

#1

We have released a screen recorder extension on our GitHub page. The extension was originally developed by @sergey.lerg, with some modifications from the Defold team.

One of the key features of this extension is the ability to save just last N seconds of the gameplay. The extension maintains a circular buffer for encoded data and saves it when requested. On Android, macOS, Linux, Windows and HTML5 the circular encoder stores it’s data in memory, on iOS the circular encoder saves to temporary video files and then joins them together to produce desired duration.

Audio capture is not implemented, however the extension provides a function to mux a prepared audio file with the captured video.

24 Likes

#2

this is great! thanks a lot

2 Likes

#3

I read somewhere that too much good things a day is harmful for health :grin:
just joking, impressive extension. thanks a lot for developing this for us @sergey.lerg and the Defgang :fire:

3 Likes

#4

This sounds like it would be really useful for allowing users to share cool moments / the last few moments alive to social media!

0 Likes

#5

Yes, that how Blastlands uses it. I think @andreas.strangequest could tell more about it.

2 Likes

#6

Yes, we use it to produce “highlights” of the teammatch gameplay. For our implementation that required that we saved (or fetched) the whole teammatch data (how people were running, shooting, explosions, yes the whole match essentially), valued and balanced what happened and picked out 3 “most exciting” time ranges and replayed them in the client while recording it with the extension.
So for our usecase we had to replay it/“force” the player to watch the replay before we could let the player send the clip to friends or social media.

3 Likes

#7

I haven’t tried it but it seems like you’d be able to render multiple frames per renderscript update by setting a render target and repeatedly calling clear() and draw(). @britzl Is there a way to force an update tick with a supplied deltatime? If so it would be possible to record replays without forcing the user to rewatch them. Rough pseudocode:

render.set_render_target("replay_render_texture")
render.clear()
render.draw("everything")
add_frame_to_video()
replay_timer = 0
delta_time = 1/60
while (replay_timer < replay_length)
	game.update(delta_time)      -- is this possible?
	render.clear()
	render.draw("everything")
	add_frame_to_video()
end
save_video()
0 Likes

#8

I believe that wouldnt be possible today. Also just taking our game as an example, our game was struggling keeping the 60fps on many devices so in best case for a 30 fps movie it would be recording in half the time it would take to watch it (30 sec clip would render for 15 sec without watching). That would still be a very bad user experiencing looking at some “wait” screen while it was processing so for us it was the best decision anyway.

1 Like

#9

I’ve also been thinking about saving replays from my game, which is an extremely low resolution pixel art game with no post-processing. I should be able to render dozens if not hundreds of replay frames per screen frame while ticking up a visible progress bar. But I’d need a way to trigger the update functions and message passing of the gameplay objects to simulate the replay in the background.

0 Likes