Im trying to find a command that will let me search for a specific player's specific SEnt. I.e I want to find user "Jack Mehoff" 's spawned in SEnt(S) named "custom_printer". thx
[QUOTE=Jack Mehoff;52928281]Im trying to find a command that will let me search for a specific player's specific SEnt. I.e I want to find user "Jack Mehoff" 's spawned in SEnt(S) named "custom_printer". thx[/QUOTE]
That's a Gmod issue, right? That's [URL="https://gmod.facepunch.com/f/gmoddev/obtc/Problems-That-Don-t-Need-Their-Own-Thread-v5/1/"]over here[/URL] now.
So I'm dealing with a bit of a performance problem that's got me stumped, even after a considerable quantity of work. The following code is where I spend most of my time (outside of sqrt, yay):
[t]https://i.imgur.com/T6vSzlA.png[/t]
I'm storing some important data for my gravity model in an unordered_map, using this hash function:
[t]https://i.imgur.com/2wTsarX.png[/t]
To give an example of the data, here's a snippet from the beginning of the file:
[t]https://i.imgur.com/Y5mCZmG.png[/t]
I would really like to make this faster, but I'm stumped as to how. Trying to simplify or modify the hash algorithm inevitably causes the speed to decrease, which is real odd. And this is unhelped by how the model works; it's a nested loop and eventually calls that get pair method >36,000 times per individual timestep (of which there can be several of, since i use an adaptive timestep for my integrator).
[cpp]
for(size_t n = 0; n <= 270; ++n) {
// do some math
for(size_t m = 0; m <= n; ++m) {
auto& thing = coefficients.GetPair(n,m);
// do a bunch more math
}
}
[/cpp]
I can't quite figure out how to store it in a linear array or vector - the indexing seems weird, since the way these work is all odd. I tried playing around with various formulas to index into a linear array of these constants given N,M, but got nowhere. This is a silly bottleneck in my application right now, and I'm sure there's a better way of doing this.
[QUOTE=paindoc;52931022][hashing][/QUOTE]
What's the range on each of those indices?
[editline]edit[/editline] Oh wait, I see how those indexes work. That's easy-ish then, I think. One moment.
[editline]29th November 2017[/editline]
[code](n+1)*n/2 + m[/code]
[editline]edit[/editline]
To explain further, if you visualise your memory locations like this:
[img]https://i.imgur.com/hcczM7T.png[/img]
...then just for the linearised (n, 0) indexes you're looking for the [I]staircase[/I] area [I]to the left of[/I] that cell. It's quite useful that the indices are 0-based, but otherwise the formula would change just very slightly in the end.
Triangle area for right isosceles triangles is just [I]n²[/I], but the stair adds one half of each of the green cells over what the equivalent triangle would have, so [I]+n/2[/I].
Simplify towards fewer multiplications and add [I]m[/I] and you got the above linearised index formula, which helpfully seems to be in memory access order too.
[editline]edit[/editline] Then again, [I]/2[/I] is really fast so I have no clue which representation of that formula is actually best (or whether the compiler handles that kind of optimisation anyway) :v:
nvm ffmpeg is weird
[QUOTE=Tamschi;52931086]What's the range on each of those indices?
[editline]edit[/editline] Oh wait, I see how those indexes work. That's easy-ish then, I think. One moment.
[editline]29th November 2017[/editline]
[code](n+1)*n/2 + m[/code]
[editline]edit[/editline]
To explain further, if you visualise your memory locations like this:
[img]https://i.imgur.com/hcczM7T.png[/img]
...then just for the linearised (n, 0) indexes you're looking for the [I]staircase[/I] area [I]to the left of[/I] that cell. It's quite useful that the indices are 0-based, but otherwise the formula would change just very slightly in the end.
Triangle area for right isosceles triangles is just [I]n²[/I], but the stair adds one half of each of the green cells over what the equivalent triangle would have, so [I]+n/2[/I].
Simplify towards fewer multiplications and add [I]m[/I] and you got the above linearised index formula, which helpfully seems to be in memory access order too.
[editline]edit[/editline] Then again, [I]/2[/I] is really fast so I have no clue which representation of that formula is actually best (or whether the compiler handles that kind of optimisation anyway) :v:[/QUOTE]
This won't quite work, though. The indices are zero based for M, but start at 2 for N. So the index of the first element with N,M (2, 0) is 3 using that formula. You got further than I got, though, so hopefully as I shake off the sleepiness this morning I'll figure out how to fix it.
To clarify further, here's a column of the first few indices (N,M)
[code]
2 0
2 1
2 2
3 0
3 1
3 2
3 3
4 0
4 1
4 2
4 3
4 4
[/code]
later on, of course, it becomes like this:
[code]
255 252
255 253
255 254
255 255
[/code]
the above describing the last four entries in the dataset. [URL="https://gist.github.com/fuchstraumer/e8ceb1ba3f064c7d06b0479c1ff3e09c"]here's the whole dataset pasted in a gist[/URL]. its part of this equation being implemented, which is a good ol nested sum. C is the 3rd column of the dataset, and S is the fourth column.
[t]https://i.imgur.com/sb6BUlM.png[/t]
ty tamschi, you are helping me do space stuff for some important folks at GSFC :D
[QUOTE=paindoc;52932573][...] how to fix it.[/QUOTE]
You've probably woken up and figured it out already, but just for completion here: For the offset either subtract [I]2[/I] from each [I]n[/I] or add [I]-3[/I] at the end of the full formula.
If you wanted to get really smart about manual optimisation, you could probably mess with the array pointer or just waste those first few cells in the array. That again depends on how well the compiler optimises array index offsets though. [I]- 3[/I] at the end is potentially free if the compiler extracts it from the loop.
[QUOTE]ty tamschi, you are helping me do space stuff for some important folks at GSFC :D[/QUOTE]
I'm glad I'm able to help with something like that.
Now if I could just get a proper job in that area. To be honest I'm envious, but more than that I'm glad to see it's possible without having formally studied physics proper.
[QUOTE=Tamschi;52934017]You've probably woken up and figured it out already, but just for completion here: For the offset either subtract [I]2[/I] from each [I]n[/I] or add [I]-3[/I] at the end of the full formula.
[/quote]
cheers, mate. This is a factor of 10 speedup, just about, if we go by exclusive samples
[img]https://i.imgur.com/qYUbS48.png[/img]
:ok:
[quote]
If you wanted to get really smart about manual optimisation, you could probably mess with the array pointer or just waste those first few cells in the array. That again depends on how well the compiler optimises array index offsets though. [I]- 3[/I] at the end is potentially free if the compiler extracts it from the loop.
[/quote]
I'll have to revisit this later, and also check to see what happens to that formula in godbolt on msvc and clang. That's assuming it becomes an issue again, though, and I don't expect it will. It's probably going to be down to me manually tuning the core gravity algorithm loop, at this point. I need to reduce the amount of calls to sqrt, and I already see one chance where I can precalculate a whole set of values that require that once per simulation run (and this removes sqrt from the innermost loop, too).
[quote]
I'm glad I'm able to help with something like that.
Now if I could just get a proper job in that area. To be honest I'm envious, but more than that I'm glad to see it's possible without having formally studied physics proper.[/quote]
You never know, there's always need for experienced software devs in the sciences! Scientists do the hard math and may write the initial code, but they still rely on blokes like us to build the rest of the infrastructure or greatly improve the performance. While it's easy to gravitate to the major space agencies, you will generally have surprisingly good luck applying for positions at smaller aerospace firms that subcontract with those agencies - though I'm not sure how commonplace that is in the EU. University research is also a good spot, for this kind of stuff.
Using any json querying language, how would you query for the first seen value of a "1a. price (USD)" field?
How would you do it if the name of the key "Time Series (Digital Currency Intraday)" varied in the format "Time Series (*)" where * is anything?
I'm using Python and I tried doing this with jsonpath-ng, but it seems it doesn't support filtering on keys?
[code]{
"Meta Data": {
"1. Information": "Intraday Prices and Volumes for Digital Currency",
"2. Digital Currency Code": "BTC",
"3. Digital Currency Name": "Bitcoin",
"4. Market Code": "USD",
"5. Market Name": "United States Dollar",
"6. Interval": "5min",
"7. Last Refreshed": "2017-11-30 17:40:00",
"8. Time Zone": "UTC"
},
"Time Series (Digital Currency Intraday)": {
"2017-11-30 17:40:00": {
"1a. price (USD)": "9421.91797180",
"1b. price (USD)": "9421.91797180",
"2. volume": "333692.88329003",
"3. market cap (USD)": "3144026974.13140011"
},
"2017-11-30 17:35:00": {
"1a. price (USD)": "9341.91061583",
"1b. price (USD)": "9341.91061583",
"2. volume": "333682.35311344",
"3. market cap (USD)": "3117230716.86420012"
}
}
}[/code]
How would I express game objects / entities in C? (If you are wondering why... I wanted to try something different for fun). I've looked at some source code of C games (e.g. Quake 2), but it isn't really helping much since they're such large-scale codebases.
The best (only...) thing I could think of is creating a basic entity struct, with a "true entity" pointer inside, which I put in a large array, which contains for example:
[CODE]
()
enum ENTITY_TYPE {
ENT_DUMMY,
ENT_PLAYER,
ENT_SNAIL,
/* etc. */
};
typedef struct {
void* true_entity;
enum ENTITY_TYPE type;
int index;
} entity_t;
typedef struct {
entity_t* ent; /* owner */
int x;
int y;
int health;
int shell_health;
} snail_t;
void snail_update(snail_t* snail); /* or would i need to use void* and cast in function? */
/* and we could update functions something like this, unsure if I would need to do casting though, its just pseudocode */
entity_update[ent->type](ent->true_entity);
[/CODE]
Which isn't a great design... it's bad for the CPU cache because it's basically virtual functions, and it isn't very maintanable (centralized global variables that you have to change to add something). Also I don't even know how I would really do entity initialization with this design.
But I'm sure someone more experienced in the C programming style knows some better way to do it, and can guide me in the right direction at least.
[QUOTE=bitmask;52936277]How would I express game objects / entities in C? (If you are wondering why... I wanted to try something different for fun). I've looked at some source code of C games (e.g. Quake 2), but it isn't really helping much since they're such large-scale codebases.
The best (only...) thing I could think of is creating a basic entity struct, with a "true entity" pointer inside, which I put in a large array, which contains for example:
Which isn't a great design... it's bad for the CPU cache because it's basically virtual functions, and it isn't very maintanable (centralized global variables that you have to change to add something). Also I don't even know how I would really do entity initialization with this design.
But I'm sure someone more experienced in the C programming style knows some better way to do it, and can guide me in the right direction at least.[/QUOTE]
I haven't looked at what Quake 2 does but my understanding is that Half-Life is basically that - a list of structs that contain a struct of generic attributes, a pointer to the entity-specific data plus some other bits and pieces.
Source does something similar though the list contains instance of objects which implement a C++ interface.
They're the only two engines I've done any work with so I don't know if there are better alternatives.
[QUOTE=bitmask;52936277]How would I express game objects / entities in C? (If you are wondering why... I wanted to try something different for fun). I've looked at some source code of C games (e.g. Quake 2), but it isn't really helping much since they're such large-scale codebases.
The best (only...) thing I could think of is creating a basic entity struct, with a "true entity" pointer inside, which I put in a large array, which contains for example:
[CODE]
()
enum ENTITY_TYPE {
ENT_DUMMY,
ENT_PLAYER,
ENT_SNAIL,
/* etc. */
};
typedef struct {
void* true_entity;
enum ENTITY_TYPE type;
int index;
} entity_t;
typedef struct {
entity_t* ent; /* owner */
int x;
int y;
int health;
int shell_health;
} snail_t;
void snail_update(snail_t* snail); /* or would i need to use void* and cast in function? */
/* and we could update functions something like this, unsure if I would need to do casting though, its just pseudocode */
entity_update[ent->type](ent->true_entity);
[/CODE]
Which isn't a great design... it's bad for the CPU cache because it's basically virtual functions, and it isn't very maintanable (centralized global variables that you have to change to add something). Also I don't even know how I would really do entity initialization with this design.
But I'm sure someone more experienced in the C programming style knows some better way to do it, and can guide me in the right direction at least.[/QUOTE]
[URL="http://cecilsunkure.blogspot.com/2012/04/object-oriented-c-class-like-structures.html"]Maybe this might help, if you haven't already seen it?[/URL] I mean jeese, trying something different is good for being better at programming absolutely, but this seems a bit masochistic lol
my personal primary reason for not using c for more stuff is that RAII is just too nice, like not making entity initialization such a PITA
[editline]edited[/editline]
that article seems to pull heavily from this rather large (and undoubtedly informative) text on object-oriented C: [URL="http://www.planetpdf.com/codecuts/pdfs/ooc.pdf"]http://www.planetpdf.com/codecuts/pdfs/ooc.pdf[/URL]
still, oof
Does anybody know any good 2D/3D rendering framework which is still kind of relevant for python and doesn't have crappy performance? Preferably python 3.
Since I wanted to make my rendering systems core goals clearer, and I wanted it to be more standalone (plus I'm enjoying modular design thanks to cmake) I've pulled most of the scene and more advanced objects out of my rendering library. Now, instead of containing classes that compose it's various primitive Vulkan wrapper classes it's just the Vulkan wrapper classes. So the Scene is out, the objects (basic renderable geometries) are gone, and settings not directly relevant to graphics settings are gone too.
Problem is I'm having a hard time handling windowing. I'm not sure that having in here is the [I]best[/I] idea, but removing it would take a considerable quantity of work and having it integrated well into my instance/logical device handling is nice. Right now though, I'm not sure how to signal to whatever "scene" is using the GLFW window that the GLFW resize callback has been handled - it used to be this:
[cpp]
void Window::ResizeCallback(GLFWwindow* window, int width, int height) {
ImGuiIO& io = ImGui::GetIO();
if(width == 0 || height == 0) {
LOG(WARNING) << "Resize callback called with zero width or height for window. Attempting to fall back on last stored value...";
width = static_cast<int>(io.DisplaySize.x);
height = static_cast<int>(io.DisplaySize.y);
}
else {
io.DisplaySize = ImVec2(static_cast<float>(width), static_cast<float>(height));
}
BaseScene* scene = reinterpret_cast<BaseScene*>(glfwGetWindowUserPointer(window));
scene->RecreateSwapchain();
}
[/cpp]
I also need to get around to making my own "ImguiIO" kind of setup, too, since I don't want this tied explicitly to ImGui (but I still want to enable the imgui integration i have, if desired). So maybe I should store a callback there, or some kind of signal/flag that the swapchain is in need of resizing? The upper level objects will all need to be destroyed, then rebuilt, so its important that this signal is propagated well and easily accessible.
Not sure if I understand correctly. Are you trying to figure out how to identify what scene belongs to the resize event?
I take it then that 1 GLFwindow belongs to 1 Scene, correct?
GLFW provides a function that can store a pointer inside a GLFWwindow, such as:
[code]glfwSetWindowUserPointer(m_glfwwindow, m_scene_ptr);[/code]
Then within your resize callback, you can just retrieve the pointer and cast it:
[code]Scene &scene = *((Scene*)glfwGetWindowUserPointer(m_glfwwindow));[/code]
That's the way I've been handling it at least
[QUOTE=Karmah;52938574]Not sure if I understand correctly. Are you trying to figure out how to identify what scene belongs to the resize event?
I take it then that 1 GLFwindow belongs to 1 Scene, correct?
GLFW provides a function that can store a pointer inside a GLFWwindow, such as:
[code]glfwSetWindowUserPointer(m_glfwwindow, m_scene_ptr);[/code]
Then within your resize callback, you can just retrieve the pointer and cast it:
[code]Scene &scene = *((Scene*)glfwGetWindowUserPointer(m_glfwwindow));[/code]
That's the way I've been handling it at least[/QUOTE]
The scene is now part of a library that uses the above library's code, though. So in order to do this I'd have to include the scene class from the library that includes this library which is uh yeah. Your method is how I used to handle it, though.
I can store a pointer inside the window from the higher-level library, and retrieve it too I guess. I need to think about this more, I'm probably overthinking it and have way too much to do rn to really puzzle things out.
It sounds like a good fit for an event system to me, so the scene would attach a handler to a Resized event on the window, which would be dispatched at the end of ResizeCallback.
I don't know what your scene class does exactly but it seems a bit weird to me that it has anything to do with a window tbh.
But do agree with ziks here, something event based would be my solution here too.
[QUOTE=JWki;52940279]I don't know what your scene class does exactly but it seems a bit weird to me that it has anything to do with a window tbh.
But do agree with ziks here, something event based would be my solution here too.[/QUOTE]
probably going to need something like that. we'll see.
The base scene was as close as I got to a god class, and it could use some refactoring. It took care of combining everything you'd need to render a vulkan scene, and was honestly pretty easy to use and expand upon (so its not a complete disaster). But, I've since pulled scene and more abstract rendering concepts away from my sort of "toolkit/parts-box" library and that's caused weaknesses to be highlighted
im working on my "scenekit" project today, which should hopefully make things like this less of an issue (among other things). at some point, im gonna need events and delegates no matter what.
[editline]edited[/editline]
what has me stuck now is deciding if im going to make the coordinate system currently in-use a component of my various vectors and such, since i am going to be using this for very large-scale rendering and that will involve some coordinate transformations. i think. haven't got that far yet, but don't want to back myself into a corner this early on.
[CODE]if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "E-11"
SWEP.Author = "Syntax_Error752"
SWEP.ViewModelFOV = 50
SWEP.Slot = 2
SWEP.SlotPos = 3
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/E11")
killicon.Add( "weapon_752_e11", "HUD/killicons/E11", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "ar2"
SWEP.Category = "Star Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_E11.mdl"
SWEP.WorldModel = "models/weapons/w_E11.mdl"
// TTT Convertion Code \\
SWEP.Base = "weapon_tttbase"
SWEP.Kind = WEAPON_HEAVY
SWEP.AutoSpawnable = true
SWEP.AmmoEnt = "item_ammo_smg1_ttt"
SWEP.InLoadoutFor = nil
SWEP.AllowDrop = true
SWEP.IsSilent = false
SWEP.NoSights = false
// TTT Convertion Code \\
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
local FireSound = Sound ("weapons/E11_fire.wav");
local ReloadSound = Sound ("weapons/E11_reload.wav");
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 20
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.02
SWEP.Primary.ClipSize = 50
SWEP.Primary.Delay = 0.175
SWEP.Primary.DefaultClip = 150
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "ar2"
SWEP.Primary.Tracer = "effect_sw_laser_red"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector (-4.8, -10, 0.5)
function SWEP:PrimaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
if ( !self:CanPrimaryAttack() ) then return end
// Play shoot sound
self.Weapon:EmitSound( FireSound )
// Shoot the bullet
self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone )
// Remove 1 bullet from our clip
self:TakePrimaryAmmo( 1 )
if ( self.Owner:IsNPC() ) then return end
// Punch the player's view
self.Owner:ViewPunch( Angle( math.Rand(-1,1) * self.Primary.Recoil, math.Rand(-1,1) *self.Primary.Recoil, 0 ) )
// In singleplayer this function doesn't get called on the client, so we use a networked float
// to send the last shoot time. In multiplayer this is predicted clientside so we don't need to
// send the float.
if ( (game.SinglePlayer() && SERVER) || CLIENT ) then
self.Weapon:SetNetworkedFloat( "LastShootTime", CurTime() )
end
end
function SWEP:CSShootBullet( dmg, recoil, numbul, cone )
numbul = numbul or 1
cone = cone or 0.01
local bullet = {}
bullet.Num = numbul
bullet.Src = self.Owner:GetShootPos() // Source
bullet.Dir = self.Owner:GetAimVector() // Dir of bullet
bullet.Spread = Vector( cone, cone, 0 ) // Aim Cone
bullet.Tracer = 1 // Show a tracer on every x bullets
bullet.TracerName = self.Primary.Tracer
bullet.Force = 5 // Amount of force to give to phys objects
bullet.Damage = dmg
self.Owner:FireBullets( bullet )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) // View model animation
self.Owner:MuzzleFlash() // Crappy muzzle light
self.Owner:SetAnimation( PLAYER_ATTACK1 ) // 3rd Person Animation
if ( self.Owner:IsNPC() ) then return end
// CUSTOM RECOIL !
if ( (game.SinglePlayer() && SERVER) || ( !game.SinglePlayer() && CLIENT && IsFirstTimePredicted() ) ) then
local eyeang = self.Owner:EyeAngles()
eyeang.pitch = eyeang.pitch - recoil
self.Owner:SetEyeAngles( eyeang )
end
end
function SWEP:Reload()
if self:GetNWBool("Scoped") then
self.Weapon:SetNWBool("Scoped", false)
self.Owner:GetViewModel():SetNoDraw(false)
self.Owner:SetFOV( 0, 0.25 )
self:AdjustMouseSensitivity()
end
if (self.Weapon:Clip1() < self.Primary.ClipSize) then
if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then
self.Weapon:EmitSound( ReloadSound )
end
self.Weapon:DefaultReload( ACT_VM_RELOAD );
self:SetIronsights( false )
end
end
function SWEP:SecondaryAttack()
if ( !self.IronSightsPos ) then return end
if ( self.NextSecondaryAttack > CurTime() ) then return end
bIronsights = !self.Weapon:GetNetworkedBool( "Ironsights", false )
self:SetIronsights( bIronsights )
self.NextSecondaryAttack = CurTime() + 0.3
if self:GetNWBool("Scoped") then
self.Weapon:SetNWBool("Scoped", false)
self.Owner:GetViewModel():SetNoDraw(false)
self.Owner:SetFOV( 0, 0.25 )
self:AdjustMouseSensitivity()
elseif not self:GetNWBool("Scoped") then
self.Weapon:SetNWBool("Scoped", true)
self.Owner:GetViewModel():SetNoDraw(true)
self.Owner:SetFOV( 40, 0.25 )
self:AdjustMouseSensitivity()
self.Weapon:EmitSound( "weapons/scope_zoom_sw752.wav" )
end
end
function SWEP:AdjustMouseSensitivity()
if self:GetNWBool("Scoped") then
return 0.1
else if not self:GetNWBool("Scoped") then
return -1
end
end
end
function SWEP:DrawHUD()
if (CLIENT) then
if not self:GetNWBool("Scoped") then
local x, y
if ( self.Owner == LocalPlayer() && self.Owner:ShouldDrawLocalPlayer() ) then
local tr = util.GetPlayerTrace( self.Owner )
// tr.mask = ( CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE|CONTENTS_AUX )
local trace = util.TraceLine( tr )
local coords = trace.HitPos:ToScreen()
x, y = coords.x, coords.y
else
x, y = ScrW() / 2.0, ScrH() / 2.0
end
local scale = 10 * self.Primary.Cone
local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 )
scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 ))
surface.SetDrawColor( 255, 0, 0, 255 )
local gap = 40 * scale
local length = gap + 20 * scale
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
return;
end
local Scale = ScrH()/480
local w, h = 320*Scale, 240*Scale
local cx, cy = ScrW()/2, ScrH()/2
local scope_sniper_lr = surface.GetTextureID("hud/scopes/752/scope_synsw_lr")
local scope_sniper_ll = surface.GetTextureID("hud/scopes/752/scope_synsw_ll")
local scope_sniper_ul = surface.GetTextureID("hud/scopes/752/scope_synsw_ul")
local scope_sniper_ur = surface.GetTextureID("hud/scopes/752/scope_synsw_ur")
local SNIPERSCOPE_MIN = -0.75
local SNIPERSCOPE_MAX = -2.782
local SNIPERSCOPE_SCALE = 0.4
local x = ScrW() / 2.0
local y = ScrH() / 2.0
surface.SetDrawColor( 0, 0, 0, 255 )
local gap = 0
local length = gap + 9999
surface.SetDrawColor( 0, 0, 0, 255 )
--[[
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
]]--
render.UpdateRefractTexture()
surface.SetDrawColor(255, 255, 255, 255)
surface.SetTexture(scope_sniper_lr)
surface.DrawTexturedRect(cx, cy, w, h)
surface.SetTexture(scope_sniper_ll)
surface.DrawTexturedRect(cx-w, cy, w, h)
surface.SetTexture(scope_sniper_ul)
surface.DrawTexturedRect(cx-w, cy-h, w, h)
surface.SetTexture(scope_sniper_ur)
surface.DrawTexturedRect(cx, cy-h, w, h)
surface.SetDrawColor(0, 0, 0, 255)
if cx-w > 0 then
surface.DrawRect(0, 0, cx-w, ScrH())
surface.DrawRect(cx+w, 0, cx-w, ScrH())
end
end
end[/CODE]
It's a SWEP I tried to convert into a TTT wep. As you can probably tell, I'm new to all of this.
[QUOTE=SherbPK;52942269]
It's a SWEP I tried to convert into a TTT wep. As you can probably tell, I'm new to all of this.[/QUOTE]
[URL="https://gmod.facepunch.com/f/gmoddev"]go here[/URL], this isn't for anything related to gmod, or hell even source engine much
maybe a mod should start giving short bans for posting off-topic gmod help requests in here ;~;
I am trying to get this hierarchy and as little boilerplate as possible:
[code]A<B
^ ^
C<D
^ ^
E<F[/code]
where for each row, you can convert to the left but not the right (B is a A but not A is a B) and for each column you can convert up but not down (E is a C and also E is an A). You would also convert up before you convert left (so F is a B but also F is an A, but if we had func(A) and func(B), func(F) would call func(B)).
Each of these classes may have member functions and member variables that build up, so F has all the member functions that A,B,C,D,E implement, and possibly others. If we just use inheritance we get a lot of diamond hierarchy problems, and I would like to avoid that (as well as virtual overhead).
A really simple example is a reference type, so A would be a const reference and B would be a non const reference, and C and D would be the same but with some memoization.
To clarify, if we also have func(C) and func(B) and we call func(D) we would call func(B) over func(C) (but I can't imagine when this would be important and so maybe don't worry about it).
Hey guys, its not really help with code just a quick question in regards to what language I should program this project in. Looking to make a video synthesizer that works kinda like the analogue ones in order to make music videos for my songs. Its inspired by this mostly:
[media]https://www.youtube.com/watch?v=GRmxoRYfYdc[/media]
[media]https://www.youtube.com/watch?v=aiUdjksGzAE[/media]
[media]https://www.youtube.com/watch?v=ufgpCJxDDIg[/media]
I'm just wondering what language and maybe also libraries for said language I could use which would make it pretty simple to accomplish. I know C++, PHP, Python and Lua. Don't mind diving into a new language either.
I'm dealing with a compile error that's starting to really drive me crazy, because it doesn't make any [I]motherfucking sense goddamnit[/I]. Its making me irate. I'm trying to use boost::odeint's steppers to improve stepping in my simulation: I'm pretty sure they're going to better implemented (or at least more accurate) than mine, and I know they have alternatives for boosting performance with OpenMP, OpenCL, and even CUDA so I wanted to use them and test them against my own work. But, I get the following error when compiling:
[t]https://i.imgur.com/Ty9HZio.png[/t]
At first, I thought this might be some of the weird template changes that can come up when using boost with the c++17 standard enabled in the compiler, but switching to a C++14 compiler didn't work. then I thought it was due to me having two versions of boost installed: 1.62, what my compiler was trying to use, and 1.65, what my editor saw. This wasn't the case, either. So now I'm at my wits end. The code that causes the error is just this: (ignore PVvect, i claim no responsibility for that existing :v)
[t]https://i.imgur.com/JYY6kuh.png[/t]
This code is me following [URL="http://www.boost.org/doc/libs/1_65_1/libs/numeric/odeint/doc/html/boost_numeric_odeint/tutorial/harmonic_oscillator.html#boost_numeric_odeint.tutorial.harmonic_oscillator.integration_with_adaptive_step_size"]what is recommended and given as an example here[/URL], as close as I can. The rest is just me using other documentation to use a class-member function in the boost::odeint stuff. and the boost code that breaks is just this:
[t]https://i.imgur.com/p9qYlun.png[/t]
its driving me crazy. it all works if I don't use a controlled stepper (so fixed timestep, or lesser error checking), but that's not acceptable. Without controlled integration, the simulation explodes in less than 10 timesteps.
[QUOTE=paindoc;52946411]I'm dealing with a compile error that's starting to really drive me crazy, because it doesn't make any [I]motherfucking sense goddamnit[/I]. Its making me irate. I'm trying to use boost::odeint's steppers to improve stepping in my simulation: I'm pretty sure they're going to better implemented (or at least more accurate) than mine, and I know they have alternatives for boosting performance with OpenMP, OpenCL, and even CUDA so I wanted to use them and test them against my own work. But, I get the following error when compiling:
[t]https://i.imgur.com/Ty9HZio.png[/t]
At first, I thought this might be some of the weird template changes that can come up when using boost with the c++17 standard enabled in the compiler, but switching to a C++14 compiler didn't work. then I thought it was due to me having two versions of boost installed: 1.62, what my compiler was trying to use, and 1.65, what my editor saw. This wasn't the case, either. So now I'm at my wits end. The code that causes the error is just this: (ignore PVvect, i claim no responsibility for that existing :v)
[t]https://i.imgur.com/JYY6kuh.png[/t]
This code is me following [URL="http://www.boost.org/doc/libs/1_65_1/libs/numeric/odeint/doc/html/boost_numeric_odeint/tutorial/harmonic_oscillator.html#boost_numeric_odeint.tutorial.harmonic_oscillator.integration_with_adaptive_step_size"]what is recommended and given as an example here[/URL], as close as I can. The rest is just me using other documentation to use a class-member function in the boost::odeint stuff. and the boost code that breaks is just this:
[t]https://i.imgur.com/p9qYlun.png[/t]
its driving me crazy. it all works if I don't use a controlled stepper (so fixed timestep, or lesser error checking), but that's not acceptable. Without controlled integration, the simulation explodes in less than 10 timesteps.[/QUOTE]
I'm gonna be that guy that tells you that's what you get for using boost.
To be a bit more helpful, just in your last snippet I'd say what jumps on me is that you're using get_controller<Stepper>::type in your typedef while get_controller doesn't define type anywhere?+
Ah although that might actually be something that is added to the specific instance of the type via specification but just going from what you posted that's odd so assuming that that's some sort of compile time interface, it seems that your specific instantiation of the template is missing the typedef it should be having so maybe check that you're not missing a typedef on your end somewhere.
[QUOTE=JWki;52948264]I'm gonna be that guy that tells you that's what you get for using boost.[/QUOTE]
I'm well aware :v:
When it works well, things are great. When it doesn't, I want to strangle whoever made this. program_options was the last boost thing I used that worked well, and trying to use boost::python just led me to pybind11 lol
[QUOTE]To be a bit more helpful, just in your last snippet I'd say what jumps on me is that you're using get_controller<Stepper>::type in your typedef while get_controller doesn't define type anywhere?+
Ah although that might actually be something that is added to the specific instance of the type via specification but just going from what you posted that's odd so assuming that that's some sort of compile time interface, it seems that your specific instantiation of the template is missing the typedef it should be having so maybe check that you're not missing a typedef on your end somewhere.[/QUOTE]
I have to wonder if this is the case, as well. I'm trying to find more examples of using this library too.
Unfortunately despite the downsides of boost, it's already worked well when I've used it for uncontrolled integrators. It is at least a few times faster than what I've implemented, and the error buildup seems to be more linear. Its not entirely stable yet though, since I can't get the strictly controlled integration thing to work.
[editline]5th December 2017[/editline]
unless, god forbid, anyone else has suggestions for numerical integration libraries? I'm wondering if I could do something myself using Vulkan compute. The data I keep in the class used for calculating acceleration could probably be easily loaded into a texture, but it wouldn't be optimally accessed into a texture. So I'm wondering if I should break the compute job into two steps, with a push-constant used to push the calculated gravitational acceleration in between steps.
[editline]edited[/editline]
i'd lose double precision though, so that's not exactly ideal. hm.
Hey all, I'm not sure if this is the right place, but I'm working on a little something for work at the moment. What I've been asked to do is archive mailboxes to .PST using powershell in Exchange.
We're having some difficulties at the moment trying to find the correct command for it, as it seems everything we find on it relating to exchange 2010, which we are using, brings up an error.
I would send screenshots but it has work information/names, so I will copy paste the command and error we're having.
Command: new-mailboxexoirtrequest -identity (name, username or actual name brings up same error) -pstfolderpath c:\temp (as we are testing) -startdate 1/1/2010 -enddate 12/1/2017
Error: A positional parameter cannot be found that accepts argument '-identity'
+ Categoryinfo : Invalidargument: (:) [New-Mailboxexportrequest}, parameterbindingexception
+ FullyqualifiederrorID : positionalparameternotfound,new-mailboxexportrequest
+ PScomptuername : (domainname)
I'm very new to using powershell and don't really know what I am doing at the moment. I've just been testing trying to firstly change a single user's mailbox to a .PST so that we could expand on that and eventually create a script to mass archive old user mailboxes.
Spent quite a bit of time researching this, this is the best we've gotten so far and it has up stumped, we're running the exchange management powershell as administrator if that gives any information as well.
[editline]6th December 2017[/editline]
Ok guys, looks like I may have solved the problem i'm having. Used the command New-MailboxExportRequest -Mailbox first.last -filepath \\(server name)\c$\temp\Pascal_loschetter.pst and it's finally successfully created a .PST.
Now that's for one user, need to expand it to users that haven't logged in in a certain period of time. Or would I be best off having to do it individually (thankfully not a huge amount of users)
A couple things. I'm not super familiar with powershell, so I could be very wrong, but did you look at the documentation for the command? I presume you mean to use the command "New-MailboxExportRequest" and not "new-mailboxexoirtrequest". Assuming everything you told us is correctly typed, then this very well could be a problem. I assume you wont get the error that you specify however.
Another thing. There doesn't seem to be an -Identity parameter referenced in the documentation. Do you mean to use the required parameter "Mailbox"?
See: [url]https://technet.microsoft.com/en-us/library/ff607299(v=exchg.160).aspx[/url]
I'm working on my scene-kit esque library now, since my next big task is getting things to render. I'm running into a design dilemma though, and one I want to make sure I'm not approaching in the worst possible way.
I have a base triangle mesh class - intended to handle the setup and storage required for rendering a mesh that uses triangles w/ vertices+indices - that lots of my renderable objects inherit from. This is a pretty concrete class, and I feel fine in inheriting from that. I also have some renderable objects that don't inherit from this class at all though - like my Billboard class uses the geometry shader, so it doesn't really need to store any vertices and indices. They all however have a function with the same signature:
[cpp]
void Render(const VkCommandBuffer& cmd_buffer, const VkCommandBufferBeginInfo& begin_info, const VkViewport& vp, const VkRect2D& sc);
[/cpp]
I'm realizing I could really use some way to store the renderable objects so that I can iterate through and render them, so I was wondering if using multiple inheritance for this wouldn't be a terrible idea. In the case of those that already inherit from TriangleMesh, they would now inherit from an interface class like this:
[cpp]
class Renderable {
public:
Renderable() = default;
virtual ~Primitive();
virtual void Render(const VkCommandBuffer& cmd_buffer, const VkCommandBufferBeginInfo& begin_info, const VkViewport& vp, const VkRect2D& sc) = 0;
};
[/cpp]
This would at least let me store a list of the renderable objects in a scene, but I still don't much like using inheritance - let alone multiple inheritance, it really makes me question what I'm doing (and it makes me feel gross). This would solve a few issues, but it leaves a few more:
- What if I needed to sort the order things are rendered in? (although, I plan on using a forward+ implementation I found to do some kind of early culling and sorting)
- Could this be done with some kind of delegate function instead, rather than inheriting from an interface class?
- What about classes that need things like UBOs and push constants updated frequently, sometimes every frame? This is not at all exposed via the interface.
I'm trying to read through all of the books, presentations, and reports I have on how to approach this problem but I have yet to find anything that really feels like advice or input on this kind of situation or setup.
Inheritance isn't always the wrong approach, but you could also do with delegates. I'd measure first and then decide, are you sure the function call is the code's hotspot?
Sorry, you need to Log In to post a reply to this thread.