[QUOTE=joshdasmif;25267586]Nothing like writing lines and lines of lua is it? [/QUOTE]
The more complicated the game, the more you have to code.
[QUOTE=arienh4;25266949]The advantage of this is that you can update the game's assembly without breaking plugins.[/QUOTE]
Don't know how exactly that's better but it does sound like it should be better. Thanks for the advice.
[QUOTE=Darwin226;25268547]Don't know how exactly that's better but it does sound like it should be better. Thanks for the advice.[/QUOTE]
If you release a small bugfix or something which doesn't touch the plugin code at all, plugins don't have to be targeted for the new version before they will work.
[img]http://slashingedge.co.uk/hangman.png[/img]
Just finished my first Uni assignment - we had to make 'a word game' (the assignment was really vague) so I did hangman. It's in Perl and using butt-fucking-ugly Tk, which has a neat layout system but my GOD that's what it looks like in Linux and AFAIK there's no easy way of themeing it.
[img]http://slashingedge.co.uk/hangman-xna.png[/img]
But it's okay because then I ported it to XNA and set game.nextGenGraphics = true; and there's plenty of SSAO and grain and realtime sun-beams.
Writing code in nano looks painful.
[QUOTE=ROBO_DONUT;25270227]Writing code in nano looks painful.[/QUOTE]
Indeed. How can you do it? Nano is good for small general text editing but a decent editor like vim is a must for coding.
(Well, I suppose emacs works too, if you're that kind of a person.)
Writing code in Perl looks painful.
[QUOTE=ROBO_DONUT;25270227]Writing code in nano looks painful.[/QUOTE]
Nah, I code pretty quickly in nano. Alt+M, Alt+R, Alt+G, Ctrl+K, Ctrl+U and F3 are my friends. I usually have like five terminals open running nano and one open to run whatever interpreter/compiler I'm using.
What possibility's do i have at communicating between threads?. I am doing a really big scan within a gmod module and i don't want to keep the game hanging while it does.
(any good tut about threads would also be nice :))
[editline]08:57PM[/editline]
C++ btw
Some memory/data/objects/stuff shared between threads and a mutex?
We could probably give you a more detailed answer if you explained what sort of communication you need.
The problem is if i just give the thread a pointer to a data structure. I need to look on the main thread if it has changed and i can't do that with a loop because i would hang the game. I am looking for some kind of callback.
[editline]09:21PM[/editline]
So
I have a Module i "inject/require" in the engine. From there i do a scan for an address. When it succeeds i return a pointer when it does not it starts over again.
I suppose the scanning thread stops execution once it's finished? You can just use the IsAlive-function (that'd be the function for Valves CThread) to check if it still is running.
[QUOTE=ColdFusion;25275239]The problem is if i just give the thread a pointer to a data structure. I need to look on the main thread if it has changed and i can't do that with a loop because i would hang the game. I am looking for some kind of callback.[/QUOTE]
You still aren't giving details about the problem, so I'm still guessing.
You don't need any kind of loop or check or anything. You give both threads access to [i]anything[/i], and make each lock the mutex before accessing it.
So, suppose you're making a little 2D game and you want a surface to render a little animation (think video or GIF). In your main thread, you call the rendering function. The rendering function locks the mutex before blitting this surface and unlocks it when it's done.
You also have a video/GIF decoding thread, which decodes a frame and outputs it to the surface. You don't need access to the surface for general decoding or for the delay between frames, so all that can be done without locking the mutex. Whenever a frame is ready, you lock the mutex, update the surface, and unlock the mutex again.
The mutex prevents the main thread from trying to draw the surface while the video decoder is updating it, so the texture animates asynchronously without causing problems.
[QUOTE=ROBO_DONUT;25270227]Writing code in nano looks painful.[/QUOTE]
It's really, really not. I got used to it very quickly, bearing in mind I'd never used a terminal editor before.
[QUOTE=ROBO_DONUT;25259474]Do you mean computer architecture?[/QUOTE]
Yeah, anything you can recommend?
[QUOTE=efeX;25277832]Yeah, anything you can recommend?[/QUOTE]
Buy an MCU and write some assembly?
There aren't any [i]books[/i] in particular I'd recommend. The one I used in my computer architecture class was pretty much just a printed version of the processor's datasheet.
[QUOTE=efeX;25258852]Not sure if I'm going to word this right, but can someone recommend some good books on the low level things of programming,
like a book that would teach how the insides of how a computer works down to the registers and opcodes etc.[/QUOTE]
[url=http://www.amazon.com/Computer-Organization-Design-Hardware-Interface/dp/1558604286]Computer Organization & Design[/url] was my textbook for this, and I believe it's a fairly common one for introductory computer-engineering courses.
With pointers and references in c++
does it matter if you say
int* pointer1
as to
int *pointer1
same with the & reference
if it doesnt really matter, which would be the better way?
Syntactically it doesn't matter, and it's a matter of preference. Some people prefer to put the asterisk next to the type because pointer-ness is part of the type, but that can be misleading if you write
[code]int* x, y;[/code]
because that'll make x a pointer and y an int. If you wanted both to be pointers, you'd have to write
[code]int* x, * y;[/code]
which looks nicer when written
[code]int *x, *y;[/code]
You can think of this way: if "*x" means "the thing that x points to", then "int *x" means "(the thing that x points to) is an int", which implies that x is a pointer to an int.
Or you could write int*x or int * x or [code]int * x[/code]
They are both the same, but int *pointer1 is better as the * symbol binds to the variable name not the type name.
[QUOTE=killman;25279994]They are both the same, but int *pointer1 is better as the * symbol binds to the variable name not the type name.[/QUOTE]
Neither are really better. They're different.
What exactly is the difference between dictionaries and arrays, and in what situations would one be better than the other?
[QUOTE=ProWaffle;25285781]What exactly is the difference between dictionaries and arrays, and in what situations would one be better than the other?[/QUOTE]
This is actually quite a large distinction. A dictionary is a key-value store, where you have a set of keys (each of which are unique), and an equal number values (a 1:1 ratio). It lets you perform a lookup of a value based on a given key, so say for instance we have a key of "face", with a value of 3. If I call the dictionary and request the key "face", I'll be given the value of 3. I can later change the value that "face" points to (say 4) and any future requests for data from "face" will return the new value (in this case 4).
An array however is just an arbitrary number of values. (The phrase "set" cannot be applied to it because there can be duplicate values, unlike an actual set)
As for when one would be used over the other, it should be pretty easy to figure out with the above descriptions ;)
I just started messing with C++, and I wanted to make a class that will handle files, such as loading/logging stuff with SFML. Would this be the right way to go about it?
[code]
#include "FileHandling.h"
#include "time.h"
CFileHandler::CFileHandler()
{
char dateStr[9],fileName[128];
_strdate( dateStr );
sprintf(fileName,"Log_%s.log",dateStr);
printf("Name: %s",fileName);
pFile = fopen( FileName, "w+" );
if( pFile != NULL )
fclose(pFile);
// We now will re-open the file (since it's created)
// And append to it.
pFile = fopen( fileName, "a+" );
}
CFileHandler::~CFileHandler()
{
if( pFile != NULL )
fclose(pFile);
}
bool CFileHandler::UTIL_FILE_Log( int enumLog, const char Char[256] )
{
fputs( Char, pFile );
return true;
}
[/code]
Then use the class "CFileHandler myFiles" etc.
Also, does anybody know how to replace letter's inside a char? OR convert a char to a string? Since "fopen" takes a char.
[QUOTE=arienh4;25269821]If you release a small bugfix or something which doesn't touch the plugin code at all, plugins don't have to be targeted for the new version before they will work.[/QUOTE]
Nope, the whole compiled assembly dynamic loading shiz bang will work as long as you don't touch the plugin stuff
[QUOTE=Drak_Thing;25285921]I just started messing with C++, and I wanted to make a class that will handle files, such as loading/logging stuff with SFML. Would this be the right way to go about it?
[code]code[/code]
Then use the class "CFileHandler myFiles" etc.
Also, does anybody know how to replace letter's inside a char? OR convert a char to a string? Since "fopen" takes a char.[/QUOTE]
That isn't the C++ way of handling files. You should be using [url=http://www.cplusplus.com/reference/iostream/fstream/]streams[/url]. You're currently doing it the C way.
I myself prefer to write
[code]int* ptr;[/code]
Since the datatype of the variable ptr is a int pointer, it just makes more sense to me.
If anybody's familiar with Cocos2D for iPhone, could you answer my question here: [url]http://www.cocos2d-iphone.org/forum/topic/10137[/url]
Answer it here or there, doesn't matter.
Thanks!
i think i will use
int *ptr
its easier for me to think "the value of ptr is an int"
also as you said earlier it looks better when you put
int *ptr1, *ptr2, *ptr3;
Sorry, you need to Log In to post a reply to this thread.