Author Topic: How to make FOnline:2238 work in Singleplayer mode  (Read 3709 times)

JovankaB

  • Guest
How to make FOnline:2238 work in Singleplayer mode
« on: July 12, 2014, 08:16:59 pm »
The steps necessary to run FOnline:2238 in so called "Singleplayer mode":
  • You need both Client and Server, of course. Unpack the zips into the same folder.
  • Rename the client files "FOnline.exe" and "FOnlineGL.exe" to "FOnlineSingleplayer.exe" and "FOnlineGLSingleplayer.exe".
  • Open FOnline.cfg in a text editor and paste this at the end of the file:
    Quote
    ServerAppName = FOnlineServer.exe
    ServerPath    = ..\Server\
  • ???
  • Profit!

Sadly the result is not satisfying. Something tells me it's the step 4...

Before I get my hands dirty in the scripts, maybe someone else tried it and knows what to do or can point me in a good direction?
« Last Edit: July 12, 2014, 09:12:03 pm by b__B »

JovankaB

  • Guest
Re: How to make FOnline:2238 work in Singleplayer mode
« Reply #1 on: July 14, 2014, 05:12:34 pm »
Unfortunately the thing is more problematic than I thought.

In Singleplayer mode the world isn't generated until you create a character - which is a problem because in the start() function there is tons of features relying on existence of various game objects. So moving most of the stuff from start() to the loop() and making sure the stuff runs only once sounded like a good idea, except one small detail - turns out loop() starts before world generation too...

What's worse 9 out of 10 times I get "character already logged in". I don't know if it goes away once all the null pointer errors get fixed. At this point I lost interest. Maybe I will return to the idea later, but if someone is interested, here is a pseudocode showing what needs to be done (that's the point 4. ???)

In main.fos you have to move stuff from start() to loop() and rewrite loop() like that:

Code: [Select]
loop() {
 if worldGenerated() {
  if (firstTime) {
   stuf_from_start();
 }
  stuff_from_loop();
 }
}


How to check if the world is generated? I don't know if there is some nice way, but there is plenty of functions that run during the generation - map scripts, critter_inits etc. so it shouldn't be too hard to abuse them. Last but not least, thanks to Wipe for help.
« Last Edit: July 14, 2014, 07:53:48 pm by b__B »

Re: How to make FOnline:2238 work in Singleplayer mode
« Reply #2 on: May 16, 2015, 07:06:38 pm »
How to implement save/load options? its possible?

Offline Wipe

  • Rotator
  • Random is god
Re: How to make FOnline:2238 work in Singleplayer mode
« Reply #3 on: May 16, 2015, 10:48:35 pm »
Singleplayer save/load is similiar to what's used in multiplayer mode, so it shouldn't be much of a problem [once you defeat previously mentioned issues ofc]. For sure you'd have to recheck login/save/load client screens, as we never had reason to care about them. Note that singleplayer mode can be used only on Windows.
Games are meant to be created, not played...

Re: How to make FOnline:2238 work in Singleplayer mode
« Reply #4 on: June 15, 2015, 06:13:16 pm »
Do you really need a singleplayer mode? I mean it will still run a background server process, you can't speed up time, and when you load a save inside some dungeon, you may end up dead, because all enemies respawned  I guess making player keep his/her inventory after death might be more useful. And i am still trying to find out how to enforce turn based mode in fixed locations.