[QUOTE=Catdaemon;16016182]Can you explain how your networking works? Mine is far too manual for my liking.[/QUOTE]
I've got a base object, which is called MemberAccess. Then I've got a template class called TVariable. So to basically network an 'object' you just inherit from MemberAccess then add members..
TVariable<int> m_ID;
TVariable<BString> m_strName;
TVariable<Angle> m_EyeAngle;
TVariable<Vector> m_EyePos;
Then register them.. (which is just a simple function override (you can do BaseClass::DelareMembers() etc)
MA_DECLARE( CNetworkUser )
{
AddVar( &m_ID, "id" );
AddVar( &m_strName, "name" );
AddVar( &m_EyeAngle, "eyeangle" );
AddVar( &m_EyePos, "eyepos" );
}
Which means the object now knows about each of the variables. You can access them by name, or in the case of the networking, by the member id.
This means that this object isn't just useful for networking, but you can use it in your editor to list and access all the entity's variables, or saving, or loading.
To network them, on the server you'd just go Network->AddObject( pMyObject ) - and then it would add it to a list of networkables and assign it a unique id. The only thing left to set up is the clientside Network Object Managers - which handle the network objects to create/destroy objects.. here's the entity's version of that:
[code]NETWORK_OBJECT_MANAGER_START( CBaseEntity )
CMemberAccess* CreateObject( CBuffer& buffer, ObjectID iID )
{
Assert( CGalaxy::Singleton );
CBaseEntityWorld* pWorld = (CBaseEntityWorld*) CGalaxy::Singleton->FindWorld( buffer.ReadInt() );
if (!pWorld)
{
Assert( !"Tried to make entity but world not found!" );
return NULL;
}
BString strEntityClassName;
buffer.ReadNullTerminatedString( strEntityClassName );
CBaseEntity* pEntity = pWorld->CreateEntity( strEntityClassName );
return pEntity;
}
void DestroyObject( CMemberAccess* pObject )
{
CBaseEntity* pEntity = (CBaseEntity*) pObject;
pEntity->Remove();
}
NETWORK_OBJECT_MANAGER_END( CBaseEntity )[/code]
[QUOTE=Overv;16017012]I decided to do my physics sandbox more like an editor kind of thing, so I added a grid and velocity arrows which will be toggleable of course.
*img*[/QUOTE]
Looks good.
Maybe an idea to show the actual force vector instead of the x/y components.
In 140 characters:
Moved some utility functions into a utility library only to realize that all of my tilesize dependent code had moved there. I only need to define the tile size once now!
I'm too lazy to write test cases and debug right now, though, so that'll come in the morning.
Writing a simple game engine. At the moment it doesn't do much. I haven't worked on any big graphical stuff yet, just wrapping up some classes and interactions between dlls, and crap. Here's a screen..
[IMG]http://i32.tinypic.com/2yn5nok.png[/IMG]
The debug text fades in once the window opens. And it also throws message boxes when you least expect it.
Working on generating useful thumbnails. They always come out too dark, too light, too ugly, etc.
But I think I finally found a sweet spot.
[img]http://imgkk.com/i/Fh3GLSMz.png[/img][img]http://imgkk.com/i/bTyWcQjh.png[/img][img]http://imgkk.com/i/Z24VCnrU.png[/img]
[img]http://imgkk.com/i/FkPpFii2.png[/img][img]http://imgkk.com/i/ATjgJhIj.png[/img][img]http://imgkk.com/i/7GkM4PDf.png[/img]
[QUOTE=Klownox;16016254]I'm working on learning C++, I think I'm doing alright.
But, raccoon12 and I made a horrible program last night. It beeped forever. :([/QUOTE]
That was fun
There's nothing inside the teapot... hold me.
[editline]12:32AM[/editline]
But well done, by the way.
[QUOTE=nullsquared;16018643]Working on generating useful thumbnails. They always come out too dark, too light, too ugly, etc.
But I think I finally found a sweet spot.
[img]http://imgkk.com/i/Fh3GLSMz.png[/img][img]http://imgkk.com/i/bTyWcQjh.png[/img][img]http://imgkk.com/i/Z24VCnrU.png[/img]
[img]http://imgkk.com/i/FkPpFii2.png[/img][img]http://imgkk.com/i/ATjgJhIj.png[/img][img]http://imgkk.com/i/7GkM4PDf.png[/img][/QUOTE]
Looks good, but you should enable antialiasing on it.
[B]Edit:[/B]
That only works if the current video settings have it enable, right? You could try generating a bigger thumbnail and scaling it down.
[QUOTE=HubmaN V2;16018832]There's nothing inside the teapot... hold me.
[editline]12:32AM[/editline]
But well done, by the way.[/QUOTE]
Yeah, I haven't implemented tea physics yet.
[QUOTE=Xera;16018913]Yeah, I haven't implemented tea physics yet.[/QUOTE]
No, there's nothing being drawn "within" the teapot between the gaps between the cover and the teapot itself.
[QUOTE=HubmaN V2;16018932]No, there's nothing being drawn "withing" the teapot between the gaps between the cover and the teapot itself.[/QUOTE]
I think you missed the joke completely.
The mesh is created with D3DXCreateTeapot, I have no control over(Well I probably do) the gaps.
[QUOTE=Xera;16018744][img]http://upl.luahelp.com/uploads/snYmhb7x/teapot.png[/img]
holy shit[/QUOTE]
Congratulations you successfully read a tutorial. You should put it on your CV
:)
[QUOTE=qurl;16019031]Congratulations you successfully read a tutorial. You should put it on your CV
:)[/QUOTE]
We all need to start somewhere.
[QUOTE=qurl;16019031]Congratulations you successfully read a tutorial. You should put it on your CV
:)[/QUOTE]
I used MSDN for reference and Google when I got stuck. Skimmed through a few tutorials and examples to see if I was doing things correctly, but most of it is covered on MSDN, although not usually clearly listed.
It was hardly a serious post anyway.
[QUOTE=MADmarine;16019081]We all need to start somewhere.[/QUOTE]
I guess :D
I got enemies done.
I had a huge-problem with enemy shooting bullets as enemy-shootings increased the recycling rate to hell.
Meaning that bullets disappeared on the screen.
Well, I solved it to increasing max bullets and bullet update-loops to 50000 from 5000.
Suprisingly it doesn't slow it down visibly. ( and to mind you my computer isn't the best kind. You might be able to run 2200 bullets without visible FPS-drop. )
Also, an image of enemies shooting now:
[img]http://imgkk.com/i/A5tMHcnM.png[/img]
It's like a soft blanket!
That's not Bullet Hell, it's Bullet Rape!
[editline]06:47PM[/editline]
from behind
[editline]06:47PM[/editline]
without lube
[QUOTE=raccoon12;16018742]That was fun[/QUOTE]
Yeah, but my ears were still ringing this morning. :(
I have a really annoying problem. When I go into fullscreen mode my KeyListeners don't work anymore.
I'll post an example in a few minutes.
[cpp]package fullscreenproblem;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Window;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
public static void main(String[] args) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
Frame f = new Frame(gc);
Window w = new Window(f);
f.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
//never prints
System.out.println("pressed (frame): " + e.getKeyChar());
}
});
w.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
//never prints either
System.out.println("pressed (window): " + e.getKeyChar());
}
});
gd.setFullScreenWindow(w);
w.requestFocus();
//outputs false
System.out.println("input req: " + w.requestFocusInWindow());
try {
Thread.sleep(8000);
} catch (InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
System.exit(0);
}
}[/cpp]
I wish there were Java code tags.
[B]Edit:[/B]
[B][I][U]It's working!!!!!!![/U][/I][/B] I had to do f.setVisible(true); and then f.requestFocusInWindow(); and it returned true!
[QUOTE=Sasupoika;16019582]I got enemies done.
I had a huge-problem with enemy shooting bullets as enemy-shootings increased the recycling rate to hell.
Meaning that bullets disappeared on the screen.
Well, I solved it to increasing max bullets and bullet update-loops to 50000 from 5000.
Suprisingly it doesn't slow it down visibly. ( and to mind you my computer isn't the best kind. You might be able to run 2200 bullets without visible FPS-drop. )
Also, an image of enemies shooting now:
[img]http://imgkk.com/i/A5tMHcnM.png[/img]
It's like a soft blanket![/QUOTE]
I love [B]Extreme Fucking Hectic[/B] shooters like that. I love you.
[QUOTE=Deco Da Man;16013318]I've decided to make a new version of Dwarf Fortress. I only just decided this a moment ago... so recommendations on what engine to use and such would be great.
Wish me luck![/QUOTE]
have you tried the "don't fucking do it" engine?
Not really much of an update, but I've implemented a function that returns the size (in bytes) of a given file. And yes that is me using or instead of ||, because you can and it's legal.
code snippet is here:
[cpp]
#include <fstream>
#include <string>
unsigned long long FileSize(std::string fileName)
{
std::ifstream reader;
reader.open(fileName.c_str(), std::ios::binary | std::ios::in);
if (!reader.good() or reader.eof() or !reader.is_open())
{
return 0;
}
reader.seekg(0, std::ios::beg);
std::ifstream::pos_type begin_pos = reader.tellg();
reader.seekg(0, std::ios::end);
return static_cast<unsigned long long>(reader.tellg() - begin_pos);
}
[/cpp]
Now I just need to implement my own ReadDirectoryChangesW(). :)
Are you using or just to be different, just because you can, or just because you like it more?
[QUOTE=tjl;16032999]Are you using or just to be different, just because you can, or just because you like it more?[/QUOTE]
I'm using it since my engine is cross platform, which is something that stops me from using ReadDirectoryChanges. I could integrate the mono runtime, and use the FileSystemWatcher class, but I don't want that much overhead for what is so little use of it.
[QUOTE=Sasupoika;16019582]It's like a soft blanket![/QUOTE]
are they the spanish inquisition maybe? :)
[QUOTE=Chandler;16033283]I'm using it since my engine is cross platform, which is something that stops me from using ReadDirectoryChanges. I could integrate the mono runtime, and use the FileSystemWatcher class, but I don't want that much overhead for what is so little use of it.[/QUOTE]
He/She was asking about your usage of or instead of || :P
I'm using || since I simply got used to it I guess. I actually have no idea; Maybe because the bit-wise or is |.
[QUOTE=Chandler;16032562]
code snippet is here:
[cpp]
// code
[/cpp]
[/QUOTE]
Just remember that this isn't giving you the file size at all, but merely the amount of bytes you can read in the file. It could be bigger on disk. Fyi, you can shorten this a bit: Use ifstream's constructor, and I'm not sure but I don't think you need to seekg() at the beginning. I've used the same method for an ID3 tag reader. seek works pretty well along with a hex editor.
[QUOTE=Chandler;16033283]I'm using it since my engine is cross platform, which is something that stops me from using ReadDirectoryChanges. I could integrate the mono runtime, and use the FileSystemWatcher class, but I don't want that much overhead for what is so little use of it.[/QUOTE]
For POSIX-compilant systems you can use inotify (or inotify-cxx for a C++ interface).
[QUOTE=Chandler;16032562]Not really much of an update, but I've implemented a function that returns the size (in bytes) of a given file. And yes that is me using or instead of ||, because you can and it's legal.
code snippet is here:[/QUOTE]
Here's mine
[cpp] unsigned int Size( const BString& strName )
{
struct stat fileStat;
int err = stat( strName.c_str(), &fileStat );
if (0 != err) return 0;
return fileStat.st_size;
}[/cpp]
Isn't stat portable?
Sorry, you need to Log In to post a reply to this thread.