[QUOTE=VeryNiceGuy;25552436]But hey, who uses wordpad?[/QUOTE]
Nobody, but it's still a target to aim for and then improve on.
[QUOTE=BlkDucky;25551257]Better than notepad, but at the moment it's still inferior to Wordpad. Yes, wordpad still exists, apparently.[/QUOTE]
I use notepad for most of my school assignments (and then paste it into word to do formatting).
I fixed the saving crash, by the way. I don't quite know how to fix the CTRL+Mousewheel -> Reset zoom problem though. Hm..
I have been working on my terrain generator/3D learning experience. It uses perlin noise to generate the terrain.
[IMG]http://i54.tinypic.com/vhf22v.jpg[/IMG]
I have also been able to implement a FPS style camera, but am using the keyboard at the moment for movement.
I have a question though. The ball you see in the picture follows the camera position-wise but it doesn't move along with camera's point of view (where the camera is looking). I have been trying to figure out how to work with 3D vectors, it becomes a bit difficult trying to incorporate everything at once. So I am asking you, how can I manage to keep the ball at a fixed distance from the camera (for example 100 units) but at the same time on the same axis as the camera's look vector. I am using cumulative pitch/yaw/roll values and constantly normalizing up/look/right to create rotation if it is going to help.
Thanks a lot!
Learn about quaternions:
camera.getOrientation().rotateVector( Vector3::FORWARD ) * distance;
where getOrientation returns a quaternion.
[editline]22nd October 2010[/editline]
Code doesn't get much more beautiful than that :australia:
[img]http://gyazo.com/6b32e47a3cb80984badb968f760c7d21.png[/img]
Character renowned implemented as well as character pronouns (males are referred to as 'he' etc.)
Also improved stuff for echoey rooms: dropping stuff now makes a sound that can echo.
So I'm trying to port my XNA engine over to SlimDX, and I would [B]REALLY[/B] appreciate if someone could help me figure out how to use it. Guiding me to at least a level of drawing several textured triangles is already enough.
Thanks :dance:
I hate when you remove white space and you have to recompile, I also can't go to bed unless my code is compiled.
Better go to bed now, got a big day tomorrow (seeing metallica liveeeee :rock: )
[QUOTE=BlkDucky;25553328][img_thumb]http://gyazo.com/6b32e47a3cb80984badb968f760c7d21.png[/img_thumb]
Character renowned implemented as well as character pronouns (males are referred to as 'he' etc.)
Also improved stuff for echoey rooms: dropping stuff now makes a sound that can echo.[/QUOTE]
Make it multiplayer :v:
[QUOTE=thomasfn;25553551]Make it multiplayer :v:[/QUOTE]
I am seriously considering it. But I've never done any network programming before. Is it an easy thing to learn/adapt into existing code?
[QUOTE=BlkDucky;25553609]I am seriously considering it. But I've never done any network programming before. Is it an easy thing to learn/adapt into existing code?[/QUOTE]
Depends on how much you have done. If you haven't really done a lot, it should be easy to implement.
[QUOTE=BlkDucky;25553609]I am seriously considering it. But I've never done any network programming before. Is it an easy thing to learn/adapt into existing code?[/QUOTE]
What language are you doing it in? It would be much easier to implement in c# than in c++. I don't know about any other languages though. If you're using a good modular system (oop, classes and stuff), then adding a clientside connection class and tying it in with the current system shouldn't be too hard.
[QUOTE=BlkDucky;25553609]I am seriously considering it. But I've never done any network programming before. Is it an easy thing to learn/adapt into existing code?[/QUOTE]
If you can find a library that abstracts things somewhat it's as easy as user messages in garry's mod.
[QUOTE=thomasfn;25553689]What language are you doing it in? It would be much easier to implement in c# than in c++. I don't know about any other languages though. If you're using a good modular system (oop, classes and stuff), then adding a clientside connection class and tying it in with the current system shouldn't be too hard.[/QUOTE]
It is C++. And I think it's fairly well-written in terms of classes etc. It's stable to the point that I can switch to a different character on-the-fly with it's own inventory, stats etc. All the commands like take, drop, say etc. are in the character class itself and points to the room it's in currently.
It doesn't SOUND too hard, but it's probably harder than I think it is.
Xerios are you slowly working your way through every 3D engine known to exist?
(or was that someone else? I forget)
[QUOTE=Catdaemon;25553707]If you can find a library that abstracts things somewhat it's as easy as user messages in garry's mod.[/QUOTE]
Don't suppose you know any? :rolleyes:
[QUOTE=BlkDucky;25553841]Don't suppose you know any? :rolleyes:[/QUOTE]
Not really used many because I'm happy with doing it all myself, but I hear good things about raknet.
[QUOTE=CarlBooth;25553827]Xerios are you slowly working your way through every 3D engine known to exist?[/QUOTE]
Yes.
[QUOTE=BlkDucky;25553609]I am seriously considering it. But I've never done any network programming before. Is it an easy thing to learn/adapt into existing code?[/QUOTE]
[url=http://beej.us/guide/bgnet/]This[/url] might help you get started if you don't mind learning the low level stuff.
On another note, anyone who has ever had to wrap ObjC in C++ (or even plain old C) gets a whole bunch of sympathy. At least OS X 10.6 allows the use of blocks, so I can do this concurrently. Sort of :unsmith:
(warning horribly inefficient ObjC++ ahead).
[cpp]
directory::directory(const std::string& location) : location(location), pimpl(new private_directory)
{
__block const char* entry = nil;
__block std::vector<directory> directory_list;
__block std::vector<file> file_list;
__block NSFileManager* temp_manager = this->pimpl->file_manager;
[[this->pimpl->file_manager contentsOfDirectoryAtPath:nsstring(this->location) error:nil]
enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop)
{
BOOL directory;
[temp_manager fileExistsAtPath:obj isDirectory:&directory];
entry = [obj cStringUsingEncoding:[NSString defaultCStringEncoding]];
if (directory) { directory_list.push_back(std::string(entry)); }
else { file_list.push_back(std::string(entry)); }
}];
temp_manager = nil;
this->directories = directory_list;
this->files = file_list;
}
[/cpp]
I guess the good thing about this class is that it effectively constructs a hierarchy of all files and directories below it automatically (rather than on demand). I tried this once before doing it the other way (where I don't build the list until it is requested). I found it be much slower than this where the information wasn't constructed until it was requested. I'm sure though, if I had a pool allocator hooked up to these vectors, it would be a hell of a lot faster.
Im getting an ocz nia tomorrow, and i might try and write a program that will react to its input, or see if i can detect specific patterns of brainwaves etc..
If anyone has anything they would like to try with it (programs etc), i wouldnt mind testing it for you. Ideas with what to do with it would be nice too :3
Edit:
Page king!
ObjC++ sounds and looks horribly redundant.
Not to mention it looks [B]horrible[/B]. Mixing two different object syntaxes just can't be a good idea.
[QUOTE=bean_xp;25551324]In debug mode additional checks are performed for safety reasons. For example an std::vector in microsoft's standard library implementation, will perform bounds checking on index lookups (operator[]). Since he has 250 bullets, probably stored in a vector, the difference in performance is easily explained by the extra bounds checks.[/QUOTE]
[url=http://msdn.microsoft.com/en-us/library/aa985965%28v=VS.80%29.aspx]Checked iterators apply to release builds and debug builds.[/url]
[QUOTE=esalaka;25554675]ObjC++ sounds and looks horribly redundant.
Not to mention it looks [B]horrible[/B]. Mixing two different object syntaxes just can't be a good idea.[/QUOTE]
ObjC tries to follow the smalltalk model for Object Orientation, as well as borrowing from the syntax of it, whereas C++ follows a Simula model, while following an Algol style syntax.
It's honestly like trying to write a script that uses both Python and Perl syntax. I think the only saving grace that allows [i]any[/i] form of interoperability are pointers, otherwise the entire thing would be as stable as a South American government during the Reagan administration.
[QUOTE=high;25554985][URL="http://msdn.microsoft.com/en-us/library/aa985965%28v=VS.80%29.aspx"]Checked iterators apply to release builds and debug builds.[/URL][/QUOTE]
Additional checks controlled by the define [URL="http://msdn.microsoft.com/en-us/library/aa985982%28v=VS.80%29.aspx"]_HAS_ITERATOR_DEBUGGING[/URL] are added by default for debug builds. Yes iterators are checked in all builds, so to amend my original post, additional checks are added for debugging purposes. Inlining of the below operator will account for some of the performance gain too
[cpp]const_reference operator[](size_type _Pos) const
{ // subscript nonmutable sequence
#if _HAS_ITERATOR_DEBUGGING
if (size() <= _Pos)
{
_DEBUG_ERROR("vector subscript out of range");
_SCL_SECURE_OUT_OF_RANGE;
}
#endif /* _HAS_ITERATOR_DEBUGGING */
_SCL_SECURE_VALIDATE_RANGE(_Pos < size());
return (*(_Myfirst + _Pos));
}[/cpp]
I just modified my entity system to have the manager call a method and pass the SFML screen to the entity, so each entity could draw themselves differently.
Also, when defining virtual methods, can you have a 'default' action for a method in a cpp file?
Never mind, found out myself
Here's the code for the VM so far. It's pretty short and simple.
[cpp]
#include "vm.h"
inline static const uint8_t parity(uint8_t x)
{
unsigned y;
y = x ^ (x >> 1);
y = y ^ (y >> 2);
y = y ^ (y >> 4);
y = y ^ (y >> 8);
return y & 1;
}
VirtualMachine::VirtualMachine(const uint8_t* pData, const uint16_t size)
{
m_A = m_B = m_CCR = 0;
m_PC = m_SP = m_szMemory = 0;
m_pMemory = NULL;
m_bEnd = false;
if(pData && size > 0)
{
if(m_pMemory)
{
delete[] m_pMemory;
m_pMemory = NULL;
}
m_szMemory = 65535;
m_pMemory = new E_VM_INS[m_szMemory]; // 64kB of memory.
m_SP = m_szMemory;
// copy program data into memory.
memcpy(m_pMemory, pData, size);
}
}
VirtualMachine::~VirtualMachine()
{
if(m_pMemory)
{
delete[] m_pMemory;
m_pMemory = NULL;
m_szMemory = 0;
}
}
void VirtualMachine::Run()
{
while(!m_bEnd)
ExecuteInstruction();
}
void VirtualMachine::ExecuteInstruction()
{
E_VM_INS instruction = m_pMemory[m_PC];
switch(instruction)
{
case ABA:
{
m_A += m_B;
++m_PC;
}
break;
case INCA:
{
++m_A;
++m_PC;
}
break;
case INCB:
{
++m_B;
++m_PC;
}
break;
case DECA:
{
--m_A;
++m_PC;
}
break;
case DECB:
{
--m_B;
++m_PC;
}
break;
case JNE:
{
if((m_CCR & 0x80) == 0)
{
++m_PC;
uint16_t addy = *((uint16_t*)(m_pMemory + m_PC));
m_PC = addy;
}
else
m_PC += 3;
}
break;
case LDAI:
{
++m_PC;
m_A = m_pMemory[m_PC];
++m_PC;
}
break;
case LDBI:
{
++m_PC;
m_B = m_pMemory[m_PC];
++m_PC;
}
break;
case CMPAI:
{
++m_PC;
int8_t cmp = m_A - m_pMemory[m_PC];
uint8_t par = (parity(cmp) << 1);
m_CCR = par; // Set parity flag in CCR
m_CCR |= cmp < 0 ? (1 << 4) : 0; // Set negative flag in CCR.
m_CCR = cmp == 0 ? (m_CCR | 0x80) : m_CCR;
++m_PC;
}
break;
case BNE:
{
if((m_CCR & 0x80) == 0)
{
++m_PC;
uint16_t addy = *((uint16_t*)(m_pMemory + m_PC));
m_PC += 2;
// Push registers on to stack.
--m_SP;
m_pMemory[m_SP] = static_cast<E_VM_INS>(m_A);
--m_SP;
m_pMemory[m_SP] = static_cast<E_VM_INS>(m_B);
--m_SP;
m_pMemory[m_SP] = static_cast<E_VM_INS>(m_CCR);
// Push program counter on to stack.
--m_SP;
m_pMemory[m_SP] = static_cast<E_VM_INS>((m_PC & 0xFF00));
--m_SP;
m_pMemory[m_SP] = static_cast<E_VM_INS>((m_PC & 0x00FF));
m_PC = addy;
}
else
m_PC += 3;
}
break;
case RTS:
{
m_PC = *((uint16_t*)(m_pMemory+m_SP));
m_SP += 4;
m_CCR = *((uint8_t*)(m_pMemory));
++m_SP;
m_B = *((uint8_t*)(m_pMemory));
++m_SP;
m_A = *((uint8_t*)(m_pMemory));
++m_SP;
}
break;
case END:
{
m_bEnd = true;
break;
}
case CMPAM:
break;
default:
m_bEnd = true;
break;
}
}
[/cpp]
[editline]21st October 2010[/editline]
Wow and right as I submit that I notice a few bugs lol. I forgot the PC and SP are 16bit now. Woops
[editline]21st October 2010[/editline]
Fixed