[img]http://puu.sh/1Lswj[/img]
Trying to get a valid variable name and pushing it on the stack as a whole
in a switch statement out of single
characters and using regex and making sure they're pushed on the stack correctly
and pushing numeric values as integers instead of strings - is simply an overkill.
Anybody get a better idea to do something like this?
There needs to be one space between a valid variable name and every other character
Like this:
[img]http://puu.sh/1LsFE[/img]
[QUOTE=cartman300;39150612][IMG]http://puu.sh/1Lswj[/IMG]
Trying to get a valid variable name and pushing it on the stack as a whole
in a switch statement out of single
characters and using regex and making sure they're pushed on the stack correctly
and pushing numeric values as integers instead of strings - is simply an overkill.
Anybody get a better idea to do something like this?
There needs to be one space between a valid variable name and every other character
Like this:
[IMG]http://puu.sh/1LsFE[/IMG][/QUOTE]
Why are you requiring that exact format when there doesn't seem to be any reason why it would make parsing easier?
[QUOTE=supersnail11;39150642]Why are you requiring that exact format when there doesn't seem to be any reason why it would make parsing easier? You also might want to write a lexer.[/QUOTE]
I AM trying to write a lexer, the problem is there needs to be a whitespace between a valid variable name and every other character, so i can simplify
adding operators and keywords.
Added some more settings to Dwarfpunch Mapper. We decided that the tints were too strong over the textures, so now we'll be able to easily test new default values.
[QUOTE=Bumrang;39150306]Not really. Nobody cares about honor, it's just a gimmick. Everybody already has a red ribbon, people only care about blue/green/yellow ribbons because they're actually quite hard to get, but even then it doesn't mean anything.[/QUOTE]
I don't play ever (I'm assuming matchmaking works by level, can't remember from last time), so I must just be at the point where people have played enough to know about it, but not enough to not care anymore.
[QUOTE=Spero78;39150414]Just realized you are using C# Express, Extensions aren't available to express editions[/QUOTE]
whatta load of shit
thanks though mate
[QUOTE=cartman300;39150682]I AM trying to write a lexer, the problem is there needs to be a whitespace between a valid variable name and every other character, so i can simplify
adding operators and keywords.[/QUOTE]
Names and keywords are made of letters, digits (first character can't be a digit though, that makes it a number) and a few symbols such as underscores. They can not contain operators so operators can be used to separate them. In many languages whitespace does not affect the interpretation of code as it is completely ignored (look at minified JS).
[url=http://en.wikipedia.org/wiki/Lexical_analysis#Tokenizer]Tokenization[/url]
[url=https://github.com/DatZach/Xi/blob/master/Source/Lexer/Tokenizer.cs]DatZach's incomplete tokenizer[/url]
[QUOTE=cartman300;39150682]I AM trying to write a lexer, the problem is there needs to be a whitespace between a valid variable name and every other character, so i can simplify
adding operators and keywords.[/QUOTE]
I realized you were writing a lexer after I posted it. Without context it's hard to understand.
I asked this a couple days, maybe a week ago but didn't get a solid answer.
How and what are tick rates in games? How does one implement them? How do they differ from frame rate? From what I've gathered it's a constant number of times that the game logic is run each second, or something?
[QUOTE=false prophet;39151192]I asked this a couple days, maybe a week ago but didn't get a solid answer.
How and what are tick rates in games? How does one implement them? How do they differ from frame rate? From what I've gathered it's a constant number of times that the game logic is run each second, or something?[/QUOTE]
[url]http://gafferongames.com/game-physics/fix-your-timestep/[/url]
[editline]8th January 2013[/editline]
You probably want to read the previous one first though, to get some context: [url]http://gafferongames.com/game-physics/integration-basics/[/url]
[QUOTE=false prophet;39151192]I asked this a couple days, maybe a week ago but didn't get a solid answer.
How and what are tick rates in games? How does one implement them? How do they differ from frame rate? From what I've gathered it's a constant number of times that the game logic is run each second, or something?[/QUOTE]
From a quick google search, it's what Valve calls framerate for servers (which is correct, since there's technically no frames to put up on the screen).
A tickrate of 33 means that the server will simulate the world and update clients 33 times every second. If that takes less than ~30ms (1/33), then the server will sleep or do something else until it's time for the next update.
Basically the same thing the client does with it's framerate, but framerate is typically limited to the screen's refresh rate to prevent vertical tearing.
[editline]8th January 2013[/editline]
And also if the update takes longer than the amount of allotted time, the next frame will try to catch up by simulating the world multiple times or something. Basically what ECrownofFire's links do.
[QUOTE=MadPro119;39150751]whatta load of shit
thanks though mate[/QUOTE]
May I ask whats keeping you from using Visual Studio 2012? It's Dark theme seems to be just what you need.
Also get ready to whip out your funny ratings... As you all may know I'm writing a C# library which is being compiled into a Unmanaged library to do all the things I could do in C++ and friends but not because I'm not interested in learning another language to do something I can do in this one.
Well I just found out I wouldn't be able to do VFTables (Virtual Function Tables) in C# due to limitations in GetFunctionPointerForDelegate... Looking at you Microsoft.. Only allowing it to do __stdcall.... Well to get around this I could Spam exports for every function I wanted to use but thats just unsightly and just bad coding on my end. Not wanting to dive deeper into the world of hardcore asm programing. EX Code reallocation I decided to turn x86 assembly into a scripting language and do the work that needs VFTables in ASM. Got my self a fancy little Assembler written in C# which is pretty quick and only supports the basics, Nothing fancy like FPU and friends. Also threw together a little ScriptManager that supports Loading, Unloading, Reloading, Generating VFTables, and Applying call patches. It's really funny how using ASM as a scripting language in C# was easier then using C# as a scripting language in C#. :pwn:
I'm working on [url=https://www.coursera.org/course/compdata]this[/url].
[url=http://en.wikipedia.org/wiki/R_(programming_language)]R[/url] is a pretty cool language.
I woke up today and felt like shit, so I skipped work and got out of bed in the early afternoon. Then I made an animation system using sprite sheets and YAML files.
[video=youtube;dD7TGXOiWbI]http://www.youtube.com/watch?v=dD7TGXOiWbI[/video]
[QUOTE=anthonywolfe;39151388]May I ask whats keeping you from using Visual Studio 2012? It's Dark theme seems to be just what you need.
Also get ready to whip out your funny ratings... As you all may know I'm writing a C# library which is being compiled into a Unmanaged library to do all the things I could do in C++ and friends but not because I'm not interested in learning another language to do something I can do in this one.
Well I just found out I wouldn't be able to do VFTables (Virtual Function Tables) in C# due to limitations in GetFunctionPointerForDelegate... Looking at you Microsoft.. Only allowing it to do __stdcall.... Well to get around this I could Spam exports for every function I wanted to use but thats just unsightly and just bad coding on my end. Not wanting to dive deeper into the world of hardcore asm programing. EX Code reallocation I decided to turn x86 assembly into a scripting language and do the work that needs VFTables in ASM. Got my self a fancy little Assembler written in C# which is pretty quick and only supports the basics, Nothing fancy like FPU and friends. Also threw together a little ScriptManager that supports Loading, Unloading, Reloading, Generating VFTables, and Applying call patches. It's really funny how using ASM as a scripting language in C# was easier then using C# as a scripting language in C#. :pwn:[/QUOTE]
Nothings holding me back. Too lazy to check if its perma free and works fine with XNA. Will probably get it tmrw.
[QUOTE=MadPro119;39151670]Nothings holding me back. Too lazy to check if its perma free and works fine with XNA. Will probably get it tmrw.[/QUOTE]
The Express Edition is permanently free and XNA projects are uhh still buildable but don't hold your breath for the GameStudio to get updated, It took awhile for it to update when Vs2010 came out.
It took me a lot of dicking about in classes and subclasses and string substitutions and shit, but I did it: It only takes one line to put a sprite in play.
[code]placeholder = gfx.sprites.StaticSprite("dev_placeholder")[/code]
results in
[img]https://dl.dropbox.com/u/5733962/ShareX/2013-01/2013-01-08_23-43-16.png[/img]
now I need to finish animated sprites.
So, I finally decided to start getting into LWJGL and openGL. I'm a totally beginner with openGL, but found a tutorial list that really seems to work for me: [url]http://www.youtube.com/playlist?list=PL19F2453814E0E315[/url]
Now, it appears that he's using OpenGL1.1 throughout the guide. Is it a bad idea to start with 1.1, or should I rather try and find something with the never versions?
[QUOTE=Zyx;39152484]So, I finally decided to start getting into LWJGL and openGL. I'm a totally beginner with openGL, but found a tutorial list that really seems to work for me: [url]http://www.youtube.com/playlist?list=PL19F2453814E0E315[/url]
Now, it appears that he's using OpenGL1.1 throughout the guide. Is it a bad idea to start with 1.1, or should I rather try and find something with the never versions?[/QUOTE]
OpenGl 1.1 is quite dated, it offers legacy support for a lot of hardware. And I suppose it would be similar to OpenGl es for mobile devices (Because OpenGl es 1.1 is similar to OpenGl 1.3. Although OpenGl es is similar to OpenGl 2.0). However you would be learning an older framework, and you would need to learn new concepts if you wanted to move to a newer version of OpenGl.
I personally have almost no experience with OpenGl, however I could never get started with it. I found it difficult, and I have a small attention span. I would recommend giving something else a try, I've heard good things about libGdx
However if you're set on OpenGl, I would move up a few versions.
[QUOTE=Zyx;39152484]Is it a bad idea to start with 1.1[/QUOTE]
[highlight]YES[/highlight]
Don't even consider anything <2 unless you're working on some kind of ancient legacy hardware that can't run it.
[QUOTE=Lexic;39152929][highlight]YES[/highlight]
Don't even consider anything <2 unless you're working on some kind of ancient legacy hardware that can't run it.[/QUOTE]
I would suggest at least CornELl3 for large hardware and feature support.
[QUOTE=Matt-;39152963]CornELl3[/QUOTE]
What?
With version 3.0 came huge fundamental changes to OpenGL. You shouldn't go lower then 3.0.
Generally
OpenGL 3.2 runs on [I]some [/I]DirectX 9 hardware
OpenGL 3.3 runs on DirectX 10 hardware
OpenGL 4.0+ runs on DirectX 11 hardware(even modern integrated graphics support it)
What i suggest is that you, just use whatever your tutorial/book covers as long as it it version 3.x or higher.
Links:
[url]http://www.arcsynthesis.org/gltut/[/url] (3.3)
[url]http://www.opengl-tutorial.org/[/url] (3.3)
[url]http://www.mbsoftworks.sk/index.php?page=tutorials&series=1[/url] (3.3)
[url]http://cold.netburst.co.uk/file/Addison.Wesley.OpenGL.SuperBible.5th.Edition.Jul.2010.pdf[/url] (a book)
[url]http://ogldev.atspace.co.uk/index.html[/url] (mainly good for some more advanced subjects)
[url]http://www.swiftless.com/opengltuts/opengl4tuts.html[/url] (only covers absolute basics, but is very good)
[QUOTE=OldFusion;39153260]With version 3.0 came huge fundamental changes to OpenGL. You shouldn't go lower then 3.0.
Generally
OpenGL 3.2 runs on [I]some [/I]DirectX 9 hardware
OpenGL 3.3 runs on DirectX 10 hardware
OpenGL 4.0 runs on DirectX 11 hardware
C[/QUOTE]And OpenGL's extension mechanism means that you can get OpenGL "3.2" level features on hardware that don't support the full OpenGL 3.2 core specification.
I made the most elaborate function for XORing large amounts of memory with a 32-bit key that I could justify
[cpp]/* Requires SSE2 */
char *xor(uint32_t key, char *dst, size_t count)
{
char *ret = dst;
int off = 8;
/* Align dst to 16 bytes */
{
size_t cmax0 = 0x10 - (size_t)dst & 0xf;
size_t cmax = (count < cmax0) ? count : cmax0;
size_t n = cmax / 4;
/* XOR 4 bytes at a time when possible. */
while (n--)
{
*(uint32_t *)dst ^= key;
dst += 4;
}
/* XOR the last 3 bytes one at a time. */
switch (cmax & 0x3)
{
case 3: *dst ^= key >> off;
off += 8;
dst++;
case 2: *dst ^= key >> off;
off += 8;
dst++;
case 1: *dst ^= key >> off;
dst++;
case 0: break;
}
count -= cmax;
off -= 8;
}
/* Rotate the key left if the alignment used some of the key's bytes. */
key = (key << off) | (key >> (32 - off));
/* dst is aligned, use SSE. */
{
const __m128i kmask = _mm_set1_epi32((int)key);
__m128i cur;
__m128i tmp;
/* Load 16 bytes at a time, XOR them and store them. */
while (count >= 16)
{
cur = _mm_load_si128((__m128i *)dst);
tmp = _mm_xor_si128(cur, kmask);
_mm_store_si128((__m128i *)dst, tmp);
dst += 16;
count -= 16;
}
if (count)
{
/* There are still some bytes left.
* Load and XOR the next 16 bytes, but store only as many as are required.
* Note: this is a buffer overflow by design.
* It will not cause an access violation, because an aligned __m128 will never
* cross the page boundary, and it won't clobber the overflowed memory. */
const __m128i masks [15] = {
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255) };
cur = _mm_load_si128((__m128i *)dst);
tmp = _mm_xor_si128(cur, kmask);
_mm_maskmoveu_si128(tmp, masks[count - 1], dst);
}
}
return ret;
}[/cpp]
[QUOTE=Lexic;39152929][highlight]YES[/highlight]
Don't even consider anything <2 unless you're working on some kind of ancient legacy hardware that can't run it.[/QUOTE]
Well, using the higher versions sure does make it hell of a lot more difficult. Especially because everything I can find is a c++ tutorial or not in video format.
[QUOTE=Zyx;39153888]Well, using the higher versions sure does make it hell of a lot more difficult. Especially because everything I can find is a c++ tutorial or not in video format.[/QUOTE]
[url]http://open.gl[/url]
[url]http://www.arcsynthesis.org/gltut/[/url]
[url]http://www.opengl.org/sdk/docs/man/[/url]
If you need more help you can drop into ##opengl on irc.freenode.net
[QUOTE=Lexic;39153055]What?[/QUOTE]
Oh. Android auto correct is sneaky. I meant OpenGL.
[QUOTE=Zyx;39153888]Well, using the higher versions sure does make it hell of a lot more difficult. Especially because everything I can find is a c++ tutorial or not in video format.[/QUOTE]
Not sure why you would want a video tutorial on something like this.
But, for the language problem, the reason why you can't find much java is,
because most java developers just work with the C++ tutorials,
the language is easily similar enough to java, to be readable and easily understandable for you.
95% of the code covered in almost every tutorial are only OpenGL calls.
Chunks like this
[cpp]glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(theProgram);
glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(0);
glUseProgram(0);
glutSwapBuffers();[/cpp]
That even that they where written for C++ there is nothing more too it then Copy pasting them.
EDIT:
There is a java port of the OpenGL superbible libaries and example code, here:
[url]https://code.google.com/r/zaphosmatthewnicholls-opengl-superbible-java/source/browse/#hg%2FOpenGLSuperBible%253Fstate%253Dclosed[/url]
[QUOTE=ThePuska;39153799]I made the most elaborate function for XORing large amounts of memory with a 32-bit key that I could justify
[cpp]/* Requires SSE2 */
char *xor(uint32_t key, char *dst, size_t count)
{
char *ret = dst;
int off = 8;
/* Align dst to 16 bytes */
{
size_t cmax0 = 0x10 - (size_t)dst & 0xf;
size_t cmax = (count < cmax0) ? count : cmax0;
size_t n = cmax / 4;
/* XOR 4 bytes at a time when possible. */
while (n--)
{
*(uint32_t *)dst ^= key;
dst += 4;
}
/* XOR the last 3 bytes one at a time. */
switch (cmax & 0x3)
{
case 3: *dst ^= key >> off;
off += 8;
dst++;
case 2: *dst ^= key >> off;
off += 8;
dst++;
case 1: *dst ^= key >> off;
dst++;
case 0: break;
}
count -= cmax;
off -= 8;
}
/* Rotate the key left if the alignment used some of the key's bytes. */
key = (key << off) | (key >> (32 - off));
/* dst is aligned, use SSE. */
{
const __m128i kmask = _mm_set1_epi32((int)key);
__m128i cur;
__m128i tmp;
/* Load 16 bytes at a time, XOR them and store them. */
while (count >= 16)
{
cur = _mm_load_si128((__m128i *)dst);
tmp = _mm_xor_si128(cur, kmask);
_mm_store_si128((__m128i *)dst, tmp);
dst += 16;
count -= 16;
}
if (count)
{
/* There are still some bytes left.
* Load and XOR the next 16 bytes, but store only as many as are required.
* Note: this is a buffer overflow by design.
* It will not cause an access violation, because an aligned __m128 will never
* cross the page boundary, and it won't clobber the overflowed memory. */
const __m128i masks [15] = {
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255),
_mm_set_epi8(0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255) };
cur = _mm_load_si128((__m128i *)dst);
tmp = _mm_xor_si128(cur, kmask);
_mm_maskmoveu_si128(tmp, masks[count - 1], dst);
}
}
return ret;
}[/cpp][/QUOTE]
cool, is it much faster than just xoring 4 bytes?
[QUOTE=Zyx;39153888]Well, using the higher versions sure does make it hell of a lot more difficult.[/QUOTE]
If you want easy try GameMaker.
You're using a spectacularly powerful low-level library to talk directly to your GPU to make it jump and dance through hoops to produce realtime 3D graphics. Ease of getting started was not a consideration taken in the design stage.
Sorry, you need to Log In to post a reply to this thread.