Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


rip-off

Member Since 16 Mar 2005
Offline Last Active Dec 23 2014 10:54 AM

#5190335 What is a lobby server?

Posted by rip-off on 31 October 2014 - 05:44 AM

Have you tried reading the FAQ or Googling?


#5190217 Would this c pointer work as a float buffer?

Posted by rip-off on 30 October 2014 - 03:01 PM

Caveat: I'm not an Objective C programmer.

 

Unless the non-OO portions of Objective C have strayed far from the C roots, then that is essentially the correct approach.

 

Note that in C pointers are passed by value, so "floatBuffer" is a distinct pointer from the one passed by the caller. This means that changes to this pointer will not be visible to the parent:

#include <stdio.h>
 
void example(int *p) {
    *p = 42;
    p = 0;
}
 
int main()
{
     int value = 1;
     int *pointer = &value;
     printf("%p: %d\n", pointer, value);
 
     example(pointer);
     printf("%p: %d\n", pointer, value);
}

This means that you can avoid "rewinding" the buffer afterwards in this case.

 

In Java, object references are passed by value, but the "position" is an attribute of the object, so that is visible to the caller, hence the need to rewind.




#5190154 What is a lobby server?

Posted by rip-off on 30 October 2014 - 09:10 AM

The FAQ is a good place to start. I'd recommend getting comfortable with socket programming outside a game, for example, creating a simple chat server and client.

 

Then, I'd go back and start reading how other people have approached games like yours, for example the answer to Q12 in the forum FAQ.

 

You might want to build a proof of concept using the models you've chosen in a simple game first. Networking needs to be designed into the game from the start, so it really pays to get comfortable with the tools you'll need and familiar with the issues that choosing a particular networking model will cause. All networking models have trade-offs, from accuracy to time sensitivity, so you'll want to be aware of that as you design the rest of your game.




#5189988 My goodness multiple inheritage is like a taboo. Why?

Posted by rip-off on 29 October 2014 - 12:26 PM


I plan to use multiple inheritance to make my code more oganized and simple. First I plan to make a class called "Character" then I plan to make several other classes that inherit from "Character". These class will specify the different types of characters such as Weapon type, Ride type, Dash type....ect. Finally I will make classes for the indivual characters of my game which will use multiple inheritance from the character type classes.

This would be a classic example of something that could end up being quite messy with multiple inheritance. If you have 5 weapons, 3 ride types and 2 dash types, that is 30 potential sub-class combinations!

 

I don't know exactly what you mean by "ride" and "dash" types, but weapon types don't sound like classes of characters.

 

Consider:

class Character {
    // ...
private:
    std::unique_ptr<Dash> dash;
    std::unique_ptr<Ride> ride;
    std::unique_ptr<Weapon> weapon;
    // ...
};

This is already assuming that your weapons, "ride" and "dash" objects need to be polymorphic. They might not, if they can be data driven instead, you can use value semantics for an even simpler approach.

 

That is, an axe, club, mace and a sword are, for some games, essentially the same weapon "type", just maybe with different characteristics such as maximum damage and armour piercing. But for some games, there might be behavioural differences between weapons, clearly most games have strong distinctions between melee and ranged weapons.

 

It is hard to give specific advice with the abstract nouns you've introduced so far, but I suspect your game could be simpler if you favour data driven value types to polymorphic types and favour composition over inheritance.




#5189985 Why do I need to define methods twice?

Posted by rip-off on 29 October 2014 - 12:15 PM

I've moved this to "For Beginners".




#5189965 My goodness multiple inheritage is like a taboo. Why?

Posted by rip-off on 29 October 2014 - 11:09 AM

Generally, it is referred to as "inheritance", not "inheritage".

 

Now, you say you've come across it's reputation online. Did you read the reasoning behind it? Do you not understand the reasons, or do you disagree with them?

 

Or perhaps you think your scenario is justified use. In which case, why not describe how you were planning to use it?




#5189961 Undesired Behavior When Attempting To Find Which Directory Jar Is Located In

Posted by rip-off on 29 October 2014 - 10:59 AM

Note that there is no guarantee the Jar is located in "user.dir". The working directory may be different, by executing the program something like so:

$ pwd
/home/someUser
$ cat Help.java
public class Help {
    public static void main(String [] args) {
        System.out.println(System.getProperty("user.dir"));
    }
}
$ javac *.java && jar cevf Help Help.jar Help.class
added manifest
adding: Help.class(in = 478) (out= 309)(deflated 35%)
$ java -jar Help.jar
/home/someUser
$ cd someDirectory
$ java -jar ../Help.jar
/home/someUser/someDirectory



#5189905 weird header behavior in gcc and llvm

Posted by rip-off on 29 October 2014 - 06:10 AM

It sounds like you have a circular #include. The order of includes is what causes this to manifest as trouble or not.

 


every .h file is technically included in every .cpp file because of the bidirectional tree hierarchy of includes

This is a really bad idea. This means your entire project needs to be built every time any header file changes. Generally, the advice is to be minimal with what you #include. If you can, use forward declarations rather than #including a given header. There are design aspects to this, if your design is loosely coupled it will be easier to avoid #including certain headers.




#5189903 Undesired Behavior When Attempting To Find Which Directory Jar Is Located In

Posted by rip-off on 29 October 2014 - 05:59 AM

