Long time no post for this thread
I haven't actually worked on any code for a long time, due to various reasons.. One being I've had 30 hour-ish work weeks the past couple of months, as I'm helping cover for a co-worker out on medical from a bad car accident.. The other is my computer is in pieces, because of some upgrades I got, and I've been too lazy to put it all back together since I have everything I need now! (Was waiting on an extension for 8-pin CPU/EPS power cable, my PSU's is too short for my new case)...
That being said, I got a new core system.. Phenom II x4, overclocked to 3.5Ghz
Hopefully I can play around with some scalable multi-core programming one day... Anyway
I have been reading up on some programming books and currently having a good read through "Game Coding Complete, Third Edition" by Mike McShaffry. It is a really nice book that looks like it will be talking about a LOT of things I have had questions about, from a fundamental design/system architecture standpoint.. Even though it's examples are in C++ I am really hoping to take the concepts and apply them to my PB projects more so than code.
Two things sparked my interest so far (not very far into the book).. The topic of Random Number Generators, and also the idea of building Multiplayer into my Text RPG Game Engine from the start.. I'm nowhere near the point where I would implement either (and the RNG would be easier for me by far) but I had some thoughts and ideas I wanted to bounce around..RNG:
I'm sure most would probably tell me that the RNG provided by Purebasic is sufficient enough (I'm fairly certain it provides one anyway, haven't looked for it yet) but I'm curious about making my own, and keeping it as random as possible.. I don't need to worry about saving/loading the Seed with a game as the world itself is meant to be persistent in that no experience should be 100% repeatable. But I definitely want combat to be random every time. The book discussed the concept of using several RNG's for different systems (Loot table, Combat, Random enemy taunts or other random dialogue, etc.) There was a joke about including a piece of hardware that uses the decay of cesium which I didn't really get (does cesium decay randomly? I thought all radioactive decay was a consistent predictable time, based on the element in question?) but anyway I was wondering about using some arbitrary procedure to randomize the seed on every roll, or at least create a "Seed" table that could be cycled through.. Like using the execution time of a simple math expression, or getting a directory listing, or something mundane like that.
How complex does an RNG really need to get to be fair, but difficult to predict/manipulate in the players favor (not overly concerned with hacking/cheating, but still.. the more random the better).Multiplayer
This is an interesting topic in itself. I always liked the experience of meeting and making new friends when playing MUDs online, having adventures and all that. So I would like to be able to do multiplayer although I fear I am in for a long, hard road as I know nothing about Networking, sockets, packets, TCP/IP & UDP, etc. However I really do want to try and make my game cross-platform so at least people on both Windows and Linux systems can play it.
These days it seems like multiplayer servers are actually built into the game client, so one player can act as a "host" server, while still playing. In some cases it seems like the game itself runs in server mode even locally, and the local client "connects" to it.. I saw this in Sacred 2 I think.. I remember playing single player and it would still give message such as "connecting to server" etc.. This idea intrigues me and I would like to explore it for a couple reasons.
One is that the book itself, when discussing various ways to design systems and link them together, uses the concept of "Views".. The views interface with the game logic by use of commands (as opposed to manipulating variables directly). So you would have a Player view for the screen the player sees, and you could also have a view for the AI to respond to events and do some logic then send commands back to the game accordingly, and of course you could have a remote-type view for a player on a Networked PC somewhere.
I was thinking if I could design the game like this, where it had a set of interface commands, etc that the client can send to the game (either through GUI interaction, or passing the input string on to the game to be parsed by a command parser, like a MUD would parse commands from a logged in player) it would make cross-platform easier for me? I stand to reason that I can do work on the core of the game which runs as a server, and connect to players via local or remote connections; This would leave me free to concentrate only on the Game Client itself, and I could develop a Windows client/server, and a Linux Client/server. Either client can connect to either server, so a player hosting multiplayer on a Windows box can connect with others players whether they are on Windows or Linux, or whatever OS... as long as a client exists for that system.
The client and server would just be sending/receiving packets of data that should be OS neutral anyway so it could work out nicely, depending.. I could make a remote session completely remote in that it receives everything from the Host server, or I could make it share only data that has changed (So it will update the server if the player moves to another room, and likewise all other clients will get that update, but the actual room description for the player who just moved, could be fetched locally instead of having to be sent from the server, like in a traditional MUD).
The thoughts are kind of incomplete but just a starting point for discussion.. I imagine it will be a but more complicated than I have lead myself to believe.. But my biggest concern with cross-platform has been how to do a Windows client and include it with game code, and interface the game logic itself with the client, while also doing a Linux version... For some reason I think there would be more rewriting of code if I tied clients into the game logic than if I just used a local client/server mode, with the option to allow remote connections as well.