[Game] Scavenger

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
_aNdy_
User
User
Posts: 40
Joined: Fri Jun 17, 2016 12:06 am
Contact:

Re: [Game] Scavenger

Post by _aNdy_ »

Only just seen this thread and HOLY COW! Great work!
Khallis
User
User
Posts: 10
Joined: Sun May 05, 2013 7:56 am

Re: [Game] Scavenger

Post by Khallis »

Joubarbe wrote:Indeed it looks like the biggest game ever created with PB. Impressive!
Thanks!
Joubarbe wrote:Would be very cool to know a bit more about the technical. I suppose you created all your libraries? (that is, apart from the ones PB provides obviously)
Sure, I'm glad to talk shop about it.

Regarding libraries, there's not a lot. I did write a couple library functions. I did an implementation of Wu antialiased lines and circles, and a lookup table based polar to rectangular coordinate conversion.

One library function I wrote that I use a lot seems simple, but matches the way I think about things. It's a simple ranging interpolation thing. If you call range(x,xmin,xmax,outmin,outmax) it returns the value that is analogous. If x<=xmin, it returns outmin. If x>=xmax, it returns outmax. If x is 33% from xmin to xmax, it returns the value 33% from outmin to outmax. It seems simple, but it's extremely useful to me.

xposition=range(currenttime,animationstarttime,animationendtime,startposition,endposition) - that's linear robot motion described in a simple easy to understand wrapper. Sure, you can describe the same thing other ways, but that five argument form is really easy to tweak later.

Hmm... what else... I rolled my own 3D sound subsystem, because the built in PB one doesn't do stereo panning, only linear volume attenuation. I wanted stereo panning and doppler shifting. You can create that functionality building from the normal sound functions, though.
Joubarbe wrote:How did you organize your code for such a project?
Minimally. :)

The config tool is one file, the library functions are in one file, the module screen displays are in one file, the gameworld generator executable is in one file, and the entire rest of the game is in one file.

I pull stuff out into functions when it feels appropriate to me to, but I'm not a stickler about it. I was out to build a game, not a carefully refactored gem of pristine source code.
Joubarbe wrote:What was the most frustrating things you encountered (about PB and how it could be improved)?
There are some interesting "gotchas" that I ran into. I wrote this in 5.22LTS, so some of these may already be fixed.

If I turn on shadow casting, and then create a mesh, mesh creation silently fails. You get an invisible mesh with a line segment for a bounding box. I can only create meshes BEFORE I enable stencil shadows - all subsequent mesh creation will fail from that point. That is why my gameworld generator is it's own separate executable, because it never enables shadows, it can always generate meshes successfully.

If I create a camera with a visibility group mask, the mask doesn't work. If I instantly recreate that exact same camera with the same mask, then it works.

You can oversaturate the mouse event queue pretty easily if you have a high DPI gaming mouse. Try it - write a program to detect whether a mouse button is down, and then hold down the button and scribble the mouse around rapidly. You'll start seeing the mousebutton showing phantom releases because the internal queue overfilled. I had to spin mouse handling off into it's own thread that does nothing else and then sets me some global semaphore variables the main game thread can read at leisure - otherwise mousedrags start breaking.

There are some weirdnesses with trying to extract euler angles back out of Ogre3D, because it's internally using quats. Don't expect the get-yaw/get-pitch/get-roll functions to do what you want, or even necessarily anything meaningful to a human.

Sometimes, it crashes on exit on win7. It never does that in winXP. I never did figure out why.

It may sound like I'm complaining a lot here - I don't mean to be. I would never have written the game at all without Purebasic. PB is awesome.

For everything I ran into that was janky or broken, I was able to work around it within PB. There's no shims written in C or anything. The shaders are in .cg of course, but other than that, the game's all purebasic.
Joubarbe wrote:Did you finally manage to fully solve the false positive problem?
No. It vexes me very much.

After fighting it a lot, and having random new false positives keep appearing, I gave up trying to fix it on my side, and submitted the final build of the game executables to a lot of AV vendors. Some of them whitelisted it. Some never did.

That pretty much keeps me from ever patching the game from here. I'd have to resubmit the new exes to dozens of vendors and hope they whitelist again.
Joubarbe
Enthusiast
Enthusiast
Posts: 555
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: [Game] Scavenger

Post by Joubarbe »

Thanks for these answers Khallis!

I've experienced this mouse problem you mentioned, as well as this false positive huge problem. I really hope the PB team will look at your post, very interesting things in there.
I was out to build a game, not a carefully refactored gem of pristine source code.
So true. This craziness we know nowadays that consist of releasing a new framework of a framework every month is getting nowhere. People should learn how to code old-school. That being said, I'm doing an extensive usage of modules in my projects (with tons of files).

Ogre current version is not integrated into PB. Maybe that would have fixed your other 3D problems :)

About the false positives: is there any difference between 32b and 64b releases?
Khallis
User
User
Posts: 10
Joined: Sun May 05, 2013 7:56 am

Re: [Game] Scavenger

Post by Khallis »

Joubarbe wrote:
About the false positives: is there any difference between 32b and 64b releases?
Not that I have noticed, no.

(I am sure Fred's as annoyed by the industry-wide AV situation as I am - I want to make clear that I don't blame him a bit, this isn't in my opinion his fault at all.)
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: [Game] Scavenger

Post by BarryG »

Khallis wrote: Wed Jul 25, 2018 4:41 pmGOG requests that I not share that
If they're not publishing/hosting/selling your game, then why would you obey their request? They don't have any hold over you.
Khallis
User
User
Posts: 10
Joined: Sun May 05, 2013 7:56 am

Re: [Game] Scavenger

Post by Khallis »

BarryG wrote: Sat Jan 28, 2023 5:50 am If they're not publishing/hosting/selling your game, then why would you obey their request? They don't have any hold over you.
Purely voluntary. I figure it keeps the door open in case I have opportunity to work with them in future. You are correct, they can't really compel me.
User avatar
Janni
Enthusiast
Enthusiast
Posts: 127
Joined: Mon Feb 21, 2022 5:58 pm
Location: Norway

Re: [Game] Scavenger

Post by Janni »

First time I see this game. INCREDIBLE! :shock:
Hats off to you Khallis
Spec: Linux Mint 20.3 Cinnamon, i7-3770K, 16GB RAM, RTX 2070 Super
User avatar
DjPoke
User
User
Posts: 14
Joined: Sun Aug 10, 2014 11:23 am
Location: Corsica (France)
Contact:

Re: [Game] Scavenger

Post by DjPoke »

Nice work ! Superbe !
Enjoy the silence
Post Reply