• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:55
CET 14:55
KST 22:55
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation4Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
[TLMC] Fall/Winter 2025 Ladder Map Rotation Mech is the composition that needs teleportation t Weekly Cups (Nov 3-9): Clem Conquers in Canada Craziest Micro Moments Of All Time? SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle Terran 1:35 12 Gas Optimization BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET [ASL20] Grand Finals [Megathread] Daily Proleagues
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1347 users

The Big Programming Thread - Page 53

Forum Index > General Forum
Post a Reply
Prev 1 51 52 53 54 55 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
nakam
Profile Joined April 2010
Sweden245 Posts
May 08 2011 13:37 GMT
#1041
On May 08 2011 22:17 tofucake wrote:
@nakam: What you're doing is overly complicated and is easily done in PHP. However, you could run it as a stored procedure.

Yes I know that it's easily done in PHP, but my plan was to make even more complex queries, so I thought I might aswell learn how it's done. I prefer process the data with PHP as little as possible.

Maybe it's time to start learning stored procedures then.
TL Local Timezone Script - http://www.teamliquid.net/forum/viewmessage.php?topic_id=277156
thedeadhaji *
Profile Blog Joined January 2006
39489 Posts
May 10 2011 05:45 GMT
#1042
Ok I'm going to sound like a moron but I'm going to lay myself out there anyways.

I want to code again, most likely motivated by the fact that I would like to be able to transition to a more software oriented business opportunity in the future, but also because I am ever-regretful of the fact that I didn't pursue CS with everything I had.

My experience is primarily in C, 2nd level university level (coded stuff like hash tables, did some assembly translation work, and our final project was a unix shell which I limped through with the help of two brilliant friends).

I think the first challenge is getting myself to just randomly code shit for the whim of it, doing stuff I'm interested or think would be cool. What's a general direction and the kind of thought process / attitde I should have with this? I imagine that I should keep things relatively easy and simple, and not go for the glory right away.

I'm interested in personal finance these days, so something that just popped into my mind is that I could make some html/php sites with little tools people can use to calculate or simulate stuff about retirement / investment stuff (I do this all the time for personal purposes on excel - one recent excel project I did was to simulate the practicality of Robert Kiyosaki's "Rich Dad Poor Dad" principal of cash flow via passive income - conclusion was that it's an unrealistic goal)

Any help is appreciated.

Thanks!
VIB
Profile Blog Joined November 2007
Brazil3567 Posts
May 10 2011 06:04 GMT
#1043
On May 10 2011 14:45 thedeadhaji wrote:
I think the first challenge is getting myself to just randomly code shit for the whim of it, doing stuff I'm interested or think would be cool. What's a general direction and the kind of thought process / attitde I should have with this? I imagine that I should keep things relatively easy and simple, and not go for the glory right away.

I'm interested in personal finance these days, so something that just popped into my mind is that I could make some html/php sites with little tools people can use to calculate or simulate stuff about retirement / investment stuff (I do this all the time for personal purposes on excel - one recent excel project I did was to simulate the practicality of Robert Kiyosaki's "Rich Dad Poor Dad" principal of cash flow via passive income - conclusion was that it's an unrealistic goal)

Any help is appreciated.

Thanks!
I would advise you take a look at some GWT (Google Web Toolkit) tutorials. For a few reasons:
- web apps and cloud apps are the future, since you're just starting, you should probably be more focused on the future rather than on the immediate present.
- Google offers a lot of support, it's easy to find info and Google is investing a lot in it's tools, and they do got shit tons of resources
- It's very easy to write simple stuff with it, so even as a beginner you'll be able to sketch some stuff you can show to other people to bounce off ideas off
- if you're really interested in starting a business and already have ideas for a start up, GWT is tighly integrated with App Engine which is an awesome free starting infrastructure for startups
- you can code in either Java or Python, both are very ubiquitous languages that you can a lot of resources about pretty much anywhere. Just choose whichever you prefer, and both are good, so you can't go wrong.

Start here:
http://code.google.com/webtoolkit/gettingstarted.html
(note the first tutorial will teach you how to build a pseudo stock watcher app, which will give you an idea of how fast and easy you can make a business app like the one you're planning)
Great people talk about ideas. Average people talk about things. Small people talk about other people.
Bobbias
Profile Blog Joined March 2008
Canada1373 Posts
May 10 2011 13:04 GMT
#1044
So, a bit of a general question here and I know there's no "right" answer to this, but I'll try anyway.

I'd like to get back into programming. I took some classes in highschool, but most of my knowledge is self-taught in C++/Java/C# (and I've dabbled in various other languages).

I'd like to program a simple game, a text based RPG, to be exact, but before I get started, I've been wondering how I should represent the game state. The reason I ask this is because if I have a solid idea of how the game state should be represented, I know how everything else fits together, basically, but I'm really not sure how to actually keep track of the game state.

I mean, I'd like the game to be a non-linear with a quest system, so you could create a linear story if you wanted, but I'm not sure how to start on actually representing everything. I've got no problem creating classes for the player character, mobs, etc, but I'm not sure how to tie everything together.
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
May 10 2011 13:19 GMT
#1045
What about graphs Bobbias?

You could keep track of the game quests using a graph that would represent the requirements to be able to start a determined quest.
"When the geyser died, a probe came out" - SirJolt
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
May 10 2011 13:25 GMT
#1046
On May 10 2011 22:19 fabiano wrote:
What about graphs Bobbias?

You could keep track of the game quests using a graph that would represent the requirements to be able to start a determined quest.


Basically this.

Every Quest needs a property "Requirements", for which you could either use a reference to the previous quest or a more complex structure that would allow for level requirements, special items, etc.
If the quest has no requirement (for example a NULL value), it's always available, otherwise you have to check the log of all completed quests if the requirements are fullfilled.

For a linear story spanning multiple quests without much interaction between, you can also create quest triggers that automatically start a new quest when the current quest is complete.
Manit0u
Profile Blog Joined August 2004
Poland17429 Posts
Last Edited: 2011-05-10 18:32:05
May 10 2011 18:19 GMT
#1047
On May 10 2011 22:04 Bobbias wrote:
So, a bit of a general question here and I know there's no "right" answer to this, but I'll try anyway.

I'd like to get back into programming. I took some classes in highschool, but most of my knowledge is self-taught in C++/Java/C# (and I've dabbled in various other languages).

I'd like to program a simple game, a text based RPG, to be exact, but before I get started, I've been wondering how I should represent the game state. The reason I ask this is because if I have a solid idea of how the game state should be represented, I know how everything else fits together, basically, but I'm really not sure how to actually keep track of the game state.

I mean, I'd like the game to be a non-linear with a quest system, so you could create a linear story if you wanted, but I'm not sure how to start on actually representing everything. I've got no problem creating classes for the player character, mobs, etc, but I'm not sure how to tie everything together.


Read on this:
http://en.wikipedia.org/wiki/LPMud
http://en.wikipedia.org/wiki/LPC_(programming_language)

Then go here:
http://www.genesismud.org/

Create a character there, go through the tutorial etc.
If you like what you see you can apply to become a coder there, they're going to teach you everything you need to know (no prior programming experience required).
Before doing your own stuff from the ground up it could be wise to get onto an ongoing project and see what it looks like.

P. S. (not related to your question)

I've finally fixed my dice generator code, no seg faults, no floating point exceptions and looks good during debugging.

+ Show Spoiler [code] +


#include <stdio.h>
#include <stdlib.h>
#include <time.h>

struct DiceConfiguration
{
int DiceNumber;
int DiceType;
};

struct DiceThrowsResult
{
int DiceNumber;
int Sum;
int ThrowsResults[];
};

struct DiceConfiguration* GetConfiguration();
struct DiceThrowsResult* ThrowDices(struct DiceConfiguration *config);
void GenerateRandomSeed(void);
int ThrowDice(struct DiceConfiguration *config);
void PrintDiceThrowsResult(struct DiceThrowsResult *result);
void ReleaseMemory(struct DiceConfiguration *config, struct DiceThrowsResult *result);

int main(void)
{
struct DiceConfiguration *config;
struct DiceThrowsResult *result;

GenerateRandomSeed();

config = GetConfiguration();

while(config != NULL)
{
result = ThrowDices(config);

PrintDiceThrowsResult(result);

ReleaseMemory(config, result);

config = GetConfiguration();
}

return 0;
}

