Skip to main content
deleted 5 characters in body
Source Link
Kromster
  • 10.7k
  • 4
  • 54
  • 67

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime spans over several Maps(Levels) have and is equeal or just a bit shorter than the Session.

This is just the general direction, it can change to your game specifics. For example, in simulation-heavy games, it may be simpler to create new Character object for each Map(Level) from scratch, using just a small stored data (3-4 vars) and store it back on completion. Some games might deny Character progress unless Map(Level) is won, in that case you create a Character and only write back the results to the Character on completing. Other games could have very complex Characters (think RPGs), or ones that can even persist over Session in meta-gameplay.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime spans over several Maps(Levels) have and is equeal or just a bit shorter than the Session.

This is just the general direction, it can change to your game specifics. For example, in simulation-heavy games, it may be simpler to create new Character object for each Map(Level) from scratch, using just a small stored data (3-4 vars) and store it back on completion. Some games might deny Character progress unless Map(Level) is won, in that case you create a Character and only write back the results to the Character on completing. Other games could have very complex Characters (think RPGs), or ones that can even persist over Session in meta-gameplay.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime spans over several Maps(Levels) and is equeal or just a bit shorter than the Session.

This is just the general direction, it can change to your game specifics. For example, in simulation-heavy games, it may be simpler to create new Character object for each Map(Level) from scratch, using just a small stored data (3-4 vars) and store it back on completion. Some games might deny Character progress unless Map(Level) is won, in that case you create a Character and only write back the results to the Character on completing. Other games could have very complex Characters (think RPGs), or ones that can even persist over Session in meta-gameplay.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).

added 558 characters in body
Source Link
Kromster
  • 10.7k
  • 4
  • 54
  • 67

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime is much longer than whatspans over several Maps(Levels) have and is equeal or just a bit shorter than the Session.

This is just the general direction, it can change to your game specifics. For example, in simulation-heavy games, it may be simpler to create new Character object for each Map(Level) from scratch, using just a small stored data (3-4 vars) and store it back on completion. Some games might deny Character progress unless Map(Level) is won, in that case you create a Character and only write back the results to the Character on completing. Other games could have very complex Characters (think RPGs), or ones that can even persist over Session in meta-gameplay.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime is much longer than what Maps(Levels) have and is equeal or just a bit shorter than the Session.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime spans over several Maps(Levels) have and is equeal or just a bit shorter than the Session.

This is just the general direction, it can change to your game specifics. For example, in simulation-heavy games, it may be simpler to create new Character object for each Map(Level) from scratch, using just a small stored data (3-4 vars) and store it back on completion. Some games might deny Character progress unless Map(Level) is won, in that case you create a Character and only write back the results to the Character on completing. Other games could have very complex Characters (think RPGs), or ones that can even persist over Session in meta-gameplay.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).

Source Link
Kromster
  • 10.7k
  • 4
  • 54
  • 67

It largely depends on a game, but generally, it seems like you have a classic RPG/FPS/Arcade composition, where you have:

  • a Game instance (roughly speaking, this is your launched executable),
  • Game creates Sessions instances, one at a time (e.g. starting a new playthrough, loading a save, restarting, etc),
  • Session has a single Character instance and several instances of different Maps(Levels) he walks through. Maps(Levels) being instantiated on demand, existing one at a time.

Now you can see, that Characters lifetime is much longer than what Maps(Levels) have and is equeal or just a bit shorter than the Session.

How exactly do you store the Character instance in Session on serialization to savegame it up to you (heck, some games don't even do saves, they use level-codes), but generally you would store just the "persistent" bits (Level, Inventory, Skill-tree, etc).