[QUOTE=T3hGamerDK;33910700]
[cpp]
script::state* g_scriptState;
g_scriptState->CreateState();
[/cpp]
The program crashes at the second line.[/QUOTE]
You didn't initialize g_scriptState.
[QUOTE=ief014;33910825]You didn't initialize g_scriptState.[/QUOTE]
Haha, oh wow, can't believe I didn't see that.
Would I be able to do something like
[cpp]
script::state* g_scriptState = script::state;
[/cpp]
Or how am I to go about with this?
[QUOTE=T3hGamerDK;33910900]Haha, oh wow, can't believe I didn't see that.
Would I be able to do something like
[cpp]
script::state* g_scriptState = script::state;
[/cpp]
Or how am I to go about with this?[/QUOTE]
script::state * g_scriptState = new script::state();
[cpp]script::state *g_scriptState = new script::state;[/cpp] I think
[editline]27th December 2011[/editline]
Or with brackets yes but I believe that has subtle differences?
[QUOTE=esalaka;33910948][cpp]script::state *g_scriptState = new script::state;[/cpp] I think
[editline]27th December 2011[/editline]
Or with brackets yes but I believe that has subtle differences?[/QUOTE]
With brackets means it calls the constructor. If you have no brackets it will call the default parameter-less constructor. If you leave the brackets empty it will do the same thing.
That's what I thought as well, thanks for confirming.
Also, [url=http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a-difference-with-new]apparently with [del]structs[/del] PODs it matters[/url].
[QUOTE=ief014;33910937]script::state * g_scriptState = new script::state();[/QUOTE]
[QUOTE=esalaka;33910948][cpp]script::state *g_scriptState = new script::state;[/cpp] I think
[editline]27th December 2011[/editline]
Or with brackets yes but I believe that has subtle differences?[/QUOTE]
Fuck yes, it fucking works again! Thanks a million bunches guys! :D
I've been having that problem for days without realizing what was wrong! Thanks!
Yeah so basically use the brackets/parentheses so it always gets initialized if you didn't read that link of mine, by the way.
[QUOTE=AtomiCasd;33910566]Oh okay thanks you've been really helpful[/QUOTE]
I have some ideas how to approach the problem but this is largely speculation and original research. When I did some path plotting in a 3D environment for vehicles that retain their inertia (spaceships etc.) I couldn't find much resources online.
I assume that your movement is limited by some kind of flight mechanisms. If the vehicle can hover and accelerate arbitrarily, coming up with any path to the target is enough to get to the target. Find a path and place waypoints along it. This can be done with any standard pathfinding algorithm. However if the vehicle's motion is even more restricted, e.g. if it moves like a plane, I wouldn't even know where to start.
A hovering vehicle can simply move along straight lines from one waypoint to another to reach the target - calculating the accelerations required for this is simple. However this path will not be even close to the optimal path and any human could fly better than that. If the pathfinding algorithm needs to be competitive at all, the paths need to be optimized.
If you have a bunch of waypoints your vehicle is supposed to follow and you've calculated the accelerations required to move between those waypoints, you can optimize the path by "redistributing" the accelerations so that the second integral of the total acceleration remains the same - i.e. so that you should end up in the destination. Mathematically there's nothing difficult about it, but the problem is that there are an infinite amount of ways to do this and only some of them result in paths that don't collide with the geometry. You could build some kind of a solution tree where each branch alters the accelerations a bit while ensuring that the path still remains valid, and explore the tree to find a more optimal path.
One might make use of the knowledge that the more open space there is near a waypoint node, the more leniently the path can be altered around that node.
In short, it's a bitch to code.
<I make no sense>
[QUOTE=Octave;33885010]True object oriented program isn't possible in C though,[/QUOTE]
Even C++ doesn't offer true OO. 'True' OO is dynamic dispatch ala. Smalltalk.
[QUOTE=ThePuska;33912397]I have some ideas how to approach the problem but this is largely speculation and original research. When I did some path plotting in a 3D environment for vehicles that retain their inertia (spaceships etc.) I couldn't find much resources online.
I assume that your movement is limited by some kind of flight mechanisms. If the vehicle can hover and accelerate arbitrarily, coming up with any path to the target is enough to get to the target. Find a path and place waypoints along it. This can be done with any standard pathfinding algorithm. However if the vehicle's motion is even more restricted, e.g. if it moves like a plane, I wouldn't even know where to start.
A hovering vehicle can simply move along straight lines from one waypoint to another to reach the target - calculating the accelerations required for this is simple. However this path will not be even close to the optimal path and any human could fly better than that. If the pathfinding algorithm needs to be competitive at all, the paths need to be optimized.
If you have a bunch of waypoints your vehicle is supposed to follow and you've calculated the accelerations required to move between those waypoints, you can optimize the path by "redistributing" the accelerations so that the second integral of the total acceleration remains the same - i.e. so that you should end up in the destination. Mathematically there's nothing difficult about it, but the problem is that there are an infinite amount of ways to do this and only some of them result in paths that don't collide with the geometry. You could build some kind of a solution tree where each branch alters the accelerations a bit while ensuring that the path still remains valid, and explore the tree to find a more optimal path.
One might make use of the knowledge that the more open space there is near a waypoint node, the more leniently the path can be altered around that node.
In short, it's a bitch to code.[/QUOTE]
The true pain in the ass is that there is no nodes or waypoints to start with. Think an indoor enviroment in a video game with ventilation shafts, doorways, but also large open rooms. You want a flying object to find its way from point A to point B.(flying object as in it uses the z axis as well).
Now you have no nodes to start with and you want to find a path. No cheating of using the geometry to plot out nodes or anything. You can check if the node is within the geometry and use ray traces.
You can create a grid of nodes, but doesn't guarantee nodes in tight areas.
The main problem is finding a way to do some volumetric analysis of the world and put nodes where they are needed. I'm working on an octree approach(quad tree for 2d) by using cubes and subdividing those until nodes are within the world, but it's only on paper and I wonder if anyone has used this kind of method before.
What happens if a message is sent to an object, but that object does not implement that method? What is the next step after that? This is in Objective C, if that matters...
hi... i´m new in all of this stuff, and i´m trying to make my first gamemode... something like a zombie mod... but... my code doesn´t work... the code that change you the team (from human to zombie) i´ve tried a lot of ways, diferent functions, different ways, but nothing happens... i´ve found that the "if" sentence doesnt work... i´ll show the whole function that i think it should work
[code] function team_1( ply )
ply:StripWeapons() -- This command strips all weapons from the player.
ply:StripAmmo() -- This command strips all ammo from the player.
ply:SetTeam( 1 ) //Make the player join team 1
ply:Give("weapon_smg1") -- ...then give them the Gravity Gun.
ply:GiveAmmo(1000,"smg1")
ply:SetModel( "models/player/combine_super_soldier.mdl" )
ply:SetHealth( "60" )
ply:PrintMessage( HUD_PRINTTALK, "[ZombieMod] Sos un Sobreviviente! Corre de los Zombies! " .. ply:Nick() )
if (ply:Health() < 50) then
ply:PrintMessage( HUD_PRINTTALK, "[SimpleBuild]THIS DOESNT WORK! " .. ply:Nick() )
end
end
[/code]
the "if" is at the end
ive put it at "function team_1" because the gamemode worked... but if i put it in other function... the gamemode doesnt work :S
ive written the "PrintMessage" because i wanted to see if the problem was the "if" or what goes there (ply:SetTeam( 2 ))
i really want to finish this :S
i´ll be waiting for help, thanks
[code]ply:SetHealth( "60" )[/code]
wouldn't SetHealth take a number, not a string?
[code]ply:SetHealth( 60 )[/code]
[QUOTE=ief014;33928089][code]ply:SetHealth( "60" )[/code]
wouldn't SetHealth take a number, not a string?
[code]ply:SetHealth( 60 )[/code][/QUOTE]
it worked for me... but i need help with the IF sentence, i need to make the humans convert to zombies... or you can just write a line for me... that makes the humans to zombies...
[QUOTE=xbloodyx;33928925]it worked for me... but i need help with the IF sentence[/QUOTE]
What's wrong with the if statement? Do you want it to execute or not? By the looks of it, you don't want it to.
From what I see, you're setting the health to 60, then doing a check afterwards to see if it is less than 50 (which should always be false). It made me believe that ply:SetHealth("60") was causing an issue because you're passing a string instead of a number.
I'm going to assume here that you want to check the health of all players and if they happen to be below 50 health, something happens. That if statement you have up there will only be ran once, and that is when the function team_1 is ran. I assume this function is ran once, because it does alot of initialisation on the player. Are you sure you wouldn't rather want that if statement in a think hook? That seems to me the most obvious and easiest solution.
[QUOTE=Capsup;33928975]I'm going to assume here that you want to check the health of all players and if they happen to be below 50 health, something happens. That if statement you have up there will only be ran once, and that is when the function team_1 is ran. I assume this function is ran once, because it does alot of initialisation on the player. Are you sure you wouldn't rather want that if statement in a think hook? That seems to me the most obvious and easiest solution.[/QUOTE]
how i do that? sorry im new in this... i want that when the humans (team_1) health is below to 50, the human convert to a zombie (team_2)
ive thinking to make that when a zombie hits a human, it will convert into a zombie... but i think that would be more advanced...
I asked (and accomplished) this before, but I'm going to redo it on a larger scale. What's the best way to do a stats system for a video game, that can be read from a browser.
I figure use libcurl to send information from the dll's to a php form. That form will submit and enter into a sql database. Good?
[editline]28th December 2011[/editline]
[QUOTE=Capsup;33928975]I'm going to assume here that you want to check the health of all players and if they happen to be below 50 health, something happens. That if statement you have up there will only be ran once, and that is when the function team_1 is ran. I assume this function is ran once, because it does alot of initialisation on the player. Are you sure you wouldn't rather want that if statement in a think hook? That seems to me the most obvious and easiest solution.[/QUOTE]
Actually it'd be better in a takedamage hook.
[QUOTE=xbloodyx;33929064]...[/QUOTE]
If I'm understanding you correctly, you should be putting your if statement that'll cause a team switch in your "receive damage" function. As it stands above, you're only checking when a player is initialised, which as has been stated, will never return true as you only just set said player's health above the threshold.
(oh, already covered)
Anyone familiar with AutoHotKey?
I'm trying to do something rather primitive - automatic power slide in Crash Team Racing.
Here's my current script (not working)(probably all wrong)
[quote]~LShift & ~ô::
Sleep 1000
Send {RShift}
Sleep 500
Send {RShift}
Sleep 500
Send {RShift}
~LShift up::
return[/quote]
LShift works like L1 and RShift like R1. ô is throttle (X button).
The point is, to perform a powerslide, first you need to hold L1 and get in drift (L1 makes cart jump, that takes 500ms) and press R1 when boost bar fills up (roughly another 500ms) and then it boosts you. Then boost bar starts filling again, and again, to max of 3 boosts per drift.
This guy does it non-stop:
[media]http://www.youtube.com/watch?v=fZ6KNd28pKk[/media]
Automatic turbo slide would be pointless since at times you have to stop doing it for a while to time the boosts correctly
Well, currently I can't perform it effectively at all, since I have to let go all keys except LShift and RShift.
It does boost me, but I can't control it and I lose power so it's kinda pointless.
/still, we should discuss script itself in this thread
Hi, back again with a new problem. I've been working a lot recently on tile-based games (in Java) and decided today to touch (at last) on perlin noise.
I've read what resources I could find (shockingly few, really), and taken a lot from code examples and the like, and I have a successful noise generator [i]of some kind[/i].
I wouldn't say by the looks of it that it's generating perlin noise at all, but comparing it to noise generated by simple random values shows that it is indeed making a much nicer gradient.
Here's the grayscale generated by simple random values:
[IMG]http://dl.dropbox.com/u/38489921/noise.png[/IMG]
And here's the grayscale generated by my supposed perlin noise algorithm:
[IMG]http://dl.dropbox.com/u/38489921/noisep.png[/IMG]
All I see is a change in general colouration from darker to lighter, and no pattern of any kind of smooth transition, certainly not any kind of cloud pattern that you normally see people referring to as perlin noise.
I believe my algorithm contains all necessary logic to create perlin noise, and I thought that it'd be nice of me to post it:
[URL="http://pastie.org/3086100"]Generator.java[/URL]
If anyone's willing to help, I'd love to know what (if anything) I'm doing wrong and why my noise doesn't look so perlin.
Thanks much for your time.
Hey. I'm having difficulties compiling SFML 2.0 for .Net. If anyone has a semi-new version of the compiled DLLs, could you be so kind as to upload them?
The reason I'm not using 1.6 is because it won't open the RenderWindow. After reading around a bit, I figured it was caused by my ATI card, so no way around, I guess. I also really like the new functionality of 2.0.
[QUOTE=snorre89;33937875]Hey. I'm having difficulties compiling SFML 2.0 for .Net. If anyone has a semi-new version of the compiled DLLs, could you be so kind as to upload them?
The reason I'm not using 1.6 is because it won't open the RenderWindow. After reading around a bit, I figured it was caused by my ATI card, so no way around, I guess. I also really like the new functionality of 2.0.[/QUOTE]
I need this too. I have tried using SFML several times, but this problem always get me stumped and I give up.
[QUOTE=snorre89;33937875]Hey. I'm having difficulties compiling SFML 2.0 for .Net. If anyone has a semi-new version of the compiled DLLs, could you be so kind as to upload them?
The reason I'm not using 1.6 is because it won't open the RenderWindow. After reading around a bit, I figured it was caused by my ATI card, so no way around, I guess. I also really like the new functionality of 2.0.[/QUOTE]
[QUOTE=Matte;33938237]I need this too. I have tried using SFML several times, but this problem always get me stumped and I give up.[/QUOTE]
Here you go, guys.
I've only built them as static libs, for Visual C++ 2010. Includes both debug and releases. This is a fairly new release of them.
[url]http://filesmelt.com/dl/sfml2_vs2010_static.rar[/url]
Oh wow. I didn't see that you want it for .NET. oops :v
Here's the .NET binding of SMFL2: [url]http://filesmelt.com/dl/sfml2-dotnet_binding.rar[/url]
What graphic library do you guys recommend if i just want to do simple applications like a graphic calculator (much like the standard Windows one)?
I've had a look at OpenGL but it seems like i don't really need that much.
C# and winforms
Sorry, you need to Log In to post a reply to this thread.