struct DiceConfiguration* GetConfiguration()
{
int diceNumber = 0;
int diceType = 0;

printf("Enter the number of dice to throw (0 to quit): ");
scanf("%d", &diceNumber);

if(diceNumber == 0)
{
return NULL;
}
else
{
printf("Enter dice type (sides) : ");
scanf("%d", &diceType);

if(diceType < 2)
{
printf("Dice can't have less than 2 sides!\n");
return NULL;
}
else
{
struct DiceConfiguration *config;
config = malloc(sizeof(struct DiceConfiguration));

config->DiceNumber = diceNumber;
config->DiceType = diceType;

return config;
}
}
}

struct DiceThrowsResult* ThrowDices(struct DiceConfiguration *config)
{
struct DiceThrowsResult *result;
result = malloc(sizeof(struct DiceThrowsResult) + config->DiceNumber * sizeof(int));
result->DiceNumber = config->DiceNumber;

for (int i = 0; i < config->DiceNumber; i++)
{
result->ThrowsResults[i] = ThrowDice(config);
result->Sum += result->ThrowsResults[i];
}

return result;
}

void GenerateRandomSeed(void )
{
srand((unsigned int) time(0));
}

int ThrowDice(struct DiceConfiguration *config)
{
return rand() % config->DiceType + 1;
}

void PrintDiceThrowsResult(struct DiceThrowsResult *result)
{

for (int i = 0; i < result->DiceNumber; i++)
{
printf("%d ", result->ThrowsResults[i]);
}

printf("Sum: %d\n", result->Sum);
}

void ReleaseMemory(struct DiceConfiguration *config, struct DiceThrowsResult *result)
{
if (config != NULL)
{
free(config);
config = NULL;
}

if (result != NULL)
{
free(result);
result = NULL;
}
}



Enjoy!
Time is precious. Waste it wisely.
Cambium
Profile Blog Joined June 2004
United States16368 Posts
Last Edited: 2011-05-10 18:33:14
May 10 2011 18:31 GMT
#1048
On May 10 2011 14:45 thedeadhaji wrote:
Ok I'm going to sound like a moron but I'm going to lay myself out there anyways.

I want to code again, most likely motivated by the fact that I would like to be able to transition to a more software oriented business opportunity in the future, but also because I am ever-regretful of the fact that I didn't pursue CS with everything I had.

My experience is primarily in C, 2nd level university level (coded stuff like hash tables, did some assembly translation work, and our final project was a unix shell which I limped through with the help of two brilliant friends).

I think the first challenge is getting myself to just randomly code shit for the whim of it, doing stuff I'm interested or think would be cool. What's a general direction and the kind of thought process / attitde I should have with this? I imagine that I should keep things relatively easy and simple, and not go for the glory right away.

I'm interested in personal finance these days, so something that just popped into my mind is that I could make some html/php sites with little tools people can use to calculate or simulate stuff about retirement / investment stuff (I do this all the time for personal purposes on excel - one recent excel project I did was to simulate the practicality of Robert Kiyosaki's "Rich Dad Poor Dad" principal of cash flow via passive income - conclusion was that it's an unrealistic goal)

Any help is appreciated.

Thanks!


Haji, try doing Project Euler:
http://projecteuler.net/index.php?section=problems

It doesn't restrain you to a specific language, so you can learn whatever you want. I played with it when I wanted to learn Python and made myself use Python to solve the problem. It was a really pleasant experience, especially for people with decent maths backgrounds and an understanding of programming. In this case, programming is only a tool for solving problems, and I think that's the right idea for all non-research programming projects.

I know it's not "finance", but solving maths problems can be really fun too! The problems get progressively harder, sometimes mathematically, sometimes due to the inherent constraints in the language you picked, so it's very rewarding as your progress down the list.

I'm rather free this summer, and I am thinking about resuming where I left off (I just checked and I'm on #20), so we can compete on this front too!

The problem with coding a rather large project with little practical knowledge is that it's hard to find a place to begin; you are also likely to lose motivation once you get stuck for a while.
When you want something, all the universe conspires in helping you to achieve it.
Cloud
Profile Blog Joined November 2004
Sexico5880 Posts
Last Edited: 2011-05-10 21:03:30
May 10 2011 20:53 GMT
#1049
On May 10 2011 14:45 thedeadhaji wrote:
Ok I'm going to sound like a moron but I'm going to lay myself out there anyways.

I want to code again, most likely motivated by the fact that I would like to be able to transition to a more software oriented business opportunity in the future, but also because I am ever-regretful of the fact that I didn't pursue CS with everything I had.

My experience is primarily in C, 2nd level university level (coded stuff like hash tables, did some assembly translation work, and our final project was a unix shell which I limped through with the help of two brilliant friends).

I think the first challenge is getting myself to just randomly code shit for the whim of it, doing stuff I'm interested or think would be cool. What's a general direction and the kind of thought process / attitde I should have with this? I imagine that I should keep things relatively easy and simple, and not go for the glory right away.

I'm interested in personal finance these days, so something that just popped into my mind is that I could make some html/php sites with little tools people can use to calculate or simulate stuff about retirement / investment stuff (I do this all the time for personal purposes on excel - one recent excel project I did was to simulate the practicality of Robert Kiyosaki's "Rich Dad Poor Dad" principal of cash flow via passive income - conclusion was that it's an unrealistic goal)

Any help is appreciated.

Thanks!


Pm me if you want a partner. I'm trying too to learn some php. I have some experience in Lisp, Java and C/C++. I can help you set up apache, php, a text editor, etc. if you have troubles or help you with books or something. Or we can make a site together.

As for the attitude you need. I think you should aim as high as you can and do not be afraid of making mistakes, of looking like a fool nor of asking for help. And I think having a partner is probably good so that's why I'm looking for one.
BlueLaguna on West, msg for game.
ThatGuy
Profile Blog Joined April 2008
Canada695 Posts
May 11 2011 00:06 GMT
#1050
Hey guys, I've found myself to be in a bit of a pickle.

I was asked to update a site which was developed entirely in Flash. All the elements in the site are modifiable, by updating a text file provided. However he wants some slight modifications to the design and the functionality. The makers of the site did not provide the source to the site, and we only have access to the compiled .swf. We tried using a .swf decompiler (I know this may sound unethical, but this template was paid for and it doesn't make sense that we can't adjust it), but after looking at it for 15 minutes it seems extremely difficult to find anything: there are hundreds of sprites, layers, buttons, resources, no variable names...I don't know where to start with it.

Should I attempt to hack away at what I've got now or is this a lost cause?
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
May 11 2011 00:13 GMT
#1051
Unless you are a genius programmer, its a lost cause.
"When the geyser died, a probe came out" - SirJolt
Cofo
Profile Blog Joined June 2010
United States1388 Posts
May 11 2011 00:55 GMT
#1052
Hey dudes, another advice post here

I'm wanting to teach myself how to do some (mostly client-side) website coding over the summer (I'm a second year university student), and I'm not sure where to start. I'm sure they all have different purposes/strengths, but I've been reading up on HTML/XML/CSS/PHP, and I'm still not sure where exactly I should start learning.

I have (very) basic Java/C++ skills but never done anything web-oriented before. Can anyone point me in the right direction (mostly as far as a starting language goes)?
+ Show Spoiler +
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
May 11 2011 01:10 GMT
#1053
HTML + CSS + PHP + MySQL is the way to go Cofo, it is very easy so no worries.

HTML/CSS will take care of the layout/looks of your site
PHP is the engine that will make your site dynamic
MySQL is the database that will hold your site content

If you are new to these, start learning in this order:

HTML -> CSS -> PHP -> MySQL
"When the geyser died, a probe came out" - SirJolt
Cofo
Profile Blog Joined June 2010
United States1388 Posts
May 11 2011 03:37 GMT
#1054
Thanks Fabiano! Exactly what I was looking for.
+ Show Spoiler +
thedeadhaji *
Profile Blog Joined January 2006
39489 Posts
May 11 2011 07:21 GMT
#1055
>VIB
Thanks for the advice. I'll definitely check it out this weekend (I'd do it now if my typical work days weren't 12+ hours recently X_X). While my hardcore engineering friends balk at app development as not actually being "engineering" (it is "applications" after all), I agree that it's the future - it's basically making solutions out of the technologies developed.

>Cambium
OHH This is what some friends on Twitter were tackling back in February or so. I'm definitely up for competing! Python is a language I wanted to pick up, so I'm prolly going to try my hand at that (Not really keen on doing memory allocation stuff with C again, hahaha)

>Cloud
I was enrolled in some really elementary PHP class this spring (I dropped it half way through b/c it was such a waste of time), and I have the xampp environment + my text editors I used during college (jedit, textpad, notepad++, dreamweaver, etc) so I'm good on that front.

WRT php, I think I'll first choose a topic to tackle and go from there. Right now I'm sooo out of practice for coding that I'd want to get up to speed (and also allocate some weekly time for coding) before I commit to partnering up. But I'm definitely going to remember your proposal!
Hopefully I can find 5'ish hours a week to code. 1 hr a day on a weekday + 2 hours per weekend gives me 9 hours so that should be doable with good time management!


Thanks for the advice guys.
I think I'll start reading up on python tutorials to start, then post here on a weekly basis with progress (to keep myself committed like I am in the fitness thread)
Manit0u
Profile Blog Joined August 2004
Poland17429 Posts
May 11 2011 07:42 GMT
#1056
On May 11 2011 16:21 thedeadhaji wrote:
>Cambium
OHH This is what some friends on Twitter were tackling back in February or so. I'm definitely up for competing! Python is a language I wanted to pick up, so I'm prolly going to try my hand at that (Not really keen on doing memory allocation stuff with C again, hahaha)


What? malloc for life!
Time is precious. Waste it wisely.
thedeadhaji *
Profile Blog Joined January 2006
39489 Posts
May 11 2011 14:49 GMT
#1057
On May 11 2011 16:42 Manit0u wrote:
Show nested quote +
On May 11 2011 16:21 thedeadhaji wrote:
>Cambium
OHH This is what some friends on Twitter were tackling back in February or so. I'm definitely up for competing! Python is a language I wanted to pick up, so I'm prolly going to try my hand at that (Not really keen on doing memory allocation stuff with C again, hahaha)


What? malloc for life!


omfg I had forgotten about that word for the last 6 years ><
Bobbias
Profile Blog Joined March 2008
Canada1373 Posts
May 12 2011 10:15 GMT
#1058
On May 11 2011 03:19 Manit0u wrote:
Show nested quote +
On May 10 2011 22:04 Bobbias wrote:
So, a bit of a general question here and I know there's no "right" answer to this, but I'll try anyway.

I'd like to get back into programming. I took some classes in highschool, but most of my knowledge is self-taught in C++/Java/C# (and I've dabbled in various other languages).

I'd like to program a simple game, a text based RPG, to be exact, but before I get started, I've been wondering how I should represent the game state. The reason I ask this is because if I have a solid idea of how the game state should be represented, I know how everything else fits together, basically, but I'm really not sure how to actually keep track of the game state.

I mean, I'd like the game to be a non-linear with a quest system, so you could create a linear story if you wanted, but I'm not sure how to start on actually representing everything. I've got no problem creating classes for the player character, mobs, etc, but I'm not sure how to tie everything together.


Read on this:
http://en.wikipedia.org/wiki/LPMud
http://en.wikipedia.org/wiki/LPC_(programming_language)

Then go here:
http://www.genesismud.org/

Create a character there, go through the tutorial etc.
If you like what you see you can apply to become a coder there, they're going to teach you everything you need to know (no prior programming experience required).
Before doing your own stuff from the ground up it could be wise to get onto an ongoing project and see what it looks like.

P. S. (not related to your question)

I've finally fixed my dice generator code, no seg faults, no floating point exceptions and looks good during debugging.

+ Show Spoiler [code] +


#include <stdio.h>
#include <stdlib.h>
#include <time.h>

struct DiceConfiguration
{
int DiceNumber;
int DiceType;
};

struct DiceThrowsResult
{
int DiceNumber;
int Sum;
int ThrowsResults[];
};

struct DiceConfiguration* GetConfiguration();
struct DiceThrowsResult* ThrowDices(struct DiceConfiguration *config);
void GenerateRandomSeed(void);
int ThrowDice(struct DiceConfiguration *config);
void PrintDiceThrowsResult(struct DiceThrowsResult *result);
void ReleaseMemory(struct DiceConfiguration *config, struct DiceThrowsResult *result);

int main(void)
{
struct DiceConfiguration *config;
struct DiceThrowsResult *result;

GenerateRandomSeed();

config = GetConfiguration();

while(config != NULL)
{
result = ThrowDices(config);

PrintDiceThrowsResult(result);

ReleaseMemory(config, result);

config = GetConfiguration();
}

return 0;
}

struct DiceConfiguration* GetConfiguration()
{
int diceNumber = 0;
int diceType = 0;

printf("Enter the number of dice to throw (0 to quit): ");
scanf("%d", &diceNumber);

if(diceNumber == 0)
{
return NULL;
}
else
{
printf("Enter dice type (sides) : ");
scanf("%d", &diceType);

if(diceType < 2)
{
printf("Dice can't have less than 2 sides!\n");
return NULL;
}
else
{
struct DiceConfiguration *config;
config = malloc(sizeof(struct DiceConfiguration));

config->DiceNumber = diceNumber;
config->DiceType = diceType;

return config;
}
}
}

struct DiceThrowsResult* ThrowDices(struct DiceConfiguration *config)
{
struct DiceThrowsResult *result;
result = malloc(sizeof(struct DiceThrowsResult) + config->DiceNumber * sizeof(int));
result->DiceNumber = config->DiceNumber;

for (int i = 0; i < config->DiceNumber; i++)
{
result->ThrowsResults[i] = ThrowDice(config);
result->Sum += result->ThrowsResults[i];
}

return result;
}

void GenerateRandomSeed(void )
{
srand((unsigned int) time(0));
}

int ThrowDice(struct DiceConfiguration *config)
{
return rand() % config->DiceType + 1;
}

void PrintDiceThrowsResult(struct DiceThrowsResult *result)
{

for (int i = 0; i < result->DiceNumber; i++)
{
printf("%d ", result->ThrowsResults[i];
}

printf("Sum: %d\n", result->Sum);
}

void ReleaseMemory(struct DiceConfiguration *config, struct DiceThrowsResult *result)
{
if (config != NULL)
{
free(config);
config = NULL;
}

if (result != NULL)
{
free(result);
result = NULL;
}
}



Enjoy!


Thanks for the reply, but looking at muds isn't really what I was aiming for.

Basically, I'm trying to avoid having to rewrite things a bunch of times. I'm not quite sure how to begin writing a game engine..

After bit of searching around I've found a couple articles that help me try to plot out how my game engine will look, but when I see something like:[image loading]

I wonder about what an Appstate really is, or what a Gamestate really is, and how I would represent something like that in my game, as well as whether it's really necessary to represent the application state and game state in objects like that.

Now, the page does go into a small bit of detail about how that system really works: http://www.gamedev.net/page/resources/_/reference/programming/game-programming/300/enginuity-part-ii-r1954

But even so, it's not very clear on what an Appstate really looks like.

So anyone have more articles like the Enginuity series there? I also found: http://www.gamedev.net/page/resources/_/reference/103/postmortems/how-to-build-a-game-in-a-week-from-scratch-with-r2259 Which details roughly how someone approached creating a working RPG in 40 hours from scratch.

I'm not clueless about programming, but I haven't tackled any sort of serious project in a long long time (I believe last time was sometime in highschool about 5 years ago). And I never did learn many of the advanced aspects of programming when I took my highschool courses (such as Design Patterns, or the more complex data structures such as B-trees). I don't want to just try to teach myself those things through random implementation tutorials, I'd rather learn about them in order to design and program my Game/Game Engine.

Also, for future reference I plan on using the font that Dwarf Fortress does and rendering my world in text the way DF does.
JDance
Profile Joined March 2011
Sweden14 Posts
May 12 2011 10:50 GMT
#1059
@Bobbias: Sorry haven't followed the thread, but don't make a game engine, make a game. It's hard and pointless to make a game engine, and unless you have already made many games, you don't know what a game engine is or what it should do. The point of an engine is to make a game. If you make a game you will have an engine because the game is running. Writing an engine is nice beautiful and idealistic but you just wont do it unless you're John Carmack, and even then he writes the engine with a specific type of games in mind.

A term like game state is an abstraction that has little meaning unless you have been writing games. You can't write an engine with support for game state, since you have no experience of game state. When you write a game, the need for game state will show up and the game will automatically have game state. It is the natural way to learn writing games.
Akka
Profile Joined August 2010
France291 Posts
May 12 2011 11:00 GMT
#1060
@Bobbias

You might want to try to make something simple before jumping to the most complex designs

If I wanted to make such a game, i'd probably first think about what I want the world to be like, as in, how would I store it on my cpu. I'll be using C or Cpp here because I use those two daily.

Say you're using Cpp. You could try making an object called "MapCase" which contains possible references/pointers to NPC/Player/Monster/Whatever... interfaces (because sometimes interfaces are cool, but you don't need to worry about this at first). Then make a big vector/list/? of those objects.
Store all of this in one big "Map" object, give it a "generate" function that will randomly create "MapCases" with different attributes and place them in your container, and you've successfully generated a map you can play on.

So far you'd have something list this :
class Map; // handles the map ^_^ Contains MapCases, NPCs, Monsters
class MapCase; // defines the content of each single case in your map
class NPC; // handles NPCs : merchants, quests, etc.
class Monster; // handles monsters : HPs, fights, etc.
class Player; // handles player : keyboard input, HPs, EXP, etc. Has a pointer/ref on the Map.

That's just a very simple, basic, whatever your want to call it - approach to how to design your game and begin coding it rather than try to understand weirdass diagrams
In a few hours you can have a playable game, even if very simple (like, having you Player character wander on the map, say "Hello" to NPCs and output "Aargh" when he meets a monster).

Once you've got something simple fully functional and safe (no leaks, no WhateverFaults, etc.) you can begin making it sexy, adding new objects (Quests?), etc.

I hope that helped you a bit
Prev 1 51 52 53 54 55 1032 Next
Please log in or register to reply.
Live Events Refresh
Kung Fu Cup
12:00
2025 Monthly #3: Day 1
Reynor vs GuMihoLIVE!
ByuN vs ShoWTimE
RotterdaM523
TKL 182
Rex146
IntoTheiNu 103
SteadfastSC88
Liquipedia
OSC
11:30
Mid Season Playoffs
Cure vs SpiritLIVE!
Krystianer vs Percival
WardiTV446
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 523
Reynor 227
TKL 182
Rex 146
SteadfastSC 88
StarCraft: Brood War
Calm 4495
Rain 2923
Bisu 2701
Hyuk 2015
Horang2 1304
Flash 797
Soma 464
Backho 369
Stork 340
Rush 261
[ Show more ]
Pusan 197
Last 133
Soulkey 115
JulyZerg 104
Barracks 79
hero 58
sSak 33
zelot 31
Aegong 28
sas.Sziky 24
Killer 23
Terrorterran 11
Noble 9
Hm[arnc] 7
Dota 2
Gorgc2155
qojqva1591
Dendi1136
XcaliburYe181
BananaSlamJamma86
Counter-Strike
olofmeister911
allub158
Super Smash Bros
Mew2King127
Other Games
B2W.Neo990
hiko295
DeMusliM285
Pyrionflax260
Sick170
Fuzer 164
Hui .86
QueenE46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Adnapsc2 9
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 1641
• WagamamaTV400
League of Legends
• Nemesis1689
• TFBlade702
Upcoming Events
Tenacious Turtle Tussle
9h 5m
The PondCast
20h 5m
RSL Revival
20h 5m
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
22h 5m
WardiTV Korean Royale
22h 5m
PiGosaur Monday
1d 11h
RSL Revival
1d 20h
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
1d 22h
CranKy Ducklings
2 days
RSL Revival
2 days
herO vs Gerald
ByuN vs SHIN
[ Show More ]
Kung Fu Cup
2 days
IPSL
3 days
ZZZero vs rasowy
Napoleon vs KameZerg
BSL 21
3 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
3 days
RSL Revival
3 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
3 days
WardiTV Korean Royale
3 days
BSL 21
4 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
4 days
Dewalt vs WolFix
eOnzErG vs Bonyth
Wardi Open
4 days
Monday Night Weeklies
5 days
WardiTV Korean Royale
5 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.