Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 1
themars2011

Theater mode?

Question

Hey guys,

 

I've been thinking about adding a theater mode to my game so you can record gameplays and view them afterwards, from all perspectives and that.

 

So now I need to figure out a good way to save them. Saving everything and storing it in the memory (at 10 ticks/s) would certainly not be a good idea.

It would be really awesome to hear your ideas on this topic. How would I effectively record all necessary information and save it to the hdd without using a ton of memory?

 

Thanks in advance

Share this post


Link to post
Share on other sites

17 answers to this question

Recommended Posts


  • 0
Please login or register to see this quote.

 

That doesn't make a single difference. All needed information has to be saved. I do not want to save movies, just files that can be played back in game, the question if how to do it efficiently

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

Thank you but I don't think I could use that since I would have to create something similar that reads everything Photon Bolt is receiving which is not possible for me :/

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

Thanks but as I said above, I do not want to record a video but a demo file that can be played back in game so you can do trailers, montages etc with it

Share this post


Link to post
Share on other sites
  • 0

Lol sounds like not many people understand that your not recording a movie. As I understand your wanting a blackops style theatre model with free camera mode correct? Here would be my approach:

 

I would create a a couple different state enums and stuff like position rotation and velocity (for animations), most likely you already have, and package it locally in a class, then pass it to the host at game end or lobby leaving and the host passes all the player data to the database at the end of the match.

 

there is tons of ways to do it, but the main approach, for speed sake, is to store your own data locally and pass it once when the lobby ends or player leaves. That way your not wasting bandwidth

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

Wanted to do the local recording anyway to not waste precious processing power on the servers themselves but how do I efficiently save it? In theory I could all save it in memory but that would be a huge waste. Would a StreamWriter that runs besides the game work or perhaps it would take too much speed? Never done something like this

Share this post


Link to post
Share on other sites
  • 0

Only use arrays of standard objects such as int, float, double, Boolean, string, etc.. no vectors or special classes (well outside of the class that is storing that data, but it only needs created once). That way you can save on instances. It would be something like this:

 

var pX : float[];

var pY : float[];

var pZ : float[];

 

var rX : float[];

var rY : float[];

var rZ : float[];

 

var vX : float[];

var vY : float[];

var vZ : float[];

 

var aiming : int[];

var grounded : int[];

 

and at the beginning of the match, create the class and set the size of all the arrays at frames/s/m/match length. Don't pass in information every frame, but more like every 5/second and you can Lerp towards that information in the theatre. that should be perfectly fine. As long as you don't use instances like vectors and Quaternions and what not, you should be perfectly fine to do it however you want. Then just pass the instanced class that holds all those array to the server host or whatever

 

Share this post


Link to post
Share on other sites
  • 0

I don't think that you should worry about saving in memory (at least not at very beginning).

Here will be example how to write/read from file.
 

 

Please login or register to see this attachment.

 

 

If you want save some time:
Please login or register to see this link.

 

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

Thanks man but as I can see this is storing information in a List before writing it to the disc, which is what I was trying to avoid as it is storing that in the memory?

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

 

Well that was the question, if this really is the best way to do it, keeping it in a list (or something similar) and then writing it on the disc after it's done.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

I'll say yes.

But you can try to write 5-10 times a second, or populate list with 10 records and then write.

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites
  • 0

No, last example will not work. Theoretically you can put all info in string and write line by line, then split and parse back, but it's not worth...

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

I actually meant saving it all in a list or something and seeing how it performs in game, but thanks anyway c:

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...