I don't really understand what you're trying to do. Unfortunately "sorts out" is a very vague term, and "directories inside of the file WERE the .jar file is executed" is confusing.

 

Is it that you have some resource files in the Jar, and you want to enumerate them? Or do you have a set of files that are deployed with the Jar? Or are you talking about the working directory of execution?

 

If you're getting NullPointerExceptions, then presumably you have a stack trace? Why didn't you post it? Can you catch the exception in a debugger to discover which (sub) expression is null?




#5189747 Issues with multiplayer 4X game

Posted by rip-off on 28 October 2014 - 12:39 PM


Now that I'm starting to playtest my game for the first times I'm starting to get worried of the nature of my game. One concern is that players have to wait a lot because there's only so much things they can do before they have to wait for an update. But my main concern is that players will be punished for not being online. If a player wakes up and half his empire is conquered it would be enough for that player to never play a game again.

You have two things in conflict here. If there is an advantage to being online (e.g. more actions), then those who are offline clearly lose this advantage. I don't think there is any way to avoid making a fundamental game design choice here. However, just because the game-play must make a clear choice here, doesn't mean you cannot address the corresponding issues that arise in another way.

 

If your game "update" loop is infrequent, you can address the "boredom" issue in other ways, as mentioned by allowing each player to participate in multiple game instances against different players. More than just allow them actually, encourage them by building an appropriate way to manage their ongoing games and to switch between them. The more engaged players can have plenty of simultaneous games to keep them satisfied even if some games might be against more casual players who only participate once or twice a day.

 

Another idea might be to allow the players to specify the update rate as they start a game instance. You might even cater for this in matchmaking, where players are pitted against players with similar usage patterns (e.g. similar timezones and desired update frequency).

 

If you're update rate is frequent, to avoid punishing casual players perhaps an idea might be to allow each empire to be managed co-operatively. So for example you could allow several casual players jointly control an empire against a more engaged player. This could allow the game to progress much faster than if each player had their own empire, and opens some interesting social opportunities.

 

Another idea might be that each game instance could have have a dynamic update rate, where for a number of hours a day a particular game is in a higher intensity mode, but for the rest of the day the rate is drastically reduced or even paused while the majority of players are elsewhere (e.g. work or sleep, again timezones pose an interesting problem). Even just allowing the participants to pause the game until an agreed time has similar benefits.

 

Obviously, some of these ideas might only make sense as the numbers of users increases, at the start you might not have enough users to sustain such options.




#5189507 Fullscreen trouble

Posted by rip-off on 27 October 2014 - 03:49 PM

The OS is absolutely not the topic of this conversation. You can discuss your favourite OS elsewhere.




#5189443 Is there a way to force/trigger array view of certain pointers in the (VS) de...

Posted by rip-off on 27 October 2014 - 11:08 AM

Searching for visual c++ custom debug view gave me this promising looking first result.




#5189155 [SDLNet] Server does not receive incoming connection from client

Posted by rip-off on 25 October 2014 - 06:00 PM

A good tip for debugging networked programs is to substitute programs known to work.

For example, use the existing program "telnet" or "netcat" to simulate a TCP client (at least one is likely to be already installed on your system).

You can use many programs as a server for testing basic connectivity, you can attempt to connect to www.google.com on port 80, I believe netcat has a server mode.

With these tools, you can gain confidence as to what is expected behaviour and what could be a bug in your program.


#5188700 Need help implementing a bugfix (OpenGL idiot here)

Posted by rip-off on 23 October 2014 - 01:31 AM

The differences appear to be the addition of comments to certain lines of the program. This is called a patch, and there are programs to apply one. This one looks like it was generated with Git. You can see the "context", introduced by "@@" lines surrounding the change, and the lines prefixed by "-", which are to be removed, and the lines prefixed by "+", which means they are added.

 

The code should transform from:

void phonep()
{
    int pres;
 
    do
    {
        pres = (rand() % 10) + 1;
    } while(answers[qnum][pres - 1] == "");
 
    if(pres < 5)
    {
        // Stuff ...
    }
    // More stuff ...
}       

 

To:

void phonep()
{
    int pres;
 
//    do
//    {
        pres = (rand() % 10) + 1;
//    } while(answers[qnum][pres - 1] == "");
 
    if(pres < 5)
    {
        // Stuff ...
    }
    // More stuff ...
} 



#5188036 How to remove GET variables from URL in php

Posted by rip-off on 19 October 2014 - 03:42 PM


The reason why I cant use post is because on process.php I have a button that exports the site to a word document, if I use post the input is not shown in the word document because the browser cannot make a request twice

An alternative is to try solve the highlighted problem. Are you referring to a "This form has already been submitted" message (or however they are worded now)? To make the request twice, indicates you've made the request once. Is the page containing this control itself generated via POST?

 

You might notice, browsing the Internet, that you rarely see the sort of messages. This is because what most sites do is, like Ectara mentions, redirect to GET after POST. That is, when you submit a new thread to a site like gamedev.net, the response to your POST is "thanks, please GET http://www.gamedev.net/topic/987654-whatever-topic" (note: simplified, but that is the basic idea). The browser automatically navigates there, and the result is that if you use browser navigation you do not get such messages.

 

It would seem the ideal solution to your problem is to store the submitted state on the server somehow, in a database or just the session as Ectara suggests, so that it remains available for subsequent GET requests.






PARTNERS