About Store Forum Documentation Contact
Donations:
158$/mo



Post Reply 
example of save/load & transport
Author Message
yvanvds Offline
Silver Supporter

Post: #1
example of save/load & transport
Hello again.

I made this code on request but also post it in here because it might be useful to beginning essenthel programmers.

The problem:
When you load saved game, the player included in the saved game might be at a position far away from what the camera is looking at right now. Since only near parts of the world are loaded in memory, your player container will be empty and there's no easy way to retrieve the position where the player should be.

A related issue is when you have portals in your game, transporting the player to a position that is not currently loaded.

(a) solution
This code addresses both problems by means of a gameFile class that takes care of the issue. To beef it up a bit I've done this in a separate thread, which is what you'd want in the end anyway. I've included all files to get you up and running. Be sure to add a bit of terrain to the sample.world if you want to check it out. (The transport function in the demo transports your player to position -200, 5, 20, which is not a fun place in the sample world.)

Keep up the coding!

yvan


Attached File(s)
.7z  loadandtransport.7z (Size: 2.73 KB / Downloads: 50)
10-02-2012 10:36 PM
Find all posts by this user Quote this message in a reply
Shatterstar Offline
Member

Post: #2
RE: example of save/load & transport
thanks yvanvds. i was having some trouble with this.
10-04-2012 04:53 AM
Find all posts by this user Quote this message in a reply
Rabishan Offline
Member

Post: #3
RE: example of save/load & transport
thanks for sharing.
10-05-2012 05:12 AM
Find all posts by this user Quote this message in a reply
dylantan Offline
Member

Post: #4
RE: example of save/load & transport
thanks for sharing yvanvds!
10-05-2012 05:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply