Jump to content

  • Log In with Google      Sign In   
  • Create Account

Norman Barrows

Member Since 04 Apr 2012
Offline Last Active Yesterday, 06:32 PM

#5147388 How far can you see something?

Posted by Norman Barrows on 16 April 2014 - 10:52 AM

How far can you see something?


I know it seems like a silly question, but...


i find myself asking this question often, especially when thinking about distance scales to use in a new title.  so whether its a person, a building, an airship, or a planet, how far can you see something?


it seems to me that there should be some pretty straightforward formula or rule of thumb approximation for:


given an object [sphere] of radius R, how far away must it be before it should no longer be drawn?


keep it generic, in d3d units.


so if my sphere is at: range = 1, it appears to be almost 2R wide. at some distance: range = D, it appears to be about 2R/D wide. correct?


so when D gets big enough that 2R/D is so small its not worth it (given screen rez etc), you should no longer draw it, correct?


and you could plug in your horizontal and vertical resolutions and solve for 2R/D=1 pixel (or < 1 pixel), correct?


does this make sense?


how do YOU figure out what is big enough / close enough to be drawn? 






#5145950 how to go to be considered when making save/load functionality?

Posted by Norman Barrows on 10 April 2014 - 08:02 AM

When working with binary files, you also need to pay attention to endianness.


only if you change hardware

#5145121 DRM protection

Posted by Norman Barrows on 07 April 2014 - 12:18 PM

Currently I check at every start for a key and compare it online. I would prefer
to check it not so often or only once. The problem is how to know when my stuff get's copied to another location. (Win/mac/linux) etc. and start a
now online comparison.


i'm a little confused. what does comparing the key online accomplish, other than adding internet connection as a system requirement?  as you can see, it does nothing to prevent illegal copying. or anything else that i can see - except maybe prevent running a legit copy when the internet is down. 


NEVER NEVER NEVER deny legit access!   this is _VITAL_ in _ANY_ DRM solution. better to allow access when unsure, than possibly deny paying customers.


to know if its been copied, the software will need a systemID or authentication certificate. there may be other methods as well.



a systemID number is generated using hardware specs on the PC (serial numbers, types of processors and drives, etc).   this systemID is then used to generate a matching registration key.  so a reg key is only good with a given system ID, and a systemID is based on the hardware installed. this makes the reg key hardware dependent.  if they move to another pc , the hardware changes, the systemID changes, and the registration key no longer works.  the downside of this approach is what if they change their hardware? this is typically handled by allowing a couple new reg numbers per user when they upgrade. another approach is to simply licence the software for single user use and installation on a single mass storage device. 


authentication certificate:

when the software is installed, a hidden authentication certificate is installed. this certificate identifies the PC as legit. a user copying the software can't copy the certificate as long as it remains hidden. downsides:  1: the certificate must remain hidden.   2: this probably requires install via web, so the user doesn't have a certificate on a master disk or in a master install exe.  



note that copy protection is only half the battle. the other half is anti-crack protection for your copy protection.


in general, research on client server authentication and security procedures should help.   your situation is more of a network AUTH issue than it is a pure DRM issue on a stand-alone pc.

#5144414 checksum / crc / md5 hash check game code in ram

Posted by Norman Barrows on 04 April 2014 - 12:52 PM

simply get the addresses of a couple of functions (as many as you deem worthwhile/interesting), round down to the next 4096-byte boundary, and checksum the next 4096 bytes.


how do i get address functions?


the exe is compiled in full release mode, with no debug, symbol tables info, etc. im using ms vs c++ 2012 for compile and link, and PE explorer for disassembly. all i can see in disassembly is string constants and calls to windows and directx dlls. the game is a single exe, with no dlls of its own, so no game calls appear in game specific dll export tables.  


going off on a tangent here...

my terms may be off a bit, been forever since i learned dynamic linking and loading, and i don't use it myself - never needed it. i mean, what kind of program could one of my games possibly share code with that would be running at the same time? another copy of itself? that's about it. and what kind of program might also use the same DLL that i write for my game? maybe if i put my Z game library in a dll, another one of my games. but the z game library is not big enough that it needs to be shared and dynamically linked, just to save disk space. and nobody will run two different games from rockland at once. and the extra ram cost of the z game library wouldn't be that bad if they did. and static linking runs faster, and is less work and complication.  so as you see, there's really no reason to use DLLs for games.  unless there's a flaw in my analysis, the conclusion appears to be that using DLLS for games is bad software engineering. gee - imagine that! microsoft came up with something that's totally useless for building games! i'm SO surprised!  (Not!).



ok, rant over! <g>

right, so all you can see is strings and windows calls.  you can't even see something like:

char s[100];




s[5]=' ';








thank god too!  it took me from the first line of main, through 13 init routines, all the way to the start game menu just to build up a string one character at a time, doing one character per routine. continuing at that rate, it would have required all of the renderscene code, process_input code, and half the run_simulation code, just to perform the first startup check!  


i actually put a test string in the code, followed by code similar to the example above. i could find the test string, and the call to strcpy_s, but due to code reordering etc, i was unable to locate the assignment statements anywhere.


all functions appear as:  sub_<someaddress> ,

as in:

push eax somestuff
call sub_0048DB03

for windows dll calls, it appears that ms c++ emits one subroutine for each call with fix up code, then calls that form everywhere in the program. so you do a search on say "GetSystemTime", got to the top of the subroutine, and hit "r" to get a list of all the calling (referencing) addresses. then you goto those addresses and see whats up.


so things can be traced backwards from suspicious system calls. 


right now, if they do that, they'll find a code snippet that makes the call, does a calculation on the result, and places the result in a global. then they have to find references to that global.  obviously, there is always a traceable path backwards. if there wasn't, the code would not have a flow control path while moving forwards through the code during execution.


so now i'm trying to figure out what to do about that. peppering the code with tons of bogus calls to GetSystemTime is a possibility. then they'd have lots of references to track down and eliminate. 


i've made changes to the demo so there's as little as possible to hack into. for example, instead of seeding the random map gen with zero, it now has a hard coded demo map, and the map gen is stripped out via #ifdef demo and dead code elimination. terrain based encounter tables, the vast majority of the animal types database, and other features have all been stripped out using this method.  the only things left to hack are the beta expiration date, and the 30 gameday demo limit. and even if they get cracked, they'd have a beta of a demo that never expired where they could play a single game until they had to turn off or reboot the PC.  i got it down so low i was considering not even adding the hack-able restrictions IE no BETA expiration date, and no DEMO 30 gameday limit.  the demo won't load or save, without the 30 gameday limit they can only play until they have to turn off or reboot the pc. but they can alt-tab back and forth, and leave it running until then.


i think version 1.3 got cracked because it had a simple registration key check, and the code for the check was totally unprotected. so the cracker was one "enter reg #..." string and one jmp away from cracking it. 5 minutes for any non-noobie. maybe a day for a noob, - a good intro to cracking.  previous demos were stripped using $ifdef demo and dead code elimination, and the full version came on cd in the mail, and used keycd protection. no cracker would buy the full version just to crack it. and apparently no end user happened to be a cracker, or gave it to a cracker. it wasn't until the v1.3 demo was posted that i had problems.  and that was probably because it looked crackable, and perhaps because it looked like there was a lot of game to crack into, behind the protection. the demo was very limited, 10x10 vs 640x480 world map, only 3 of 50 monster types, no save, 30 game days max, no quests, no additional band members, etc. basically it was the tutorial for the game, similar to the "total war" demos.

#5143832 How to time bomb a beta?

Posted by Norman Barrows on 01 April 2014 - 11:14 PM

Here's a list of DRM-free games. Take a gander through there and consider how many of them you recognize, how many of them have been profitable.


and consider how many aren't big or aren't new, or don't have that large a market.


there's not a single current AAA pc title there. assasin's creed 1 was about it. if they can get a few bucks for the old version on a "marginal goods" sale, great. its called milking the release for all its worth. no drm makes e-delievry easier. probably had to strip it out for e-delivery, and the game wasn't worth an alternative solution. its so old its no competition to the current version, and works as a "free demo" instead if redistributed.


in the wikipedia article on DRM, they point out that big pc games released in 2008 with good drm were conspicuously absent from torrent freak's list of top 10  most popular cracked games for 2008.  their point was that drm doesn't therefore seem to encourage cracking.  well of course not silly! you think the cracker  does it so all those legit users dont have to put a cd in their drive to play? you think they're some kind of gaming good Samaritan? Nonsense! They want bragging rights within their community - plain and simple, its all about prestige amongst one's fellow crackers. unfortunately (for gamedevs) the only way to gain such notoriety is by releasing cracks. 


most of the examples of games held up as "drm free and it works" simply wouldn't be worth cracking even if they had the easiest to break drm ever. they're just not cool enough, big  enough, expensive enough, popular enough, etc.



#5143822 How to time bomb a beta?

Posted by Norman Barrows on 01 April 2014 - 09:14 PM

Why do people still buy CD's when they could download the music for free?


because by and large you can't DL cd quality audio, just tinny lossy mp3's. if you want the real McCoy, you gotta ante up the bucks.

#5143097 Slavers in Caveman - what if you're captured?

Posted by Norman Barrows on 29 March 2014 - 12:19 PM

I think the various means of escape would be interesting, e.g. kidnappers get attacked and you run, natural disaster and you run, stealthy escape, steal stuff and escape, fight them and escape, talk around a captor and escape, etc. Or potentially stay with them. It could also be valuable if your captors have better resources than you, a safer environment than yours, an opportunity to travel, future allies maybe.



yes, the scenario, while rare, CAN make for interesting gameplay.  i wish i had the time to do it all in the first release.  the problem with big simulation games ( or any game for that matter) is you can always do more and / or better.    but periodically, it helps to release! <g>.

#5143079 How to time bomb a beta?

Posted by Norman Barrows on 29 March 2014 - 11:16 AM

You can't stop the game from being hacked and circumvent the time bomb.
All you can do is to check the clock, keep a launch count, check timestamps of the files, phone home, obfuscate all of the former and check multiple times.


i realize all this. 


i spent yesterday reading up on code obfustication, self modifying code, and DL'ing disassemblers.


at this point, the real question is, in a disassember dump, one can see windows  and library calls, correct?


any protection will ultimately depend on 3 system calls: get system time, get file time, and read sector. if those calls can found relatively easily, then its the code that uses them that must be obfusticated.  


it looks like the best approach is a VM that uses a proprietary machine code and self modifying code. it in turn would have ops for gettime, get filetime, and read sector. 


i was hoping for a few pointers or tips on implementation.


I find it rather surprising that DRM is not a more popular topic here.   whats the deal?    do most folks here fall into one of two categories: 1. "i have yet to make a game worth cracking", or 2. "i work for a big game company and cracking is someone else's problem" ? 



for future readers who might be interested in the topic:


not only can the user reset the clock before running  the beta, then can also do so BEFORE installing! never thought of that one before!   so saving the install date won't always catch a clock that's been set back after the install. but it should still be done. it DOES trap the case of they install, then set the clock back to run.


there should be a check for current date older than release date, as well as current date beyond expiration date.


current date beyond expiration date is the basic condition we're interested in. all the rest is cause they can play with the system clock.


current date older than release date traps clock set back too far.


and since they can play with the system clock, you need to verify by checking the last update time of files on the hard drive. using something that gets updated automatically at startup, such as the hidden backup copy of the windows registery.  i figured i'd just do something like simply check the last update time of all the files in the windows directory (or a few target files if all files is too slow). if any file is "too new" the beta is expired.


but as stated in some of the info i found online, the worst case is you're running in a VM (emulator) where the date never changes.


i did find a lot of good info, and will be posting it to my gamedev info journal.  my brain was absolute MUSH last night after all that reading!


and i do plan to also have missing content / disabled features and beta messages.


perhaps i should have started this thread with a disclaimer like:


"i know there's no perfect solution, but one must do what one can, so whats the best way?"

#5142417 Slavers in Caveman - what if you're captured?

Posted by Norman Barrows on 26 March 2014 - 04:46 PM

Slavers in Caveman - what if you're captured?
a Caveman simulator. rpg/person sim/virtual world hybrid.
Game description:
So the next thing on the "new features: coding" todo list is slaver encounters.
slavers attack to subdue, capture you, then sell you off as a slave.
so, what if you're captured?
the way i see it, either you try to escape or you don't.
if you don't, you're a slave for life - basically game over (unless you want to play a slave).
if you try to escape, either you succeed, or you don't.
if you don't, you're a slave for life - basically game over (unless you want to play a slave).
if you succeed, X amount of time has passed, and you're free (able to play normally again).
and of course, the appropriate penaties for X amount of time passing should be applied, where X could be anything from minutes to decades.
so is that it? game over, or cross off X amount of your life and continue playing? 
are those the only two basic outcomes?
note that being captured then escaping is similar to going to jail in skyrim.

#5142414 books on animation?

Posted by Norman Barrows on 26 March 2014 - 04:31 PM

back in the day, "character animation and lighting" volumes one and two were quite good. wish i still had them...

#5142413 4D Games...

Posted by Norman Barrows on 26 March 2014 - 04:28 PM

it could be done.


if changes in the past change the future, you've created a new "timeline-universe" as mentioned above.


then you have to model the impacts of the new past event on the new future, to figure out what the new future looks like.


like everything else, its all just modeling and simulation.


granted, modeling the impacts of a wide variety of past actions could be a daunting task. <g>

#5141846 Resizing tiles according to fixed screen resolutions.

Posted by Norman Barrows on 24 March 2014 - 06:15 PM

there are a few basic approaches to supporting multiple screen resolutions.


six come to mind offhand:


1. write everything using a virtual coordinate system (say 10000 x 10000) then convert on the fly to the current screen size. 5000,5000 virtual (the center of the screen) @ 1600x900 resolution = hardware pixel coordinates 800,450.   


2.  a variation on method 1:  write everything using a single hardware resolution (such as 1600x900) then convert on the fly to the current screen size.  nice if you've already started coding to one screen size.  only one catch - scaling up to higher resolutions may introduce some graphic artifacts due to scaling inaccuracies. that's why 10000x10000 is better, you only scale down, never up - well, unless you're running at a rez higher than 10000x10000! <g>.


3. as mentioned above, use one resolution, then strechblit to the current screen size. can be slower than methods 1 and 2.


4. support just a few common resolutions, and write resolution dependent code for each. runs nice and fast. limits rez's supported. more coding work than some other methods.


5. don't support re-sizing of graphics which are resolution dependent.  games with popup menus that get smaller as you increase screen size are like this. d3d draws pretty much the same at all resolutions, but sprites and fonts change size. I believe Oblivion might have done this. this is the easiest way. no extra work. but you get what you pay for, as they say.


6. don't support multiple screen resolutions at all.  most games really only need to support a few resolutions, the one or two or three common high end ones that its really

designed to target, and perhaps one lower end one if you want to reach the legacy hardware base out there. if all supported rez's are similar in size, this plus method 5 can yield acceptable results.

#5141766 Continuous Play Experience

Posted by Norman Barrows on 24 March 2014 - 12:47 PM

What do you guys think of the concept of a "Continuous Play Experience"?


as mentioned above, spycraft did it first (well, at least i _think_they were first! <g> ).  a brilliant combining of computer game and real world technologies that showed the possible future of a game you play all the time in the real world as well as on your pc (hopefully not against your will, like in the movie "the game").


given the pervasive intrusion of modern telecom and computing into every facet of ones life, the potential for a game played in the "real world" as well as on desktop or mobile computing devices is high.


it could be single or multiplayer. multiplayer offers the opportunity to setup interactions between players that occur inn the real world. "meet someone at some place and time" to get your next clue. or "meet someone at some place and time"  to hand off the info you got to your new contact. and the two players, having never met each other, would meet in some diner, at 4pm on a tuesday, and exchange the game info for the password saying "i delivered the info", so both could continue on their lines of play, perhaps intersecting again, or not.


of course this opens up a whole new can of worms RE: cheating. what if i meet you at IHOP, give you the game data, but you give me a bogus password?  what if i find out where you live, have a gun, and am off my medication? <g>.  you watch, some day we'll here about somebody who died as an indirect result of playing one of these types of games - accidental death, crazy with a gun, something like that. give, i don't know, what? 10, 20, 40 years? it'll happen.

#5140765 divide on subsystems

Posted by Norman Barrows on 20 March 2014 - 03:20 PM

I used to go crazy with modules, one for graphics, one for mesh and texture databases, one for the animation engine, one for audio, etc.


now i keep it simple, one for the audio library (Zaudio), one for the "graphics and everything else" library (Z3d), and one for game-specific code (Caveman, Airships!, SIMSpace, etc.)..


the graphics and everything else library is graphics, math, file i/o, timers, dice - pretty much all the generic low level stuff for games, except audio. when i implemented the audio library i made it separate as it seemed the cleaner way to do things. good module separation and all that jazz

#5138290 detect corrupt savegame file - best practices

Posted by Norman Barrows on 11 March 2014 - 08:36 PM

Just had a big laugh imagining trying to automatically recover a save game in bigger games, like for instance Skyrim..


that's about the size of the game i'm working with. a core dump of the entire game state is about 67 meg. its a persistent open world, 2500 miles x 2500 miles in size, with 60,000 caves, 5000 rock shelters, 18,000 huts, and untold (maybe 2500?) procedurally generated caverns (dungeons).